testEnvironment = new TestEnvironment(); $this->outputFormatter = $this->getMockBuilder( '\SMW\MediaWiki\Specials\Admin\OutputFormatter' ) ->disableOriginalConstructor() ->getMock(); } protected function tearDown(): void { $this->testEnvironment->tearDown(); parent::tearDown(); } public function testCanConstruct() { $this->assertInstanceOf( AlertsTaskHandler::class, new AlertsTaskHandler( $this->outputFormatter, [] ) ); } public function testGetHtml() { $taskHandler = $this->getMockBuilder( '\SMW\MediaWiki\Specials\Admin\TaskHandler' ) ->disableOriginalConstructor() ->setMethods( [ 'getName', 'getHtml' ] ) ->getMockForAbstractClass(); $taskHandler->expects( $this->once() ) ->method( 'getName' ) ->willReturn( 'foo' ); $taskHandler->expects( $this->once() ) ->method( 'getHtml' ) ->willReturn( 'bar' ); $instance = new AlertsTaskHandler( $this->outputFormatter, [ $taskHandler ] ); $this->assertContains( '
bar
', $instance->getHtml() ); } }