testEnvironment = new TestEnvironment(); $this->jobFactory = $this->getMockBuilder( '\SMW\MediaWiki\JobFactory' ) ->disableOriginalConstructor() ->setMethods( [ 'newUpdateJob' ] ) ->getMock(); $jobQueue = $this->getMockBuilder( '\SMW\MediaWiki\JobQueue' ) ->disableOriginalConstructor() ->getMock(); $this->testEnvironment->registerObject( 'JobFactory', $this->jobFactory ); $this->testEnvironment->registerObject( 'JobQueue', $jobQueue ); } protected function tearDown(): void { $this->testEnvironment->clearPendingDeferredUpdates(); $this->testEnvironment->tearDown(); parent::tearDown(); } public function testCanConstruct() { $this->assertInstanceOf( ChangeTitleUpdate::class, new ChangeTitleUpdate() ); } public function testDoUpdate() { $nullJob = $this->getMockBuilder( '\SMW\MediaWiki\Jobs\NullJob' ) ->disableOriginalConstructor() ->getMock(); $this->jobFactory->expects( $this->atLeastOnce() ) ->method( 'newUpdateJob' ) ->willReturn( $nullJob ); $oldTitle = $this->getMockBuilder( '\MediaWiki\Title\Title' ) ->disableOriginalConstructor() ->getMock(); $newTitle = $this->getMockBuilder( '\MediaWiki\Title\Title' ) ->disableOriginalConstructor() ->getMock(); $instance = new ChangeTitleUpdate( $oldTitle, $newTitle ); $instance->doUpdate(); } }