testEnvironment = new TestEnvironment(); $this->spyMessageReporter = $this->testEnvironment->getUtilityFactory()->newSpyMessagereporter(); } protected function tearDown(): void { $this->testEnvironment->tearDown(); parent::tearDown(); } public function testCanConstruct() { $this->assertInstanceOf( runImport::class, new runImport() ); } public function testExecute() { $instance = new runImport(); $instance->setMessageReporter( $this->spyMessageReporter ); $instance->execute(); $this->assertContains( 'Import task(s)', $this->spyMessageReporter->getMessagesAsString() ); } }