public function tearDown()
{
$this->tearDownSecurity();
$persistenceManager = self::$bootstrap->getObjectManager()->get(\Neos\Flow\Persistence\PersistenceManagerInterface::class);
// Explicitly call persistAll() so that the "allObjectsPersisted" signal is sent even if persistAll()
// has not been called during a test. This makes sure that for example certain repositories can clear
// their internal registry in order to avoid side effects in the following test run.
// Wrap in try/catch to suppress errors after the actual test is run (e.g. validation)
try {
$persistenceManager->persistAll();
} catch (\Exception $exception) {
}
if (is_callable(array($persistenceManager, 'tearDown'))) {
$persistenceManager->tearDown();
}
self::$bootstrap->getObjectManager()->forgetInstance(\Neos\Flow\Http\Client\InternalRequestEngine::class);
self::$bootstrap->getObjectManager()->forgetInstance(\Neos\Flow\Persistence\Aspect\PersistenceMagicAspect::class);
$this->inject(self::$bootstrap->getObjectManager()->get(\Neos\Flow\ResourceManagement\ResourceRepository::class), 'addedResources', new \SplObjectStorage());
$this->inject(self::$bootstrap->getObjectManager()->get(\Neos\Flow\ResourceManagement\ResourceRepository::class), 'removedResources', new \SplObjectStorage());
$this->inject(self::$bootstrap->getObjectManager()->get(\Neos\Flow\ResourceManagement\ResourceTypeConverter::class), 'convertedResources', array());
$this->cleanupPersistentResourcesDirectory();
$this->emitFunctionalTestTearDown();
}