2015-10-16 14:05:39 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\RelatedArticles;
|
|
|
|
|
|
|
|
use PHPUnit_Framework_TestCase;
|
|
|
|
use Parser;
|
|
|
|
use ParserOutput;
|
|
|
|
use RelatedArticles\Hooks;
|
|
|
|
|
|
|
|
class HooksTest extends PHPUnit_Framework_TestCase {
|
|
|
|
|
|
|
|
public function test_onParserClearState() {
|
|
|
|
$parser = new Parser();
|
|
|
|
$parserOutput = $parser->mOutput = new ParserOutput();
|
2015-11-14 00:03:39 +00:00
|
|
|
$relatedPages = array( 'Maybeshewill' );
|
2015-10-16 14:05:39 +00:00
|
|
|
|
2015-11-14 00:03:39 +00:00
|
|
|
$parserOutput->setExtensionData( 'RelatedArticles', $relatedPages );
|
|
|
|
$parserOutput->setProperty( 'RelatedArticles', $relatedPages );
|
2015-10-16 14:05:39 +00:00
|
|
|
|
|
|
|
Hooks::onParserClearState( $parser );
|
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
array(),
|
|
|
|
$parserOutput->getExtensionData( 'RelatedArticles' ),
|
2015-11-14 00:03:39 +00:00
|
|
|
'It clears the list of related pages.'
|
2015-10-16 14:05:39 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$this->assertEquals(
|
|
|
|
false,
|
|
|
|
$parserOutput->getProperty( 'RelatedArticles' ),
|
2015-11-14 00:03:39 +00:00
|
|
|
'[T115698] It unsets the list of related pages that were set as a property.'
|
2015-10-16 14:05:39 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|