diff --git a/.composer.json b/.composer.json index fc12c2ff3a7..02ffb5fff2f 100644 --- a/.composer.json +++ b/.composer.json @@ -35,7 +35,8 @@ "../../bin/behat -f progress -c Neos.ContentRepository.BehavioralTests/Tests/Behavior/behat.yml.dist", "../../bin/behat -f progress -c Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/behat.yml.dist", "../../flow doctrine:migrate --quiet; ../../flow cr:setup", - "../../bin/behat -f progress -c Neos.Neos/Tests/Behavior/behat.yml" + "../../bin/behat -f progress -c Neos.Neos/Tests/Behavior/behat.yml", + "../../bin/behat -f progress -c Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/behat.yml.dist" ], "test:behavioral:stop-on-failure": [ "../../bin/behat -vvv --stop-on-failure -f progress -c Neos.ContentRepository.BehavioralTests/Tests/Behavior/behat.yml.dist", diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/FeatureContext.php b/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/FeatureContext.php index 2f918be284f..d7d3239cd7b 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/FeatureContext.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/FeatureContext.php @@ -11,12 +11,11 @@ * source code. */ -require_once(__DIR__ . '/../../../../../../Application/Neos.Behat/Tests/Behat/FlowContextTrait.php'); require_once(__DIR__ . '/ProjectionIntegrityViolationDetectionTrait.php'); use Behat\Behat\Context\Context as BehatContext; use Behat\Behat\Hook\Scope\BeforeScenarioScope; -use Neos\Behat\Tests\Behat\FlowContextTrait; +use Neos\Behat\FlowBootstrapTrait; use Neos\ContentGraph\DoctrineDbalAdapter\Tests\Behavior\Features\Bootstrap\ProjectionIntegrityViolationDetectionTrait; use Neos\ContentRepository\BehavioralTests\TestSuite\Behavior\CRBehavioralTestsSubjectProvider; use Neos\ContentRepository\BehavioralTests\TestSuite\Behavior\GherkinPyStringNodeBasedNodeTypeManagerFactory; @@ -33,7 +32,7 @@ */ class FeatureContext implements BehatContext { - use FlowContextTrait; + use FlowBootstrapTrait; use ProjectionIntegrityViolationDetectionTrait; use CRTestSuiteTrait; use CRBehavioralTestsSubjectProvider; @@ -42,11 +41,8 @@ class FeatureContext implements BehatContext public function __construct() { - if (self::$bootstrap === null) { - self::$bootstrap = $this->initializeFlow(); - } - $this->objectManager = self::$bootstrap->getObjectManager(); - $this->contentRepositoryRegistry = $this->objectManager->get(ContentRepositoryRegistry::class); + self::bootstrapFlow(); + $this->contentRepositoryRegistry = $this->getObject(ContentRepositoryRegistry::class); $this->setupCRTestSuiteTrait(); $this->setupDbalGraphAdapterIntegrityViolationTrait(); diff --git a/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php b/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php index 82a090cecb4..a318b4ea750 100644 --- a/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php +++ b/Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php @@ -32,6 +32,8 @@ /** * Custom context trait for projection integrity violation detection specific to the Doctrine DBAL content graph adapter + * + * @todo move this class somewhere where its autoloaded */ trait ProjectionIntegrityViolationDetectionTrait { @@ -41,6 +43,14 @@ trait ProjectionIntegrityViolationDetectionTrait protected Result $lastIntegrityViolationDetectionResult; + /** + * @template T of object + * @param class-string $className + * + * @return T + */ + abstract private function getObject(string $className): object; + protected function getTableNamePrefix(): string { return DoctrineDbalContentGraphProjectionFactory::graphProjectionTableNamePrefix( @@ -50,7 +60,7 @@ protected function getTableNamePrefix(): string public function setupDbalGraphAdapterIntegrityViolationTrait() { - $this->dbalClient = $this->getObjectManager()->get(DbalClient::class); + $this->dbalClient = $this->getObject(DbalClient::class); } /** diff --git a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Bootstrap/FeatureContext.php b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Bootstrap/FeatureContext.php index 31d9bc21b50..f6e7e6d0786 100644 --- a/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Bootstrap/FeatureContext.php +++ b/Neos.ContentRepository.BehavioralTests/Tests/Behavior/Bootstrap/FeatureContext.php @@ -11,13 +11,13 @@ * source code. */ -require_once(__DIR__ . '/../../../../../Application/Neos.Behat/Tests/Behat/FlowContextTrait.php'); +// @todo remove this require statement require_once(__DIR__ . '/../../../../Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/Features/Bootstrap/ProjectionIntegrityViolationDetectionTrait.php'); use Behat\Behat\Context\Context as BehatContext; use Behat\Behat\Hook\Scope\BeforeScenarioScope; use GuzzleHttp\Psr7\Uri; -use Neos\Behat\Tests\Behat\FlowContextTrait; +use Neos\Behat\FlowBootstrapTrait; use Neos\ContentGraph\DoctrineDbalAdapter\Tests\Behavior\Features\Bootstrap\ProjectionIntegrityViolationDetectionTrait; use Neos\ContentRepository\BehavioralTests\ProjectionRaceConditionTester\Dto\TraceEntryType; use Neos\ContentRepository\BehavioralTests\ProjectionRaceConditionTester\RedisInterleavingLogger; @@ -38,14 +38,13 @@ use Neos\ContentRepository\TestSuite\Behavior\Features\Bootstrap\StructureAdjustmentsTrait; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Configuration\ConfigurationManager; -use Neos\Flow\ObjectManagement\ObjectManagerInterface; /** * Features context */ class FeatureContext implements BehatContext { - use FlowContextTrait; + use FlowBootstrapTrait; use CRTestSuiteTrait; use CRBehavioralTestsSubjectProvider; use ProjectionIntegrityViolationDetectionTrait; @@ -58,22 +57,19 @@ class FeatureContext implements BehatContext public function __construct() { - if (self::$bootstrap === null) { - self::$bootstrap = $this->initializeFlow(); - } - $this->objectManager = self::$bootstrap->getObjectManager(); + self::bootstrapFlow(); - $this->dbalClient = $this->getObjectManager()->get(DbalClientInterface::class); + $this->dbalClient = $this->getObject(DbalClientInterface::class); $this->setupCRTestSuiteTrait(); $this->setUpInterleavingLogger(); - $this->contentRepositoryRegistry = $this->objectManager->get(ContentRepositoryRegistry::class); + $this->contentRepositoryRegistry = $this->getObject(ContentRepositoryRegistry::class); } private function setUpInterleavingLogger(): void { // prepare race tracking for debugging into the race log if (class_exists(RedisInterleavingLogger::class)) { // the class must exist (the package loaded) - $raceConditionTrackerConfig = $this->getObjectManager()->get(ConfigurationManager::class) + $raceConditionTrackerConfig = $this->getObject(ConfigurationManager::class) ->getConfiguration( ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.ContentRepository.BehavioralTests.raceConditionTracker' @@ -115,11 +111,6 @@ public function resetContentRepositoryComponents(BeforeScenarioScope $scope): vo GherkinPyStringNodeBasedNodeTypeManagerFactory::reset(); } - protected function getObjectManager(): ObjectManagerInterface - { - return $this->objectManager; - } - protected function getContentRepositoryService( ContentRepositoryServiceFactoryInterface $factory ): ContentRepositoryServiceInterface { diff --git a/Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/Bootstrap/FeatureContext.php b/Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/Bootstrap/FeatureContext.php index 53b87836684..b27cd3ac110 100644 --- a/Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/Bootstrap/FeatureContext.php +++ b/Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/Bootstrap/FeatureContext.php @@ -1,15 +1,13 @@ initializeFlow(); - } - $this->objectManager = self::$bootstrap->getObjectManager(); - $this->contentRepositoryRegistry = $this->objectManager->get(ContentRepositoryRegistry::class); + self::bootstrapFlow(); + $this->contentRepositoryRegistry = $this->getObject(ContentRepositoryRegistry::class); $this->mockFilesystemAdapter = new InMemoryFilesystemAdapter(); $this->mockFilesystem = new Filesystem($this->mockFilesystemAdapter); @@ -120,7 +115,7 @@ public function iHaveTheFollowingNodeDataRows(TableNode $nodeDataRows): void public function iRunTheEventMigration(string $contentStream = null): void { $nodeTypeManager = $this->currentContentRepository->getNodeTypeManager(); - $propertyMapper = $this->getObjectManager()->get(PropertyMapper::class); + $propertyMapper = $this->getObject(PropertyMapper::class); $contentGraph = $this->currentContentRepository->getContentGraph(); $nodeFactory = (new \ReflectionClass($contentGraph)) ->getProperty('nodeFactory') @@ -130,7 +125,7 @@ public function iRunTheEventMigration(string $contentStream = null): void ->getValue($nodeFactory); $interDimensionalVariationGraph = $this->currentContentRepository->getVariationGraph(); - $eventNormalizer = $this->getObjectManager()->get(EventNormalizer::class); + $eventNormalizer = $this->getObject(EventNormalizer::class); $migration = new NodeDataToEventsProcessor( $nodeTypeManager, $propertyMapper, diff --git a/Neos.ContentRepositoryRegistry/Classes/TestSuite/Behavior/CRRegistrySubjectProvider.php b/Neos.ContentRepositoryRegistry/Classes/TestSuite/Behavior/CRRegistrySubjectProvider.php index b65af14b832..fd1779fdc61 100644 --- a/Neos.ContentRepositoryRegistry/Classes/TestSuite/Behavior/CRRegistrySubjectProvider.php +++ b/Neos.ContentRepositoryRegistry/Classes/TestSuite/Behavior/CRRegistrySubjectProvider.php @@ -15,7 +15,6 @@ namespace Neos\ContentRepositoryRegistry\TestSuite\Behavior; use Doctrine\DBAL\Connection; -use Neos\Behat\Tests\Behat\FlowContextTrait; use Neos\ContentRepository\Core\ContentRepository; use Neos\ContentRepository\Core\Factory\ContentRepositoryId; use Neos\ContentRepository\Core\Factory\ContentRepositoryServiceFactoryInterface; @@ -24,15 +23,11 @@ use Neos\ContentRepositoryRegistry\Exception\ContentRepositoryNotFoundException; use Neos\EventStore\EventStoreInterface; -require_once(__DIR__ . '/../../../../../Application/Neos.Behat/Tests/Behat/FlowContextTrait.php'); - /** * The node creation trait for behavioral tests */ trait CRRegistrySubjectProvider { - use FlowContextTrait; - protected ContentRepositoryRegistry $contentRepositoryRegistry; protected ?ContentRepository $currentContentRepository = null; @@ -42,13 +37,17 @@ trait CRRegistrySubjectProvider */ protected array $alreadySetUpContentRepositories = []; + /** + * @template T of object + * @param class-string $className + * + * @return T + */ + abstract protected function getObject(string $className): object; + protected function setUpCRRegistry(): void { - if (self::$bootstrap === null) { - self::$bootstrap = $this->initializeFlow(); - } - $this->objectManager = self::$bootstrap->getObjectManager(); - $this->contentRepositoryRegistry = $this->objectManager->get(ContentRepositoryRegistry::class); + $this->contentRepositoryRegistry = $this->getObject(ContentRepositoryRegistry::class); } /** diff --git a/Neos.Neos/Classes/Service/EditorContentStreamZookeeper.php b/Neos.Neos/Classes/Service/EditorContentStreamZookeeper.php index 0dfcea7ee4d..ae7e7af173a 100644 --- a/Neos.Neos/Classes/Service/EditorContentStreamZookeeper.php +++ b/Neos.Neos/Classes/Service/EditorContentStreamZookeeper.php @@ -90,7 +90,10 @@ final class EditorContentStreamZookeeper public function relayEditorAuthentication(Authentication\TokenInterface $token): void { $requestHandler = $this->bootstrap->getActiveRequestHandler(); - assert($requestHandler instanceof HttpRequestHandlerInterface); + if (!$requestHandler instanceof HttpRequestHandlerInterface) { + // we might be in testing context + return; + } $siteDetectionResult = SiteDetectionResult::fromRequest($requestHandler->getHttpRequest()); $contentRepository = $this->contentRepositoryRegistry->get($siteDetectionResult->contentRepositoryId); diff --git a/Neos.Neos/Tests/Behavior/Features/Bootstrap/BrowserTrait.php b/Neos.Neos/Tests/Behavior/Features/Bootstrap/BrowserTrait.php index 1d28e3260b0..030bde9ea19 100644 --- a/Neos.Neos/Tests/Behavior/Features/Bootstrap/BrowserTrait.php +++ b/Neos.Neos/Tests/Behavior/Features/Bootstrap/BrowserTrait.php @@ -34,14 +34,17 @@ trait BrowserTrait use CRTestSuiteRuntimeVariables; /** - * @return \Neos\Flow\ObjectManagement\ObjectManagerInterface + * @var \Neos\Flow\Http\Client\Browser */ - abstract protected function getObjectManager(); + protected $browser; /** - * @var \Neos\Flow\Http\Client\Browser + * @template T of object + * @param class-string $className + * + * @return T */ - protected $browser; + abstract private function getObject(string $className): object; /** * @BeforeScenario @@ -50,11 +53,11 @@ public function setupBrowserForEveryScenario() { // we reset the security context at the beginning of every scenario; such that we start with a clean session at // every scenario and SHARE the session throughout the scenario! - $this->getObjectManager()->get(\Neos\Flow\Security\Context::class)->clearContext(); + $this->getObject(\Neos\Flow\Security\Context::class)->clearContext(); $this->browser = new \Neos\Flow\Http\Client\Browser(); $this->browser->setRequestEngine(new \Neos\Neos\Testing\CustomizedInternalRequestEngine()); - $bootstrap = $this->getObjectManager()->get(\Neos\Flow\Core\Bootstrap::class); + $bootstrap = $this->getObject(\Neos\Flow\Core\Bootstrap::class); $requestHandler = new \Neos\Flow\Tests\FunctionalTestRequestHandler($bootstrap); $serverRequestFactory = new ServerRequestFactory(new UriFactory()); @@ -229,7 +232,7 @@ protected function replacePlaceholders($nodeAddressString) */ public function iSendTheFollowingChanges(TableNode $changeDefinition) { - $this->getObjectManager()->get(\Neos\Neos\Ui\Domain\Model\FeedbackCollection::class)->reset(); + $this->getObject(\Neos\Neos\Ui\Domain\Model\FeedbackCollection::class)->reset(); $changes = []; foreach ($changeDefinition->getHash() as $singleChange) { @@ -244,7 +247,7 @@ public function iSendTheFollowingChanges(TableNode $changeDefinition) } $server = [ - 'HTTP_X_FLOW_CSRFTOKEN' => $this->getObjectManager()->get(\Neos\Flow\Security\Context::class)->getCsrfProtectionToken(), + 'HTTP_X_FLOW_CSRFTOKEN' => $this->getObject(\Neos\Flow\Security\Context::class)->getCsrfProtectionToken(), ]; $this->currentResponse = $this->browser->request('http://localhost/neos/ui-services/change', 'POST', ['changes' => $changes], [], $server); $this->currentResponseContents = $this->currentResponse->getBody()->getContents(); @@ -257,7 +260,7 @@ public function iSendTheFollowingChanges(TableNode $changeDefinition) */ public function iPublishTheFollowingNodes(string $targetWorkspaceName, TableNode $nodesToPublish) { - $this->getObjectManager()->get(\Neos\Neos\Ui\Domain\Model\FeedbackCollection::class)->reset(); + $this->getObject(\Neos\Neos\Ui\Domain\Model\FeedbackCollection::class)->reset(); $nodeContextPaths = []; foreach ($nodesToPublish->getHash() as $singleChange) { @@ -265,7 +268,7 @@ public function iPublishTheFollowingNodes(string $targetWorkspaceName, TableNode } $server = [ - 'HTTP_X_FLOW_CSRFTOKEN' => $this->getObjectManager()->get(\Neos\Flow\Security\Context::class)->getCsrfProtectionToken(), + 'HTTP_X_FLOW_CSRFTOKEN' => $this->getObject(\Neos\Flow\Security\Context::class)->getCsrfProtectionToken(), ]; $payload = [ 'nodeContextPaths' => $nodeContextPaths, diff --git a/Neos.Neos/Tests/Behavior/Features/Bootstrap/FeatureContext.php b/Neos.Neos/Tests/Behavior/Features/Bootstrap/FeatureContext.php index 733c0ee5373..9d7ff69b989 100644 --- a/Neos.Neos/Tests/Behavior/Features/Bootstrap/FeatureContext.php +++ b/Neos.Neos/Tests/Behavior/Features/Bootstrap/FeatureContext.php @@ -12,7 +12,8 @@ use Behat\Behat\Context\Context as BehatContext; use Behat\Behat\Hook\Scope\BeforeScenarioScope; -use Neos\Behat\Tests\Behat\FlowContextTrait; +use Neos\Behat\FlowBootstrapTrait; +use Neos\Behat\FlowEntitiesTrait; use Neos\ContentRepository\BehavioralTests\TestSuite\Behavior\CRBehavioralTestsSubjectProvider; use Neos\ContentRepository\BehavioralTests\TestSuite\Behavior\GherkinPyStringNodeBasedNodeTypeManagerFactory; use Neos\ContentRepository\BehavioralTests\TestSuite\Behavior\GherkinTableNodeBasedContentDimensionSourceFactory; @@ -24,13 +25,11 @@ use Neos\ContentRepository\TestSuite\Behavior\Features\Bootstrap\MigrationsTrait; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Flow\Utility\Environment; -use Neos\Utility\Files; - -require_once(__DIR__ . '/../../../../../../Application/Neos.Behat/Tests/Behat/FlowContextTrait.php'); class FeatureContext implements BehatContext { - use FlowContextTrait; + use FlowBootstrapTrait; + use FlowEntitiesTrait; use BrowserTrait; use CRTestSuiteTrait; @@ -44,12 +43,9 @@ class FeatureContext implements BehatContext public function __construct() { - if (self::$bootstrap === null) { - self::$bootstrap = $this->initializeFlow(); - } - $this->objectManager = self::$bootstrap->getObjectManager(); - $this->environment = $this->objectManager->get(Environment::class); - $this->contentRepositoryRegistry = $this->objectManager->get(ContentRepositoryRegistry::class); + self::bootstrapFlow(); + $this->environment = $this->getObject(Environment::class); + $this->contentRepositoryRegistry = $this->getObject(ContentRepositoryRegistry::class); $this->setupCRTestSuiteTrait(true); } @@ -71,13 +67,13 @@ public function resetPersistenceManagerAndFeedbackCollection() // FIXME: we have some strange race condition between the scenarios; my theory is that // somehow projectors still run in the background when we start from scratch... sleep(2); - $this->getObjectManager()->get(\Neos\Flow\Persistence\PersistenceManagerInterface::class)->clearState(); + $this->getObject(\Neos\Flow\Persistence\PersistenceManagerInterface::class)->clearState(); // FIXME: FeedbackCollection is a really ugly, hacky SINGLETON; so it needs to be RESET! - $this->getObjectManager()->get(\Neos\Neos\Ui\Domain\Model\FeedbackCollection::class)->reset(); + $this->getObject(\Neos\Neos\Ui\Domain\Model\FeedbackCollection::class)->reset(); // The UserService has a runtime cache - which we need to reset as well as our users get new IDs. // Did I already mention I LOVE in memory caches? ;-) ;-) ;-) - $userService = $this->getObjectManager()->get(\Neos\Neos\Domain\Service\UserService::class); + $userService = $this->getObject(\Neos\Neos\Domain\Service\UserService::class); \Neos\Utility\ObjectAccess::setProperty($userService, 'runtimeUserCache', [], true); } diff --git a/Neos.Neos/Tests/Behavior/Features/Bootstrap/RoutingTrait.php b/Neos.Neos/Tests/Behavior/Features/Bootstrap/RoutingTrait.php index ede2f285b75..ed45891c0b7 100644 --- a/Neos.Neos/Tests/Behavior/Features/Bootstrap/RoutingTrait.php +++ b/Neos.Neos/Tests/Behavior/Features/Bootstrap/RoutingTrait.php @@ -57,7 +57,7 @@ use Symfony\Component\Yaml\Yaml; /** - * Routing related Behat steps. This trait is pure (no side effects). + * Routing related Behat steps. This trait is impure and resets the SiteRepository * * Requires the {@see \Neos\Flow\Core\Bootstrap::getActiveRequestHandler()} to be a {@see FunctionalTestRequestHandler}. * For this the {@see BrowserTrait} can be used. @@ -74,9 +74,12 @@ trait RoutingTrait private $requestUrl; /** - * @return ObjectManagerInterface + * @template T of object + * @param class-string $className + * + * @return T */ - abstract protected function getObjectManager(); + abstract private function getObject(string $className): object; /** * @Given A site exists for node name :nodeName @@ -84,10 +87,8 @@ abstract protected function getObjectManager(); */ public function theSiteExists(string $nodeName, string $domain = null): void { - /** @var SiteRepository $siteRepository */ - $siteRepository = $this->getObjectManager()->get(SiteRepository::class); - /** @var PersistenceManagerInterface $persistenceManager */ - $persistenceManager = $this->getObjectManager()->get(PersistenceManagerInterface::class); + $siteRepository = $this->getObject(SiteRepository::class); + $persistenceManager = $this->getObject(PersistenceManagerInterface::class); $site = new Site($nodeName); $site->setSiteResourcesPackageKey('Neos.Neos'); @@ -102,7 +103,7 @@ public function theSiteExists(string $nodeName, string $domain = null): void $domainModel->setScheme($domainUri->getScheme()); $domainModel->setSite($site); /** @var DomainRepository $domainRepository */ - $domainRepository = $this->getObjectManager()->get(DomainRepository::class); + $domainRepository = $this->getObject(DomainRepository::class); $domainRepository->add($domainModel); } @@ -117,7 +118,7 @@ public function theSiteExists(string $nodeName, string $domain = null): void */ public function theSiteConfigurationIs(\Behat\Gherkin\Node\PyStringNode $configYaml): void { - $entityManager = $this->getObjectManager()->get(EntityManagerInterface::class); + $entityManager = $this->getObject(EntityManagerInterface::class); // clean up old PostLoad Hook if ($this->routingTraitSiteConfigurationPostLoadHook !== null) { $entityManager->getEventManager()->removeEventListener('postLoad', $this->routingTraitSiteConfigurationPostLoadHook); @@ -148,9 +149,9 @@ public function postLoad(LifecycleEventArgs $lifecycleEventArgs) public function anAssetExists(string $assetIdentifier, string $fileName, string $content): void { /** @var ResourceManager $resourceManager */ - $resourceManager = $this->getObjectManager()->get(ResourceManager::class); + $resourceManager = $this->getObject(ResourceManager::class); /** @var AssetRepository $assetRepository */ - $assetRepository = $this->getObjectManager()->get(AssetRepository::class); + $assetRepository = $this->getObject(AssetRepository::class); $resource = $resourceManager->importResourceFromContent($content, $fileName); $asset = new Asset($resource); @@ -158,7 +159,7 @@ public function anAssetExists(string $assetIdentifier, string $fileName, string $assetRepository->add($asset); /** @var PersistenceManagerInterface $persistenceManager */ - $persistenceManager = $this->getObjectManager()->get(PersistenceManagerInterface::class); + $persistenceManager = $this->getObject(PersistenceManagerInterface::class); $persistenceManager->persistAll(); $persistenceManager->clearState(); } @@ -236,8 +237,8 @@ public function theUrlShouldMatchTheNodeInContentStreamAndDimension(string $url, private function match(UriInterface $uri): ?NodeAddress { - $router = $this->getObjectManager()->get(RouterInterface::class); - $serverRequestFactory = $this->getObjectManager()->get(ServerRequestFactoryInterface::class); + $router = $this->getObject(RouterInterface::class); + $serverRequestFactory = $this->getObject(ServerRequestFactoryInterface::class); $httpRequest = $serverRequestFactory->createServerRequest('GET', $uri); $httpRequest = $this->addRoutingParameters($httpRequest); @@ -288,7 +289,7 @@ public function theNodeShouldNotResolve(string $nodeAggregateId, string $content public function tableContainsExactly(TableNode $expectedRows): void { /** @var Connection $dbal */ - $dbal = $this->getObjectManager()->get(EntityManagerInterface::class)->getConnection(); + $dbal = $this->getObject(EntityManagerInterface::class)->getConnection(); $columns = implode(', ', array_keys($expectedRows->getHash()[0])); $tablePrefix = DocumentUriPathProjectionFactory::projectionTableNamePrefix( $this->currentContentRepository->id @@ -315,7 +316,7 @@ private function resolveUrl(string $nodeAggregateId, string $contentStreamId, st : NodeAggregateId::fromString($nodeAggregateId), WorkspaceName::forLive() ); - $httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', $this->requestUrl); + $httpRequest = $this->getObject(ServerRequestFactoryInterface::class)->createServerRequest('GET', $this->requestUrl); $httpRequest = $this->addRoutingParameters($httpRequest); $actionRequest = ActionRequest::fromHttpRequest($httpRequest); return NodeUriBuilder::fromRequest($actionRequest)->uriFor($nodeAddress); @@ -339,7 +340,7 @@ public function iInvokeTheDimensionResolverWithOptions(PyStringNode $rawSiteConf $rawSiteConfiguration = Yaml::parse($rawSiteConfigurationYaml->getRaw()) ?? []; $siteConfiguration = SiteConfiguration::fromArray($rawSiteConfiguration); - $dimensionResolverFactory = $this->getObjectManager()->get($siteConfiguration->contentDimensionResolverFactoryClassName); + $dimensionResolverFactory = $this->getObject($siteConfiguration->contentDimensionResolverFactoryClassName); assert($dimensionResolverFactory instanceof DimensionResolverFactoryInterface); $dimensionResolver = $dimensionResolverFactory->create($siteConfiguration->contentRepositoryId, $siteConfiguration); diff --git a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Basic.feature b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Basic.feature index 7a0099230e5..da5635f69db 100644 --- a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Basic.feature +++ b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Basic.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities @contentrepository Feature: Basic routing functionality (match & resolve document nodes in one dimension) Background: diff --git a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Dimensions.feature b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Dimensions.feature index 8983d4561d9..c6a9da1b7bf 100644 --- a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Dimensions.feature +++ b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Dimensions.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities @contentrepository Feature: Routing functionality with multiple content dimensions Background: diff --git a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/DisableNodes.feature b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/DisableNodes.feature index bd6b2db93ed..8912929e8f3 100644 --- a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/DisableNodes.feature +++ b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/DisableNodes.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities @contentrepository Feature: Routing behavior of removed, disabled and re-enabled nodes Background: diff --git a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Lowlevel_ProjectionTests.feature b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Lowlevel_ProjectionTests.feature index c1d7464cf09..2cdc69e6bcb 100644 --- a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Lowlevel_ProjectionTests.feature +++ b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Lowlevel_ProjectionTests.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities @contentrepository Feature: Low level tests covering the inner behavior of the routing projection Background: diff --git a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/MultiSiteLinking.feature b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/MultiSiteLinking.feature index d15849c36a1..33b0b36b404 100644 --- a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/MultiSiteLinking.feature +++ b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/MultiSiteLinking.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities @contentrepository Feature: Linking between multiple websites Background: diff --git a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/RouteCache.feature b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/RouteCache.feature index 0831200f2fd..4a5df7fc03d 100644 --- a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/RouteCache.feature +++ b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/RouteCache.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities @contentrepository Feature: Route cache invalidation Background: diff --git a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Shortcuts.feature b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Shortcuts.feature index 4f4b7491880..3bba3d61557 100644 --- a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Shortcuts.feature +++ b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/Shortcuts.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities @contentrepository Feature: Routing behavior of shortcut nodes Background: diff --git a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/TetheredSiteChildDocuments.feature b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/TetheredSiteChildDocuments.feature index 1ddfba54ec5..5b644025b96 100644 --- a/Neos.Neos/Tests/Behavior/Features/FrontendRouting/TetheredSiteChildDocuments.feature +++ b/Neos.Neos/Tests/Behavior/Features/FrontendRouting/TetheredSiteChildDocuments.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities @contentrepository Feature: Tests for site node child documents. These are special in that they have the first non-dimension uri path segment. Background: diff --git a/composer.json b/composer.json index 7348c34a7bb..3c21e77ea29 100644 --- a/composer.json +++ b/composer.json @@ -111,7 +111,8 @@ "../../bin/behat -f progress -c Neos.ContentRepository.BehavioralTests/Tests/Behavior/behat.yml.dist", "../../bin/behat -f progress -c Neos.ContentGraph.DoctrineDbalAdapter/Tests/Behavior/behat.yml.dist", "../../flow doctrine:migrate --quiet; ../../flow cr:setup", - "../../bin/behat -f progress -c Neos.Neos/Tests/Behavior/behat.yml" + "../../bin/behat -f progress -c Neos.Neos/Tests/Behavior/behat.yml", + "../../bin/behat -f progress -c Neos.ContentRepository.LegacyNodeMigration/Tests/Behavior/behat.yml.dist" ], "test:behavioral:stop-on-failure": [ "../../bin/behat -vvv --stop-on-failure -f progress -c Neos.ContentRepository.BehavioralTests/Tests/Behavior/behat.yml.dist",