diff options
Diffstat (limited to 'www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Jobs/FulltextSearchTableRebuildJobTest.php')
-rw-r--r-- | www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Jobs/FulltextSearchTableRebuildJobTest.php | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Jobs/FulltextSearchTableRebuildJobTest.php b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Jobs/FulltextSearchTableRebuildJobTest.php new file mode 100644 index 00000000..3c18b202 --- /dev/null +++ b/www/wiki/extensions/SemanticMediaWiki/tests/phpunit/Unit/MediaWiki/Jobs/FulltextSearchTableRebuildJobTest.php @@ -0,0 +1,84 @@ +<?php + +namespace SMW\Tests\MediaWiki\Jobs; + +use SMW\DIWikiPage; +use SMW\MediaWiki\Jobs\FulltextSearchTableRebuildJob; +use SMW\Tests\TestEnvironment; + +/** + * @covers \SMW\MediaWiki\Jobs\FulltextSearchTableRebuildJob + * @group semantic-mediawiki + * + * @license GNU GPL v2+ + * @since 2.5 + * + * @author mwjames + */ +class FulltextSearchTableRebuildJobTest extends \PHPUnit_Framework_TestCase { + + private $testEnvironment; + + protected function setUp() { + parent::setUp(); + + $this->testEnvironment = new TestEnvironment(); + + $store = $this->getMockBuilder( '\SMW\SQLStore\SQLStore' ) + ->getMockForAbstractClass(); + + $this->testEnvironment->registerObject( 'Store', $store ); + } + + protected function tearDown() { + $this->testEnvironment->tearDown(); + parent::tearDown(); + } + + public function testCanConstruct() { + + $title = $this->getMockBuilder( 'Title' ) + ->disableOriginalConstructor() + ->getMock(); + + $this->assertInstanceOf( + 'SMW\MediaWiki\Jobs\FulltextSearchTableRebuildJob', + new FulltextSearchTableRebuildJob( $title ) + ); + } + + /** + * @dataProvider parametersProvider + */ + public function testRunJob( $parameters ) { + + $subject = DIWikiPage::newFromText( __METHOD__ ); + + $instance = new FulltextSearchTableRebuildJob( + $subject->getTitle(), + $parameters + ); + + $this->assertTrue( + $instance->run() + ); + } + + public function parametersProvider() { + + $provider[] = [ + [] + ]; + + $provider[] = [ + [ 'table' => 'Foo' ] + ]; + + $provider[] = [ + [ 'mode' => 'full' ] + ]; + + return $provider; + } + +} |