MessageIndexRebuildJobTest.php
Go to the documentation of this file.00001 <?php
00016 class MessageIndexRebuildJobTest extends MediaWikiTestCase {
00017 protected $config = array();
00018
00019 public function setUp() {
00020 parent::setUp();
00021 $this->setMwGlobals( array(
00022 'wgTranslateCC' => array(),
00023 'wgTranslateMessageIndex' => array( 'DatabaseMessageIndex' ),
00024 'wgTranslateWorkflowStates' => false,
00025 'wgEnablePageTranslation' => false,
00026 'wgTranslateGroupFiles' => array(),
00027 'wgTranslateTranslationServices' => array(),
00028 'wgTranslateDelayedMessageIndexRebuild' => false
00029 ) );
00030 }
00031
00032 public function testNewJob() {
00033 $job = MessageIndexRebuildJob::newJob();
00034 $this->assertInstanceOf(
00035 'MessageIndexRebuildJob',
00036 $job,
00037 'Job of correct type is created'
00038 );
00039 }
00040
00041 public function testInsertImmediate() {
00042 global $wgTranslateDelayedMessageIndexRebuild;
00043 $wgTranslateDelayedMessageIndexRebuild = false;
00044 $job = MessageIndexRebuildJob::newJob();
00045 $this->assertTrue( $job->insert(), 'Job is executed succesfully' );
00046 $this->assertFalse(
00047 Job::pop_type( 'MessageIndexRebuildJob' ),
00048 'There is no job in the JobQueue'
00049 );
00050 }
00051
00052 public function testInsertDelayed() {
00053 global $wgTranslateDelayedMessageIndexRebuild;
00054 $wgTranslateDelayedMessageIndexRebuild = true;
00055 $job = MessageIndexRebuildJob::newJob();
00056 $this->assertTrue( $job->insert(), 'Job is inserted succesfully' );
00057 $popJob = Job::pop_type( 'MessageIndexRebuildJob' );
00058 $this->assertInstanceOf(
00059 'MessageIndexRebuildJob',
00060 $popJob,
00061 'There is a job in the JobQueue'
00062 );
00063 $this->assertTrue( $popJob->run(), 'Job is executed succesfully' );
00064 }
00065 }