X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FFauxRequestTest.php;h=9fe694da039f5de2ef7b6bd01520652ba900a99c;hp=a5d67de82fc35c9c426645a770556c5e5ac57050;hb=1d17bbe56326f4e4a26a5da59d232bbac16aed15;hpb=2c44d89539d4168540bf2394f24f9311f613740c diff --git a/tests/phpunit/includes/FauxRequestTest.php b/tests/phpunit/includes/FauxRequestTest.php index a5d67de82f..9fe694da03 100644 --- a/tests/phpunit/includes/FauxRequestTest.php +++ b/tests/phpunit/includes/FauxRequestTest.php @@ -1,5 +1,7 @@ getEmptySession( new FauxRequest( [] ) ); + $this->assertInstanceOf( + FauxRequest::class, + new FauxRequest( [], false, $session ) + ); + } + /** * @covers FauxRequest::getText */ @@ -26,6 +39,25 @@ class FauxRequestTest extends PHPUnit_Framework_TestCase { $this->assertEquals( '', $req->getText( 'z' ) ); } + // Integration test for parent method. + public function testGetVal() { + $req = new FauxRequest( [ 'crlf' => "A\r\nb" ] ); + $this->assertSame( "A\r\nb", $req->getVal( 'crlf' ), 'CRLF' ); + } + + // Integration test for parent method. + public function testGetRawVal() { + $req = new FauxRequest( [ + 'x' => 'Value', + 'y' => [ 'a' ], + 'crlf' => "A\r\nb" + ] ); + $this->assertSame( 'Value', $req->getRawVal( 'x' ) ); + $this->assertSame( null, $req->getRawVal( 'z' ), 'Not found' ); + $this->assertSame( null, $req->getRawVal( 'y' ), 'Array is ignored' ); + $this->assertSame( "A\r\nb", $req->getRawVal( 'crlf' ), 'CRLF' ); + } + /** * @covers FauxRequest::getValues */