diff options
author | Petr Pchelko <ppchelko@wikimedia.org> | 2021-10-05 19:40:02 -0700 |
---|---|---|
committer | Ppchelko <ppchelko@wikimedia.org> | 2021-11-11 15:00:32 +0000 |
commit | 47e8872398fbb512ef06f2ffa387f6ddb7851fd4 (patch) | |
tree | 292621a56d8d26ae3e3615ca7a6af91503204945 /tests | |
parent | 85c0575e9aae9b940608528b7b0814242cb26cb0 (diff) | |
download | mediawikicore-47e8872398fbb512ef06f2ffa387f6ddb7851fd4.tar.gz mediawikicore-47e8872398fbb512ef06f2ffa387f6ddb7851fd4.zip |
Use ParserCache for local file description renders
Currently for every File page view, if the file is local,
CommonsMetadata extension renders the file page twice -
once to extract the metadata, and once to show the page.
Metadata extraction parse was always uncached, so let's
at least use PoolCounter and ParserCache for this parse.
Bug: T292302
Change-Id: If6e1a1a72d794f4fb87105b7528ea0afe92a585f
Diffstat (limited to 'tests')
-rw-r--r-- | tests/phpunit/includes/filerepo/file/LocalFileTest.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/phpunit/includes/filerepo/file/LocalFileTest.php b/tests/phpunit/includes/filerepo/file/LocalFileTest.php index 829c82d6282d..53a44d10b788 100644 --- a/tests/phpunit/includes/filerepo/file/LocalFileTest.php +++ b/tests/phpunit/includes/filerepo/file/LocalFileTest.php @@ -498,13 +498,27 @@ class LocalFileTest extends MediaWikiIntegrationTestCase { } /** - * @covers File::getDescriptionText + * @covers LocalFile::getDescriptionText */ - public function testDescriptionTextForNonExistingFile() { + public function testDescriptionText_NonExisting() { $file = ( new LocalRepo( self::getDefaultInfo() ) )->newFile( 'test!' ); $this->assertFalse( $file->getDescriptionText() ); } + /** + * @covers LocalFile::getDescriptionText + */ + public function testDescriptionText_Existing() { + $this->assertTrue( $this->editPage( + __METHOD__, + 'TEST CONTENT', + '', + NS_FILE + )->isOK() ); + $file = ( new LocalRepo( self::getDefaultInfo() ) )->newFile( __METHOD__ ); + $this->assertStringContainsString( 'TEST CONTENT', $file->getDescriptionText() ); + } + public function provideLoadFromDBAndCache() { return [ 'legacy' => [ |