X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FOutputPageTest.php;h=6ab56eb10ad696f81541113a6d582fafa6db4b56;hb=9e8439e79d67788916d488f645108f79016d9aca;hp=00b8d1823f29a5de8f8f4bbb3a45bb1f42c832fa;hpb=9d37c792b2ee408b6a01b43a1a649e6074c11c34;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php
index 00b8d1823f..6ab56eb10a 100644
--- a/tests/phpunit/includes/OutputPageTest.php
+++ b/tests/phpunit/includes/OutputPageTest.php
@@ -93,7 +93,7 @@ class OutputPageTest extends MediaWikiTestCase {
'Some syndication links should be there' );
} else {
$this->assertFalse( $outputPage->isSyndicated(), 'No syndication should be offered' );
- $this->assertEquals( 0, count( $outputPage->getSyndicationLinks() ),
+ $this->assertSame( 0, count( $outputPage->getSyndicationLinks() ),
'No syndication links should be there' );
}
}
@@ -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
*/