testEnvironment = new TestEnvironment(); $this->jobFactory = $this->getMockBuilder( '\SMW\MediaWiki\JobFactory' ) ->disableOriginalConstructor() ->getMock(); } protected function tearDown(): void { $this->testEnvironment->tearDown(); parent::tearDown(); } public function testCanConstruct() { $instance = new InsertJobTask( $this->jobFactory ); $this->assertInstanceOf( InsertJobTask::class, $instance ); } public function testProcess() { $nullJob = $this->getMockBuilder( '\SMW\MediaWiki\Jobs\NullJob' ) ->disableOriginalConstructor() ->getMock(); $nullJob->expects( $this->atLeastOnce() ) ->method( 'insert' ); $this->jobFactory->expects( $this->atLeastOnce() ) ->method( 'newByType' ) ->with( 'Foobar', $this->anything(), $this->anything() ) ->willReturn( $nullJob ); $instance = new InsertJobTask( $this->jobFactory ); $instance->process( [ 'subject' => 'Foo#0##', 'job' => 'Foobar' ] ); } }