testEnvironment = new TestEnvironment(); $this->store = $this->getMockBuilder( '\SMW\Store' ) ->disableOriginalConstructor() ->setMethods( [ 'service' ] ) ->getMockForAbstractClass(); $this->cache = $this->getMockBuilder( '\Onoi\Cache\Cache' ) ->disableOriginalConstructor() ->getMock(); } protected function tearDown(): void { $this->testEnvironment->tearDown(); parent::tearDown(); } public function testCanConstruct() { $instance = new TableStatisticsTask( $this->store, $this->cache ); $this->assertInstanceOf( TableStatisticsTask::class, $instance ); } public function testProcess() { $tableStatisticsLookup = $this->getMockBuilder( '\SMW\SQLStore\Lookup\TableStatisticsLookup' ) ->disableOriginalConstructor() ->getMock(); $this->store->expects( $this->atLeastOnce() ) ->method( 'service' ) ->with( 'TableStatisticsLookup' ) ->willReturn( $tableStatisticsLookup ); $this->cache = $this->getMockBuilder( '\Onoi\Cache\Cache' ) ->disableOriginalConstructor() ->getMock(); $this->cache->expects( $this->once() ) ->method( 'fetch' ) ->willReturn( false ); $this->cache->expects( $this->once() ) ->method( 'save' ); $instance = new TableStatisticsTask( $this->store, $this->cache ); $instance->process( [] ); } }