Amal_Udjir/tests/Functional/LoginTest.php

41 lines
1023 B
PHP
Raw Normal View History

2025-04-22 03:10:07 +00:00
<?php
namespace Tests\Functional;
use Tests\Support\FunctionalTester;
class LoginTest extends \Codeception\Test\Unit
{
protected FunctionalTester $tester;
protected function _before()
{
}
// tests
public function testLatihanNumberOne()
{
$I = $this->tester;
$I->amOnPage('/phpunit/result-test-student/');
$responseContent = $I->grabPageSource();
$row = $this->tester->grabFromDatabase('php_testing_rule', 'testing_rule', [
'testing_name' => 'testing_number_one'
]);
$test = str_replace(["\r\n", "\r", "\n", " "], "", $row);
$result_test = htmlspecialchars($test); // hasilnya: &lt;?phpecho1;?&gt;
$result_content = str_replace(["\r\n", "\r", "\n", " "], "", $responseContent); // TANPA htmlentities
$this->assertStringContainsString(
$result_test,
$result_content,
"❌ ERROR: String $result_test tidak ditemukan di halaman!"
);
}
}