Add @covers tags to objectcache tests
[lhc/web/wiklou.git] / tests / phpunit / includes / FauxRequestTest.php
index a5d67de..9fe694d 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use MediaWiki\Session\SessionManager;
+
 class FauxRequestTest extends PHPUnit_Framework_TestCase {
        /**
         * @covers FauxRequest::__construct
@@ -17,6 +19,17 @@ class FauxRequestTest extends PHPUnit_Framework_TestCase {
                $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
         */
@@ -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
         */