X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FOutputPageTest.php;h=aa6e49479a361eac89aa78b6c34d592183aeaf4a;hb=e45170d8f024985711a868abab523f01bebc9f08;hp=00b8d1823f29a5de8f8f4bbb3a45bb1f42c832fa;hpb=8699880aab6f666f902b8d8927325760adfe7c20;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 00b8d1823f..aa6e49479a 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -2606,7 +2606,7 @@ class OutputPageTest extends MediaWikiTestCase { [ [ 'test.quux', ResourceLoaderModule::TYPE_COMBINED ], "" ], @@ -2669,6 +2669,9 @@ class OutputPageTest extends MediaWikiTestCase { $op = TestingAccessWrapper::newFromObject( $op ); $op->rlExemptStyleModules = $exemptStyleModules; + $expect = strtr( $expect, [ + '{blankCombi}' => ResourceLoaderTestCase::BLANK_COMBI, + ] ); $this->assertEquals( $expect, strval( $op->buildExemptModules() ) @@ -2695,7 +2698,7 @@ class OutputPageTest extends MediaWikiTestCase { 'exemptStyleModules' => [ 'site' => [ 'site.styles' ], 'user' => [ 'user.styles' ] ], '' . "\n" . '' . "\n" . - '', + '', ], 'custom modules' => [ 'exemptStyleModules' => [ @@ -2705,8 +2708,8 @@ class OutputPageTest extends MediaWikiTestCase { '' . "\n" . '' . "\n" . '' . "\n" . - '' . "\n" . - '', + '' . "\n" . + '', ], ]; // phpcs:enable @@ -3029,6 +3032,35 @@ class OutputPageTest extends MediaWikiTestCase { ]; } + /** + * @param int $titleLastRevision Last Title revision to set + * @param int $outputRevision Revision stored in OutputPage + * @param bool $expectedResult Expected result of $output->isRevisionCurrent call + * @covers OutputPage::isRevisionCurrent + * @dataProvider provideIsRevisionCurrent + */ + public function testIsRevisionCurrent( $titleLastRevision, $outputRevision, $expectedResult ) { + $titleMock = $this->getMock( Title::class, [], [], '', false ); + $titleMock->expects( $this->any() ) + ->method( 'getLatestRevID' ) + ->willReturn( $titleLastRevision ); + + $output = $this->newInstance( [], null, [ 'notitle' => true ] ); + $output->setTitle( $titleMock ); + $output->setRevisionId( $outputRevision ); + $this->assertEquals( $expectedResult, $output->isRevisionCurrent() ); + } + + public function provideIsRevisionCurrent() { + return [ + [ 10, null, true ], + [ 42, 42, true ], + [ null, 0, true ], + [ 42, 47, false ], + [ 47, 42, false ] + ]; + } + /** * @return OutputPage */