Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / tests / phpunit / includes / title / TitleValueTest.php
index 4dbda74..d221b43 100644 (file)
@@ -78,7 +78,7 @@ class TitleValueTest extends MediaWikiTestCase {
         * @dataProvider badConstructorProvider
         */
        public function testConstructionErrors( $ns, $text, $fragment, $interwiki ) {
-               $this->setExpectedException( 'InvalidArgumentException' );
+               $this->setExpectedException( InvalidArgumentException::class );
                new TitleValue( $ns, $text, $fragment, $interwiki );
        }
 
@@ -116,4 +116,33 @@ class TitleValueTest extends MediaWikiTestCase {
 
                $this->assertEquals( $text, $title->getText() );
        }
+
+       public function provideTestToString() {
+               yield [
+                       new TitleValue( 0, 'Foo' ),
+                       '0:Foo'
+               ];
+               yield [
+                       new TitleValue( 1, 'Bar_Baz' ),
+                       '1:Bar_Baz'
+               ];
+               yield [
+                       new TitleValue( 9, 'JoJo', 'Frag' ),
+                       '9:JoJo#Frag'
+               ];
+               yield [
+                       new TitleValue( 200, 'tea', 'Fragment', 'wikicode' ),
+                       'wikicode:200:tea#Fragment'
+               ];
+       }
+
+       /**
+        * @dataProvider provideTestToString
+        */
+       public function testToString( TitleValue $value, $expected ) {
+               $this->assertSame(
+                       $expected,
+                       $value->__toString()
+               );
+       }
 }