41 lines
1023 B
PHP
41 lines
1023 B
PHP
|
|
<?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: <?phpecho1;?>
|
||
|
|
|
||
|
|
$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!"
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|