Merge "StringUtils: Add a utility for checking if a string is a valid regex"
[lhc/web/wiklou.git] / tests / phpunit / includes / filerepo / file / LocalFileTest.php
index e25e606..8f37805 100644 (file)
@@ -7,6 +7,19 @@
 
 class LocalFileTest extends MediaWikiTestCase {
 
+       /** @var LocalRepo */
+       private $repo_hl0;
+       /** @var LocalRepo */
+       private $repo_hl2;
+       /** @var LocalRepo */
+       private $repo_lc;
+       /** @var File */
+       private $file_hl0;
+       /** @var File */
+       private $file_hl2;
+       /** @var File */
+       private $file_lc;
+
        protected function setUp() {
                parent::setUp();
 
@@ -180,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() );
+       }
 }