'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' );
}
}
[
[ 'test.quux', ResourceLoaderModule::TYPE_COMBINED ],
"<script nonce=\"secret\">(RLQ=window.RLQ||[]).push(function(){"
- . "mw.loader.implement(\"test.quux@1ev0ijv\",function($,jQuery,require,module){"
+ . "mw.loader.implement(\"test.quux@1ev0i\",function($,jQuery,require,module){"
. "mw.test.baz({token:123});},{\"css\":[\".mw-icon{transition:none}"
. "\"]});});</script>"
],
$op = TestingAccessWrapper::newFromObject( $op );
$op->rlExemptStyleModules = $exemptStyleModules;
+ $expect = strtr( $expect, [
+ '{blankCombi}' => ResourceLoaderTestCase::BLANK_COMBI,
+ ] );
$this->assertEquals(
$expect,
strval( $op->buildExemptModules() )
'exemptStyleModules' => [ 'site' => [ 'site.styles' ], 'user' => [ 'user.styles' ] ],
'<meta name="ResourceLoaderDynamicStyles" content=""/>' . "\n" .
'<link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles"/>' . "\n" .
- '<link rel="stylesheet" href="/w/load.php?lang=en&modules=user.styles&only=styles&version=1ai9g6t"/>',
+ '<link rel="stylesheet" href="/w/load.php?lang=en&modules=user.styles&only=styles&version=15pue"/>',
],
'custom modules' => [
'exemptStyleModules' => [
'<meta name="ResourceLoaderDynamicStyles" content=""/>' . "\n" .
'<link rel="stylesheet" href="/w/load.php?lang=en&modules=example.site.a%2Cb&only=styles"/>' . "\n" .
'<link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles"/>' . "\n" .
- '<link rel="stylesheet" href="/w/load.php?lang=en&modules=example.user&only=styles&version=0a56zyi"/>' . "\n" .
- '<link rel="stylesheet" href="/w/load.php?lang=en&modules=user.styles&only=styles&version=1ai9g6t"/>',
+ '<link rel="stylesheet" href="/w/load.php?lang=en&modules=example.user&only=styles&version={blankCombi}"/>' . "\n" .
+ '<link rel="stylesheet" href="/w/load.php?lang=en&modules=user.styles&only=styles&version=15pue"/>',
],
];
// phpcs:enable
];
}
+ /**
+ * @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
*/