X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Ffilerepo%2Ffile%2FLocalFileTest.php;h=8f378052a33fe6dbca3a021b3a5d0ed618c6284a;hb=bdc6b4e378c6872a20f6fb5842f1a49961af91b4;hp=ffaa2c32bf8fd8982d121bf82ccac6fa531a6660;hpb=1e3c2e5904d628c001a8d65909b135ea9bf042aa;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/filerepo/file/LocalFileTest.php b/tests/phpunit/includes/filerepo/file/LocalFileTest.php index ffaa2c32bf..8f378052a3 100644 --- a/tests/phpunit/includes/filerepo/file/LocalFileTest.php +++ b/tests/phpunit/includes/filerepo/file/LocalFileTest.php @@ -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(); @@ -176,8 +189,30 @@ class LocalFileTest extends MediaWikiTestCase { $file = wfLocalFile( "File:Some_file_that_probably_doesn't exist.png" ); $this->assertThat( $file, - $this->isInstanceOf( 'LocalFile' ), + $this->isInstanceOf( LocalFile::class ), '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() ); + } }