LocalFile: avoid hard failures on non-existing files.
[lhc/web/wiklou.git] / tests / phpunit / includes / filerepo / file / LocalFileTest.php
index 7acd237..8f37805 100644 (file)
@@ -193,4 +193,26 @@ class LocalFileTest extends MediaWikiTestCase {
                        'wfLocalFile() returns LocalFile for valid Titles'
                );
        }
+
+       /**
+        * @covers File::getUser
+        */
+       public function testGetUserForNonExistingFile() {
+               $this->assertSame( 'Unknown user', $this->file_hl0->getUser() );
+               $this->assertSame( 0, $this->file_hl0->getUser( 'id' ) );
+       }
+
+       /**
+        * @covers File::getUser
+        */
+       public function testDescriptionShortUrlForNonExistingFile() {
+               $this->assertNull( $this->file_hl0->getDescriptionShortUrl() );
+       }
+
+       /**
+        * @covers File::getUser
+        */
+       public function testDescriptionTextForNonExistingFile() {
+               $this->assertFalse( $this->file_hl0->getDescriptionText() );
+       }
 }