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