X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fparser%2FParserOutputTest.php;h=390ea415a01fb14ec5989369bfca8486d6104cfb;hb=b53f299af26aa0b14b3cd3cc37ec1126a61cdc62;hp=7091d9c62bdf4538480f93ab2995e3426274970f;hpb=df76e044f554548fe8f7b2e997e3954e440f9826;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/parser/ParserOutputTest.php b/tests/phpunit/includes/parser/ParserOutputTest.php index 7091d9c62b..390ea415a0 100644 --- a/tests/phpunit/includes/parser/ParserOutputTest.php +++ b/tests/phpunit/includes/parser/ParserOutputTest.php @@ -32,6 +32,12 @@ class ParserOutputTest extends MediaWikiLangTestCase { ]; } + public function tearDown() { + MWTimestamp::setFakeTime( false ); + + parent::tearDown(); + } + /** * Test to make sure ParserOutput::isLinkInternal behaves properly * @dataProvider provideIsLinkInternal @@ -143,37 +149,6 @@ class ParserOutputTest extends MediaWikiLangTestCase { $this->assertNotContains( 'class="foo bar"', $text ); } - public function testT203716() { - // simulate extra wrapping from old parser cache - $out = new ParserOutput( '
Foo
' ); - $out = unserialize( serialize( $out ) ); - - $plainText = $out->getText( [ 'unwrap' => true ] ); - $wrappedText = $out->getText( [ 'unwrap' => false ] ); - $wrappedText2 = $out->getText( [ 'wrapperDivClass' => 'mw-parser-output' ] ); - - $this->assertNotContains( 'assertContains( 'assertStringNotMatchesFormat( 'assertContains( 'assertStringNotMatchesFormat( 'addWrapperDivClass( 'mw-parser-outout' ); - $out = unserialize( serialize( $out ) ); - - $plainText = $out->getText( [ 'unwrap' => true ] ); - $wrappedText = $out->getText( [ 'unwrap' => false ] ); - $wrappedText2 = $out->getText( [ 'wrapperDivClass' => 'mw-parser-output' ] ); - - $this->assertNotContains( 'assertContains( 'assertStringNotMatchesFormat( 'assertContains( 'assertStringNotMatchesFormat( 'getCacheTime(); + + // Use current (fake) time per default. Ignore the last digit. + // Subsequent calls must yield the exact same timestamp as the first. + $this->assertStringStartsWith( '2010010100000', $time ); + $this->assertSame( $time, $po->getCacheTime() ); + + // After setting, the getter must return the time that was set. + $time = '20110606112233'; + $po->setCacheTime( $time ); + $this->assertSame( $time, $po->getCacheTime() ); + + // support -1 as a marker for "not cacheable" + $time = -1; + $po->setCacheTime( $time ); + $this->assertSame( $time, $po->getCacheTime() ); + } + }