2 use Wikimedia\TestingAccessWrapper;
13 [
false,
'http://example.org',
'http://mediawiki.org' ],
15 [
true,
'http://example.org',
'http://example.org' ],
16 [
true,
'https://example.org',
'https://example.org' ],
17 [
true,
'//example.org',
'//example.org' ],
19 [
true,
'http://example.org',
'http://EXAMPLE.ORG' ],
21 [
true,
'http://example.org',
'http://example.org/wiki/Main_Page' ],
22 [
true,
'http://example.org',
'http://example.org?my=query' ],
23 [
true,
'http://example.org',
'http://example.org#its-a-fragment' ],
25 [
false,
'http://example.org',
'https://example.org' ],
26 [
false,
'https://example.org',
'http://example.org' ],
28 [
true,
'//example.org',
'http://example.org' ],
29 [
true,
'//example.org',
'https://example.org' ],
31 [
false,
'//example.org',
'irc://example.org' ],
36 MWTimestamp::setFakeTime(
false );
57 $po->setExtensionData(
"one",
"Foo" );
59 $this->assertEquals(
"Foo", $po->getExtensionData(
"one" ) );
60 $this->assertNull( $po->getExtensionData(
"spam" ) );
62 $po->setExtensionData(
"two",
"Bar" );
63 $this->assertEquals(
"Foo", $po->getExtensionData(
"one" ) );
64 $this->assertEquals(
"Bar", $po->getExtensionData(
"two" ) );
66 $po->setExtensionData(
"one",
null );
67 $this->assertNull( $po->getExtensionData(
"one" ) );
68 $this->assertEquals(
"Bar", $po->getExtensionData(
"two" ) );
80 $po->setProperty(
'foo',
'val' );
82 $properties = $po->getProperties();
83 $this->assertEquals( $po->getProperty(
'foo' ),
'val' );
84 $this->assertEquals( $properties[
'foo'],
'val' );
86 $po->setProperty(
'foo',
'second val' );
88 $properties = $po->getProperties();
89 $this->assertEquals( $po->getProperty(
'foo' ),
'second val' );
90 $this->assertEquals( $properties[
'foo'],
'second val' );
92 $po->unsetProperty(
'foo' );
94 $properties = $po->getProperties();
95 $this->assertEquals( $po->getProperty(
'foo' ),
false );
96 $this->assertArrayNotHasKey(
'foo', $properties );
108 $po->setText(
'Kittens' );
109 $this->assertContains(
'Kittens', $po->getText() );
110 $this->assertNotContains(
'<div', $po->getText() );
111 $this->assertSame(
'Kittens', $po->getRawText() );
113 $po->addWrapperDivClass(
'foo' );
114 $text = $po->getText();
115 $this->assertContains(
'Kittens', $text );
116 $this->assertContains(
'<div', $text );
117 $this->assertContains(
'class="foo"', $text );
119 $po->addWrapperDivClass(
'bar' );
120 $text = $po->getText();
121 $this->assertContains(
'Kittens', $text );
122 $this->assertContains(
'<div', $text );
123 $this->assertContains(
'class="foo bar"', $text );
125 $po->addWrapperDivClass(
'bar' );
126 $text = $po->getText( [
'unwrap' =>
true ] );
127 $this->assertContains(
'Kittens', $text );
128 $this->assertNotContains(
'<div', $text );
129 $this->assertNotContains(
'class="foo bar"', $text );
131 $text = $po->getText( [
'wrapperDivClass' =>
'' ] );
132 $this->assertContains(
'Kittens', $text );
133 $this->assertNotContains(
'<div', $text );
134 $this->assertNotContains(
'class="foo bar"', $text );
136 $text = $po->getText( [
'wrapperDivClass' =>
'xyzzy' ] );
137 $this->assertContains(
'Kittens', $text );
138 $this->assertContains(
'<div', $text );
139 $this->assertContains(
'class="xyzzy"', $text );
140 $this->assertNotContains(
'class="foo bar"', $text );
142 $text = $po->getRawText();
143 $this->assertSame(
'Kittens', $text );
145 $po->clearWrapperDivClass();
146 $text = $po->getText();
147 $this->assertContains(
'Kittens', $text );
148 $this->assertNotContains(
'<div', $text );
149 $this->assertNotContains(
'class="foo bar"', $text );
161 'wgArticlePath' =>
'/wiki/$1',
162 'wgScriptPath' =>
'/w',
163 'wgScript' =>
'/w/index.php',
168 $this->assertSame( $expect, $actual );
176 <mw:toc><
div id=
"toc" class=
"toc"><
div class=
"toctitle"><h2>Contents</h2></
div>
178 <li
class=
"toclevel-1 tocsection-1"><
a href=
"#Section_1"><span
class=
"tocnumber">1</span> <span
class=
"toctext">Section 1</span></
a></li>
179 <li
class=
"toclevel-1 tocsection-2"><
a href=
"#Section_2"><span
class=
"tocnumber">2</span> <span
class=
"toctext">Section 2</span></
a>
181 <li
class=
"toclevel-2 tocsection-3"><
a href=
"#Section_2.1"><span
class=
"tocnumber">2.1</span> <span
class=
"toctext">Section 2.1</span></
a></li>
184 <li
class=
"toclevel-1 tocsection-4"><
a href=
"#Section_3"><span
class=
"tocnumber">3</span> <span
class=
"toctext">Section 3</span></
a></li>
188 <h2><span
class=
"mw-headline" id=
"Section_1">Section 1</span><mw:editsection
page=
"Test Page" section=
"1">Section 1</mw:editsection></h2>
191 <h2><span
class=
"mw-headline" id=
"Section_2">Section 2</span><mw:editsection
page=
"Test Page" section=
"2">Section 2</mw:editsection></h2>
194 <h3><span
class=
"mw-headline" id=
"Section_2.1">Section 2.1</span><mw:editsection
page=
"Test Page" section=
"3">Section 2.1</mw:editsection></h3>
197 <h2><span
class=
"mw-headline" id=
"Section_3">Section 3</span><mw:editsection
page=
"Test Page" section=
"4">Section 3</mw:editsection></h2>
220 <
div id=
"toc" class=
"toc"><
div class=
"toctitle"><h2>Contents</h2></
div>
222 <li
class=
"toclevel-1 tocsection-1"><
a href=
"#Section_1"><span
class=
"tocnumber">1</span> <span
class=
"toctext">Section 1</span></
a></li>
223 <li
class=
"toclevel-1 tocsection-2"><
a href=
"#Section_2"><span
class=
"tocnumber">2</span> <span
class=
"toctext">Section 2</span></
a>
225 <li
class=
"toclevel-2 tocsection-3"><
a href=
"#Section_2.1"><span
class=
"tocnumber">2.1</span> <span
class=
"toctext">Section 2.1</span></
a></li>
228 <li
class=
"toclevel-1 tocsection-4"><
a href=
"#Section_3"><span
class=
"tocnumber">3</span> <span
class=
"toctext">Section 3</span></
a></li>
232 <h2><span
class=
"mw-headline" id=
"Section_1">Section 1</span><span
class=
"mw-editsection"><span
class=
"mw-editsection-bracket">[</span><
a href=
"/w/index.php?title=Test_Page&action=edit&section=1" title=
"Edit section: Section 1">edit</
a><span
class=
"mw-editsection-bracket">]</span></span></h2>
235 <h2><span
class=
"mw-headline" id=
"Section_2">Section 2</span><span
class=
"mw-editsection"><span
class=
"mw-editsection-bracket">[</span><
a href=
"/w/index.php?title=Test_Page&action=edit&section=2" title=
"Edit section: Section 2">edit</
a><span
class=
"mw-editsection-bracket">]</span></span></h2>
238 <h3><span
class=
"mw-headline" id=
"Section_2.1">Section 2.1</span><span
class=
"mw-editsection"><span
class=
"mw-editsection-bracket">[</span><
a href=
"/w/index.php?title=Test_Page&action=edit&section=3" title=
"Edit section: Section 2.1">edit</
a><span
class=
"mw-editsection-bracket">]</span></span></h3>
241 <h2><span
class=
"mw-headline" id=
"Section_3">Section 3</span><span
class=
"mw-editsection"><span
class=
"mw-editsection-bracket">[</span><
a href=
"/w/index.php?title=Test_Page&action=edit&section=4" title=
"Edit section: Section 3">edit</
a><span
class=
"mw-editsection-bracket">]</span></span></h2>
246 'Disable section edit links' => [
247 [
'enableSectionEditLinks' =>
false ], $text, <<<EOF
250 <
div id=
"toc" class=
"toc"><
div class=
"toctitle"><h2>Contents</h2></
div>
252 <li
class=
"toclevel-1 tocsection-1"><
a href=
"#Section_1"><span
class=
"tocnumber">1</span> <span
class=
"toctext">Section 1</span></
a></li>
253 <li
class=
"toclevel-1 tocsection-2"><
a href=
"#Section_2"><span
class=
"tocnumber">2</span> <span
class=
"toctext">Section 2</span></
a>
255 <li
class=
"toclevel-2 tocsection-3"><
a href=
"#Section_2.1"><span
class=
"tocnumber">2.1</span> <span
class=
"toctext">Section 2.1</span></
a></li>
258 <li
class=
"toclevel-1 tocsection-4"><
a href=
"#Section_3"><span
class=
"tocnumber">3</span> <span
class=
"toctext">Section 3</span></
a></li>
262 <h2><span
class=
"mw-headline" id=
"Section_1">Section 1</span></h2>
265 <h2><span
class=
"mw-headline" id=
"Section_2">Section 2</span></h2>
268 <h3><span
class=
"mw-headline" id=
"Section_2.1">Section 2.1</span></h3>
271 <h2><span
class=
"mw-headline" id=
"Section_3">Section 3</span></h2>
276 'Disable TOC, but wrap' => [
277 [
'allowTOC' =>
false,
'wrapperDivClass' =>
'mw-parser-output' ], $text, <<<EOF
281 <h2><span
class=
"mw-headline" id=
"Section_1">Section 1</span><span
class=
"mw-editsection"><span
class=
"mw-editsection-bracket">[</span><
a href=
"/w/index.php?title=Test_Page&action=edit&section=1" title=
"Edit section: Section 1">edit</
a><span
class=
"mw-editsection-bracket">]</span></span></h2>
284 <h2><span
class=
"mw-headline" id=
"Section_2">Section 2</span><span
class=
"mw-editsection"><span
class=
"mw-editsection-bracket">[</span><
a href=
"/w/index.php?title=Test_Page&action=edit&section=2" title=
"Edit section: Section 2">edit</
a><span
class=
"mw-editsection-bracket">]</span></span></h2>
287 <h3><span
class=
"mw-headline" id=
"Section_2.1">Section 2.1</span><span
class=
"mw-editsection"><span
class=
"mw-editsection-bracket">[</span><
a href=
"/w/index.php?title=Test_Page&action=edit&section=3" title=
"Edit section: Section 2.1">edit</
a><span
class=
"mw-editsection-bracket">]</span></span></h3>
290 <h2><span
class=
"mw-headline" id=
"Section_3">Section 3</span><span
class=
"mw-editsection"><span
class=
"mw-editsection-bracket">[</span><
a href=
"/w/index.php?title=Test_Page&action=edit&section=4" title=
"Edit section: Section 3">edit</
a><span
class=
"mw-editsection-bracket">]</span></span></h2>
295 'Style deduplication' => [
296 [], $dedupText, <<<EOF
299 <
link rel=
"mw-deduplicated-inline-style" href=
"mw-data:duplicate1"/>
301 <
link rel=
"mw-deduplicated-inline-style" href=
"mw-data:duplicate1"/>
302 <
link rel=
"mw-deduplicated-inline-style" href=
"mw-data:duplicate2"/>
304 <
link rel=
"mw-deduplicated-inline-style" href=
"mw-data:duplicate1"/>
309 'Style deduplication disabled' => [
310 [
'deduplicateStyles' =>
false ], $dedupText, $dedupText
321 $this->assertTrue( $po->hasText() );
324 $this->assertFalse( $po->hasText() );
327 $this->assertTrue( $po->hasText() );
331 $this->assertTrue( $po->hasText() );
357 $a->setTitleText(
'X' );
359 yield
'only left title text' => [ $a, $b, [
'getTitleText' =>
'X' ] ];
363 $b->setTitleText(
'Y' );
364 yield
'only right title text' => [ $a, $b, [
'getTitleText' =>
'Y' ] ];
367 $a->setTitleText(
'X' );
369 $b->setTitleText(
'Y' );
370 yield
'left title text wins' => [ $a, $b, [
'getTitleText' =>
'X' ] ];
374 $a->setIndexPolicy(
'index' );
376 yield
'only left index policy' => [ $a, $b, [
'getIndexPolicy' =>
'index' ] ];
380 $b->setIndexPolicy(
'index' );
381 yield
'only right index policy' => [ $a, $b, [
'getIndexPolicy' =>
'index' ] ];
384 $a->setIndexPolicy(
'noindex' );
386 $b->setIndexPolicy(
'index' );
387 yield
'left noindex wins' => [ $a, $b, [
'getIndexPolicy' =>
'noindex' ] ];
390 $a->setIndexPolicy(
'index' );
392 $b->setIndexPolicy(
'noindex' );
393 yield
'right noindex wins' => [ $a, $b, [
'getIndexPolicy' =>
'noindex' ] ];
397 $a->addHeadItem(
'<foo1>' );
398 $a->addHeadItem(
'<bar1>',
'bar' );
399 $a->addModules(
'test-module-a' );
400 $a->addModuleScripts(
'test-module-script-a' );
401 $a->addModuleStyles(
'test-module-styles-a' );
402 $b->addJsConfigVars(
'test-config-var-a',
'a' );
405 $b->setIndexPolicy(
'noindex' );
406 $b->addHeadItem(
'<foo2>' );
407 $b->addHeadItem(
'<bar2>',
'bar' );
408 $b->addModules(
'test-module-b' );
409 $b->addModuleScripts(
'test-module-script-b' );
410 $b->addModuleStyles(
'test-module-styles-b' );
411 $b->addJsConfigVars(
'test-config-var-b',
'b' );
412 $b->addJsConfigVars(
'test-config-var-a',
'X' );
414 yield
'head items and friends' => [ $a, $b, [
424 'getModuleScripts' => [
425 'test-module-script-a',
426 'test-module-script-b',
428 'getModuleStyles' => [
429 'test-module-styles-a',
430 'test-module-styles-b',
432 'getJsConfigVars' => [
433 'test-config-var-a' =>
'X',
434 'test-config-var-b' =>
'b',
440 $a->setTOCHTML(
'<p>TOC A</p>' );
441 $a->setSections( [ [
'fromtitle' =>
'A1' ], [
'fromtitle' =>
'A2' ] ] );
444 $b->setTOCHTML(
'<p>TOC B</p>' );
445 $b->setSections( [ [
'fromtitle' =>
'B1' ], [
'fromtitle' =>
'B2' ] ] );
447 yield
'concat TOC' => [ $a, $b, [
448 'getTOCHTML' =>
'<p>TOC A</p><p>TOC B</p>',
450 [
'fromtitle' =>
'A1' ],
451 [
'fromtitle' =>
'A2' ],
452 [
'fromtitle' =>
'B1' ],
453 [
'fromtitle' =>
'B2' ]
459 $a->setNewSection(
true );
460 $a->hideNewSection(
true );
461 $a->setNoGallery(
true );
462 $a->addWrapperDivClass(
'foo' );
464 $a->setIndicator(
'foo',
'Foo!' );
465 $a->setIndicator(
'bar',
'Bar!' );
467 $a->setExtensionData(
'foo',
'Foo!' );
468 $a->setExtensionData(
'bar',
'Bar!' );
471 $b->setNoGallery(
true );
472 $b->setEnableOOUI(
true );
473 $b->preventClickjacking(
true );
474 $a->addWrapperDivClass(
'bar' );
476 $b->setIndicator(
'zoo',
'Zoo!' );
477 $b->setIndicator(
'bar',
'Barrr!' );
479 $b->setExtensionData(
'zoo',
'Zoo!' );
480 $b->setExtensionData(
'bar',
'Barrr!' );
482 yield
'skin control flags' => [ $a, $b, [
483 'getNewSection' =>
true,
484 'getHideNewSection' =>
true,
485 'getNoGallery' =>
true,
486 'getEnableOOUI' =>
true,
487 'preventClickjacking' =>
true,
493 'getWrapperDivClass' =>
'foo bar',
494 '$mExtensionData' => [
519 unset( $expected[
'getTOCHTML'] );
520 unset( $expected[
'getSections'] );
526 $po = TestingAccessWrapper::newFromObject( $po );
528 foreach ( $expected
as $method =>
$value ) {
529 if ( $method[0] ===
'$' ) {
530 $field = substr( $method, 1 );
531 $actual = $po->__get( $field );
533 $actual = $po->__call( $method, [] );
536 $this->assertEquals(
$value, $actual, $method );
549 $a->addLanguageLink(
'de' );
550 $a->addLanguageLink(
'ru' );
553 $a->addExternalLink(
'https://kittens.wikimedia.test' );
554 $a->addExternalLink(
'https://goats.wikimedia.test' );
556 $a->addCategory(
'Foo',
'X' );
557 $a->addImage(
'Billy.jpg',
'20180101000013',
'DEAD' );
568 $b->addLanguageLink(
'fr' );
569 $b->addLanguageLink(
'ru' );
572 $b->addExternalLink(
'https://dragons.wikimedia.test' );
573 $b->addExternalLink(
'https://goats.wikimedia.test' );
575 $b->addCategory(
'Bar',
'Y' );
576 $b->addImage(
'Puff.jpg',
'20180101000017',
'BEEF' );
578 yield
'all kinds of links' => [ $a, $b, [
602 'getTemplateIds' => [
611 'getLanguageLinks' => [
'de',
'ru',
'fr' ],
612 'getInterwikiLinks' => [
613 'de' => [
'Kittens_DE' => 1 ],
614 'ru' => [
'Kittens_RU' => 1,
'Dragons_RU' => 1, ],
615 'fr' => [
'Kittens_FR' => 1 ],
617 'getCategories' => [
'Foo' =>
'X',
'Bar' =>
'Y' ],
618 'getImages' => [
'Billy.jpg' => 1,
'Puff.jpg' => 1 ],
619 'getFileSearchOptions' => [
620 'Billy.jpg' => [
'time' =>
'20180101000013',
'sha1' =>
'DEAD' ],
621 'Puff.jpg' => [
'time' =>
'20180101000017',
'sha1' =>
'BEEF' ],
623 'getExternalLinks' => [
624 'https://dragons.wikimedia.test' => 1,
625 'https://kittens.wikimedia.test' => 1,
626 'https://goats.wikimedia.test' => 1,
633 $a->setProperty(
'foo',
'Foo!' );
634 $a->setProperty(
'bar',
'Bar!' );
636 $a->setExtensionData(
'foo',
'Foo!' );
637 $a->setExtensionData(
'bar',
'Bar!' );
641 $b->setProperty(
'zoo',
'Zoo!' );
642 $b->setProperty(
'bar',
'Barrr!' );
644 $b->setExtensionData(
'zoo',
'Zoo!' );
645 $b->setExtensionData(
'bar',
'Barrr!' );
647 yield
'properties' => [ $a, $b, [
653 '$mExtensionData' => [
684 $a->addOutputHook(
'foo',
'X' );
685 $a->addOutputHook(
'bar' );
689 $b->addOutputHook(
'foo',
'Y' );
690 $b->addOutputHook(
'bar' );
691 $b->addOutputHook(
'zoo' );
693 yield
'hooks' => [ $a, $b, [
694 'getOutputHooks' => [
705 $a->addWarning(
'Oops' );
706 $a->addWarning(
'Whoops' );
708 $a->setFlag(
'foo' );
709 $a->setFlag(
'bar' );
711 $a->recordOption(
'Foo' );
712 $a->recordOption(
'Bar' );
716 $b->addWarning(
'Yikes' );
717 $b->addWarning(
'Whoops' );
719 $b->setFlag(
'zoo' );
720 $b->setFlag(
'bar' );
722 $b->recordOption(
'Zoo' );
723 $b->recordOption(
'Bar' );
725 yield
'flags' => [ $a, $b, [
726 'getWarnings' => [
'Oops',
'Whoops',
'Yikes' ],
727 '$mFlags' => [
'foo' =>
true,
'bar' =>
true,
'zoo' =>
true ],
728 'getUsedOptions' => [
'Foo',
'Bar',
'Zoo' ],
733 $a->setTimestamp(
'20180101000011' );
735 yield
'only left timestamp' => [ $a, $b, [
'getTimestamp' =>
'20180101000011' ] ];
739 $b->setTimestamp(
'20180101000011' );
740 yield
'only right timestamp' => [ $a, $b, [
'getTimestamp' =>
'20180101000011' ] ];
743 $a->setTimestamp(
'20180101000011' );
745 $b->setTimestamp(
'20180101000001' );
746 yield
'left timestamp wins' => [ $a, $b, [
'getTimestamp' =>
'20180101000011' ] ];
749 $a->setTimestamp(
'20180101000001' );
751 $b->setTimestamp(
'20180101000011' );
752 yield
'right timestamp wins' => [ $a, $b, [
'getTimestamp' =>
'20180101000011' ] ];
756 $a->setSpeculativeRevIdUsed( 9 );
758 yield
'only left speculative rev id' => [ $a, $b, [
'getSpeculativeRevIdUsed' => 9 ] ];
762 $b->setSpeculativeRevIdUsed( 9 );
763 yield
'only right speculative rev id' => [ $a, $b, [
'getSpeculativeRevIdUsed' => 9 ] ];
766 $a->setSpeculativeRevIdUsed( 9 );
768 $b->setSpeculativeRevIdUsed( 9 );
769 yield
'same speculative rev id' => [ $a, $b, [
'getSpeculativeRevIdUsed' => 9 ] ];
774 $a->setLimitReportData(
'naive1', 7 );
775 $a->setLimitReportData(
'naive2', 27 );
777 $a->setLimitReportData(
'limitreport-simple1', 7 );
778 $a->setLimitReportData(
'limitreport-simple2', 27 );
780 $a->setLimitReportData(
'limitreport-pair1', [ 7, 9 ] );
781 $a->setLimitReportData(
'limitreport-pair2', [ 27, 29 ] );
783 $a->setLimitReportData(
'limitreport-more1', [ 7, 9, 1 ] );
784 $a->setLimitReportData(
'limitreport-more2', [ 27, 29, 21 ] );
786 $a->setLimitReportData(
'limitreport-only-a', 13 );
790 $b->setLimitReportData(
'naive1', 17 );
791 $b->setLimitReportData(
'naive2', 17 );
793 $b->setLimitReportData(
'limitreport-simple1', 17 );
794 $b->setLimitReportData(
'limitreport-simple2', 17 );
796 $b->setLimitReportData(
'limitreport-pair1', [ 17, 19 ] );
797 $b->setLimitReportData(
'limitreport-pair2', [ 17, 19 ] );
799 $b->setLimitReportData(
'limitreport-more1', [ 17, 19, 11 ] );
800 $b->setLimitReportData(
'limitreport-more2', [ 17, 19, 11 ] );
802 $b->setLimitReportData(
'limitreport-only-b', 23 );
805 yield
'limit report' => [ $a, $b, [
806 'getLimitReportData' => [
809 'limitreport-simple1' => 7,
810 'limitreport-simple2' => 27,
811 'limitreport-pair1' => [ 7, 9 ],
812 'limitreport-pair2' => [ 27, 29 ],
813 'limitreport-more1' => [ 7, 9, 1 ],
814 'limitreport-more2' => [ 27, 29, 21 ],
815 'limitreport-only-a' => 13,
817 'getLimitReportJSData' => [
823 'pair1' => [
'value' => 7,
'limit' => 9 ],
824 'pair2' => [
'value' => 27,
'limit' => 29 ],
825 'more1' => [ 7, 9, 1 ],
826 'more2' => [ 27, 29, 21 ],
855 $a = TestingAccessWrapper::newFromObject( $a );
857 $a->resetParseStartTime();
858 $aClocks = $a->mParseStartTime;
862 $a->mergeInternalMetaDataFrom( $b );
863 $mergedClocks = $a->mParseStartTime;
865 foreach ( $mergedClocks
as $clock => $timestamp ) {
866 $this->assertSame( $aClocks[$clock], $timestamp, $clock );
874 $b = TestingAccessWrapper::newFromObject( $b );
876 $b->resetParseStartTime();
878 $bClocks = $b->mParseStartTime;
880 $a->mergeInternalMetaDataFrom( $b->object,
'b' );
881 $mergedClocks = $a->mParseStartTime;
883 foreach ( $mergedClocks
as $clock => $timestamp ) {
884 $this->assertSame( $aClocks[$clock], $timestamp, $clock );
885 $this->assertLessThanOrEqual( $bClocks[$clock], $timestamp, $clock );
890 $a->resetParseStartTime();
891 $aClocks = $a->mParseStartTime;
893 $a->mergeInternalMetaDataFrom( $b->object,
'b' );
894 $mergedClocks = $a->mParseStartTime;
896 foreach ( $mergedClocks
as $clock => $timestamp ) {
897 $this->assertSame( $bClocks[$clock], $timestamp, $clock );
898 $this->assertLessThanOrEqual( $aClocks[$clock], $timestamp, $clock );
903 $a = TestingAccessWrapper::newFromObject( $a );
905 $a->mergeInternalMetaDataFrom( $b->object,
'b' );
906 $mergedClocks = $a->mParseStartTime;
908 foreach ( $mergedClocks
as $clock => $timestamp ) {
909 $this->assertSame( $bClocks[$clock], $timestamp, $clock );
918 $clock = MWTimestamp::convert( TS_UNIX,
'20100101000000' );
919 MWTimestamp::setFakeTime(
function ()
use ( &$clock ) {
924 $time = $po->getCacheTime();
928 $this->assertStringStartsWith(
'2010010100000',
$time );
929 $this->assertSame(
$time, $po->getCacheTime() );
932 $time =
'20110606112233';
933 $po->setCacheTime(
$time );
934 $this->assertSame(
$time, $po->getCacheTime() );
938 $po->setCacheTime(
$time );
939 $this->assertSame(
$time, $po->getCacheTime() );