summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Hooks/RejectParserCacheValueTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Hooks/RejectParserCacheValueTest.php')
-rw-r--r--www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Hooks/RejectParserCacheValueTest.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Hooks/RejectParserCacheValueTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Hooks/RejectParserCacheValueTest.php
new file mode 100644
index 00000000..7580a2cb
--- /dev/null
+++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Hooks/RejectParserCacheValueTest.php
@@ -0,0 +1,66 @@
+<?php
+
+namespace SMW\Tests\MediaWiki\Hooks;
+
+use SMW\DIWikiPage;
+use SMW\MediaWiki\Hooks\RejectParserCacheValue;
+use SMW\Tests\TestEnvironment;
+
+/**
+ * @covers \SMW\MediaWiki\Hooks\RejectParserCacheValue
+ * @group semantic-mediawiki
+ *
+ * @license GNU GPL v2+
+ * @since 3.0
+ *
+ * @author mwjames
+ */
+class RejectParserCacheValueTest extends \PHPUnit_Framework_TestCase {
+
+ private $testEnvironment;
+ private $dependencyLinksUpdateJournal;
+
+ protected function setUp() {
+ parent::setUp();
+
+ $this->testEnvironment = new TestEnvironment();
+
+ $this->dependencyLinksUpdateJournal = $this->getMockBuilder( '\SMW\SQLStore\QueryDependency\DependencyLinksUpdateJournal' )
+ ->disableOriginalConstructor()
+ ->getMock();
+ }
+
+ protected function tearDown() {
+ $this->testEnvironment->tearDown();
+ parent::tearDown();
+ }
+
+ public function testCanConstruct() {
+
+ $this->assertInstanceOf(
+ RejectParserCacheValue::class,
+ new RejectParserCacheValue( $this->dependencyLinksUpdateJournal )
+ );
+ }
+
+ public function testProcessOnJournalEntryToReject() {
+
+ $subject = DIWikiPage::newFromText( __METHOD__ );
+
+ $this->dependencyLinksUpdateJournal->expects( $this->once() )
+ ->method( 'has' )
+ ->will( $this->returnValue( true ) );
+
+ $this->dependencyLinksUpdateJournal->expects( $this->once() )
+ ->method( 'delete' );
+
+ $instance = new RejectParserCacheValue(
+ $this->dependencyLinksUpdateJournal
+ );
+
+ $this->assertFalse(
+ $instance->process( $subject->getTitle() )
+ );
+ }
+
+}