testEnvironment = new TestEnvironment(); $store = $this->getMockBuilder( '\SMW\SQLStore\SQLStore' ) ->disableOriginalConstructor() ->getMock(); $this->jobQueue = $this->getMockBuilder( '\SMW\MediaWiki\JobQueue' ) ->disableOriginalConstructor() ->getMock(); $this->testEnvironment->registerObject( 'JobQueue', $this->jobQueue ); $this->testEnvironment->registerObject( 'Store', $store ); } protected function tearDown(): void { $this->testEnvironment->tearDown(); parent::tearDown(); } public function testCanConstruct() { $title = $this->getMockBuilder( '\MediaWiki\Title\Title' ) ->disableOriginalConstructor() ->getMock(); $this->assertInstanceOf( DeferredConstraintCheckUpdateJob::class, new DeferredConstraintCheckUpdateJob( $title ) ); } public function testPushJob() { $subject = DIWikiPage::newFromText( 'Foo' ); $this->jobQueue->expects( $this->once() ) ->method( 'push' ); DeferredConstraintCheckUpdateJob::pushJob( $subject->getTitle() ); } /** * @dataProvider jobProvider */ public function testRun( $subject, $parameters ) { $instance = new DeferredConstraintCheckUpdateJob( $subject->getTitle(), $parameters ); $this->assertTrue( $instance->run() ); } public function jobProvider() { $provider[] = [ DIWikiPage::newFromText( __METHOD__ ), [] ]; return $provider; } }