<?php
+use MediaWiki\Session\SessionManager;
+
class FauxRequestTest extends PHPUnit_Framework_TestCase {
/**
* @covers FauxRequest::__construct
$req = new FauxRequest( [], false, 'x' );
}
+ /**
+ * @covers FauxRequest::__construct
+ */
+ public function testConstructWithSession() {
+ $session = SessionManager::singleton()->getEmptySession( new FauxRequest( [] ) );
+ $this->assertInstanceOf(
+ FauxRequest::class,
+ new FauxRequest( [], false, $session )
+ );
+ }
+
/**
* @covers FauxRequest::getText
*/
$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
*/