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();
$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() );
+ }
}