From 7816b2f50ad4038dad35da97b542d81f0c4b4528 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:15:48 +0100 Subject: [PATCH 1/9] TASK: Adjust to neos/behat adjustments --- .../Features/Bootstrap/FeatureContext.php | 48 +++++-------------- .../Bootstrap/RedirectOperationTrait.php | 20 +++++--- .../Features/MultipleDimensions.feature | 2 +- Tests/Behavior/Features/OneDimension.feature | 2 +- .../Features/WithoutDimensions.feature | 2 +- 5 files changed, 30 insertions(+), 44 deletions(-) diff --git a/Tests/Behavior/Features/Bootstrap/FeatureContext.php b/Tests/Behavior/Features/Bootstrap/FeatureContext.php index c28e3dc..e8ede00 100644 --- a/Tests/Behavior/Features/Bootstrap/FeatureContext.php +++ b/Tests/Behavior/Features/Bootstrap/FeatureContext.php @@ -1,58 +1,36 @@ initializeFlow(); - } - $this->objectManager = self::$bootstrap->getObjectManager(); - $this->contentRepositoryRegistry = $this->objectManager->get(ContentRepositoryRegistry::class); - + self::bootstrapFlow(); + $this->contentRepositoryRegistry = $this->getObject(ContentRepositoryRegistry::class); $this->setupCRTestSuiteTrait(); } diff --git a/Tests/Behavior/Features/Bootstrap/RedirectOperationTrait.php b/Tests/Behavior/Features/Bootstrap/RedirectOperationTrait.php index cc6c820..77aaa58 100755 --- a/Tests/Behavior/Features/Bootstrap/RedirectOperationTrait.php +++ b/Tests/Behavior/Features/Bootstrap/RedirectOperationTrait.php @@ -17,6 +17,14 @@ trait RedirectOperationTrait { + /** + * @template T of object + * @param class-string $className + * + * @return T + */ + abstract private function getObject(string $className): object; + /** * @Given /^I have the following redirects:$/ * @When /^I create the following redirects:$/ @@ -24,8 +32,8 @@ trait RedirectOperationTrait public function iHaveTheFollowingRedirects($table): void { $rows = $table->getHash(); - $nodeRedirectStorage = $this->objectManager->get(RedirectStorage::class); - $redirectRepository = $this->objectManager->get(RedirectRepository::class); + $nodeRedirectStorage = $this->getObject(RedirectStorage::class); + $redirectRepository = $this->getObject(RedirectRepository::class); foreach ($rows as $row) { $nodeRedirectStorage->addRedirect( @@ -42,7 +50,7 @@ public function iHaveTheFollowingRedirects($table): void */ public function iShouldHaveARedirectWithSourceUriAndTargetUri($sourceUri, $targetUri): void { - $nodeRedirectStorage = $this->objectManager->get(RedirectStorage::class); + $nodeRedirectStorage = $this->getObject(RedirectStorage::class); $redirect = $nodeRedirectStorage->getOneBySourceUriPathAndHost($sourceUri); @@ -62,7 +70,7 @@ public function iShouldHaveARedirectWithSourceUriAndTargetUri($sourceUri, $targe */ public function iShouldHaveARedirectWithSourceUriAndStatus($sourceUri, $statusCode): void { - $nodeRedirectStorage = $this->objectManager->get(RedirectStorage::class); + $nodeRedirectStorage = $this->getObject(RedirectStorage::class); $redirect = $nodeRedirectStorage->getOneBySourceUriPathAndHost($sourceUri); @@ -82,7 +90,7 @@ public function iShouldHaveARedirectWithSourceUriAndStatus($sourceUri, $statusCo */ public function iShouldHaveNoRedirectWithSourceUriAndTargetUri($sourceUri, $targetUri): void { - $nodeRedirectStorage = $this->objectManager->get(RedirectStorage::class); + $nodeRedirectStorage = $this->getObject(RedirectStorage::class); $redirect = $nodeRedirectStorage->getOneBySourceUriPathAndHost($sourceUri); if ($redirect !== null) { @@ -101,7 +109,7 @@ public function iShouldHaveNoRedirectWithSourceUriAndTargetUri($sourceUri, $targ */ public function iShouldHaveNoRedirectWithSourceUri($sourceUri): void { - $nodeRedirectStorage = $this->objectManager->get(RedirectStorage::class); + $nodeRedirectStorage = $this->getObject(RedirectStorage::class); $redirect = $nodeRedirectStorage->getOneBySourceUriPathAndHost($sourceUri); diff --git a/Tests/Behavior/Features/MultipleDimensions.feature b/Tests/Behavior/Features/MultipleDimensions.feature index 8bec5f0..dbbd1ee 100644 --- a/Tests/Behavior/Features/MultipleDimensions.feature +++ b/Tests/Behavior/Features/MultipleDimensions.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities Feature: Basic redirect handling with document nodes in multiple dimensions Background: diff --git a/Tests/Behavior/Features/OneDimension.feature b/Tests/Behavior/Features/OneDimension.feature index 2c420d0..2e1b36e 100644 --- a/Tests/Behavior/Features/OneDimension.feature +++ b/Tests/Behavior/Features/OneDimension.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities Feature: Basic redirect handling with document nodes in one dimension Background: diff --git a/Tests/Behavior/Features/WithoutDimensions.feature b/Tests/Behavior/Features/WithoutDimensions.feature index bfeec77..db81705 100755 --- a/Tests/Behavior/Features/WithoutDimensions.feature +++ b/Tests/Behavior/Features/WithoutDimensions.feature @@ -1,4 +1,4 @@ -@fixtures @contentrepository +@flowEntities Feature: Basic redirect handling with document nodes without dimensions Background: From c0abb68c5394ea3ae266c4e7b3de848651cda728 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:43:41 +0200 Subject: [PATCH 2/9] TASK: Adjust to remove manual blocking in tests --- .../Features/MultipleDimensions.feature | 18 ----------- Tests/Behavior/Features/OneDimension.feature | 32 ++++--------------- .../Features/WithoutDimensions.feature | 27 ++++------------ 3 files changed, 14 insertions(+), 63 deletions(-) diff --git a/Tests/Behavior/Features/MultipleDimensions.feature b/Tests/Behavior/Features/MultipleDimensions.feature index dbbd1ee..4b0a03b 100644 --- a/Tests/Behavior/Features/MultipleDimensions.feature +++ b/Tests/Behavior/Features/MultipleDimensions.feature @@ -49,7 +49,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "site-root" | | nodeTypeName | "Neos.Neos:Sites" | | contentStreamId | "cs-identifier" | - And the graph projection is fully up to date # site-root # behat @@ -99,7 +98,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions DE: DE CH: CH """ - And The documenturipath projection is up to date And the command CreateNodeVariant is executed with payload: | Key | Value | | nodeAggregateId | "behat" | @@ -145,7 +143,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | dimensionSpacePoint | {"language": "en", "market": "DE"} | | newParentNodeAggregateId | "company" | | newSucceedingSiblingNodeAggregateId | null | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "DE/imprint.html" and targetUri "DE/company/imprint.html" Then I should have a redirect with sourceUri "CH/imprint.html" and targetUri "CH/company/imprint.html" Then I should have a redirect with sourceUri "en_DE/imprint.html" and targetUri "en_DE/company/imprint.html" @@ -162,7 +159,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | dimensionSpacePoint | {"language": "en", "market": "DE"} | | newParentNodeAggregateId | "behat" | | newSucceedingSiblingNodeAggregateId | null | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "DE/company/service.html" and targetUri "DE/service.html" And I should have a redirect with sourceUri "CH/company/service.html" and targetUri "CH/service.html" @@ -179,7 +175,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en", "market": "CH"} | | propertyValues | {"uriPathSegment": "evil-company"} | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "en_CH/company.html" and targetUri "en_CH/evil-company.html" And I should have a redirect with sourceUri "en_CH/company/service.html" and targetUri "en_CH/evil-company/service.html" @@ -204,7 +199,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en", "market": "CH"} | | propertyValues | {"uriPathSegment": "more-evil-corp"} | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "en_CH/company.html" and targetUri "en_CH/more-evil-corp.html" And I should have a redirect with sourceUri "en_CH/company/service.html" and targetUri "en_CH/more-evil-corp/service.html" @@ -228,7 +222,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en", "market": "CH"} | | propertyValues | {"uriPathSegment": "my-company"} | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "en_CH/company.html" and targetUri "en_CH/my-company.html" And I should have a redirect with sourceUri "en_CH/company/service.html" and targetUri "en_CH/my-company/service.html" And I should have a redirect with sourceUri "en_CH/company/about.html" and targetUri "en_CH/my-company/about.html" @@ -243,7 +236,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "buy" | | originDimensionSpacePoint | {"language": "en", "market": "DE"} | | propertyValues | {"title": "my-buy"} | - And The documenturipath projection is up to date Then I should have no redirect with sourceUri "en_DE/buy.html" @fixtures @@ -254,7 +246,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "restricted-by-nodetype" | | originDimensionSpacePoint | {"language": "en", "market": "DE"} | | propertyValues | {"uriPathSegment": "restricted-by-nodetype-new"} | - And The documenturipath projection is up to date Then I should have no redirect with sourceUri "en/restricted.html" # @fixtures @@ -265,14 +256,12 @@ Feature: Basic redirect handling with document nodes in multiple dimensions # | nodeAggregateId | "mail" | # | coveredDimensionSpacePoint | {"language": "en", "market": "DE"} | # | nodeVariantSelectionStrategy | "allVariants" | -# And the graph projection is fully up to date # When the command SetNodeProperties is executed with payload: # | Key | Value | # | contentStreamId | "cs-identifier" | # | nodeAggregateId | "mail" | # | originDimensionSpacePoint | {"language": "en", "market": "DE"} | # | propertyValues | {"uriPathSegment": "not-mail"} | -# And The documenturipath projection is up to date # Then I should have a redirect with sourceUri "en_DE/mail.html" and targetUri "en_DE/not-mail.html" # Then I should have a redirect with sourceUri "en_CH/mail.html" and targetUri "en_CH/not-mail.html" @@ -284,7 +273,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "de", "market": "DE"} | | propertyValues | {"uriPathSegment": "evil-company"} | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "DE/company.html" and targetUri "DE/evil-company.html" And I should have a redirect with sourceUri "DE/company/service.html" and targetUri "DE/evil-company/service.html" @@ -308,8 +296,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "company" | | coveredDimensionSpacePoint | {"language": "en", "market": "CH"} | | nodeVariantSelectionStrategy | "allSpecializations" | - And the graph projection is fully up to date - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "en_CH/company.html" and statusCode "410" And I should have a redirect with sourceUri "en_CH/company.html" and targetUri "" @@ -339,8 +325,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "company" | | coveredDimensionSpacePoint | {"language": "de", "market": "CH"} | | nodeVariantSelectionStrategy | "allVariants" | - And the graph projection is fully up to date - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "DE/company.html" and statusCode "410" And I should have a redirect with sourceUri "DE/company.html" and targetUri "" @@ -385,8 +369,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | nodeAggregateId | "company" | | nodeVariantSelectionStrategy | "allSpecializations" | | coveredDimensionSpacePoint | {"language": "de", "market" : "DE"} | - And the graph projection is fully up to date - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "DE/company.html" and statusCode "410" And I should have a redirect with sourceUri "DE/company.html" and targetUri "" diff --git a/Tests/Behavior/Features/OneDimension.feature b/Tests/Behavior/Features/OneDimension.feature index 2e1b36e..7acff91 100644 --- a/Tests/Behavior/Features/OneDimension.feature +++ b/Tests/Behavior/Features/OneDimension.feature @@ -48,7 +48,6 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "site-root" | | nodeTypeName | "Neos.Neos:Sites" | | contentStreamId | "cs-identifier" | - And the graph projection is fully up to date # site-root # behat @@ -113,7 +112,6 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "imprint" | | sourceOrigin | {"language":"en"} | | targetOrigin | {"language":"de"} | - And The documenturipath projection is up to date @fixtures Scenario: Move a node down into different node and a redirect will be created @@ -124,8 +122,7 @@ Feature: Basic redirect handling with document nodes in one dimension | dimensionSpacePoint | {"language": "en"} | | newParentNodeAggregateId | "company" | | newSucceedingSiblingNodeAggregateId | null | - And The documenturipath projection is up to date - Then I should have a redirect with sourceUri "en/imprint.html" and targetUri "en/company/imprint.html" + Then I should have a redirect with sourceUri "en/imprint.html" and targetUri "en/company/imprint.html" And I should have a redirect with sourceUri "imprint.html" and targetUri "company/imprint.html" And I should have a redirect with sourceUri "ch/imprint.html" and targetUri "ch/company/imprint.html" @@ -138,8 +135,7 @@ Feature: Basic redirect handling with document nodes in one dimension | dimensionSpacePoint | {"language": "en"} | | newParentNodeAggregateId | "behat" | | newSucceedingSiblingNodeAggregateId | null | - And The documenturipath projection is up to date - Then I should have a redirect with sourceUri "en/company/service.html" and targetUri "en/service.html" + Then I should have a redirect with sourceUri "en/company/service.html" and targetUri "en/service.html" And I should have a redirect with sourceUri "company/service.html" and targetUri "service.html" And I should have a redirect with sourceUri "ch/company/service.html" and targetUri "ch/service.html" @@ -151,7 +147,6 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"uriPathSegment": "evil-corp"} | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "en/company.html" and targetUri "en/evil-corp.html" And I should have a redirect with sourceUri "en/company/about.html" and targetUri "en/evil-corp/about.html" @@ -180,7 +175,6 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"uriPathSegment": "more-evil-corp"} | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "en/company.html" and targetUri "en/more-evil-corp.html" And I should have a redirect with sourceUri "en/company/service.html" and targetUri "en/more-evil-corp/service.html" @@ -199,8 +193,7 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"uriPathSegment": "my-company"} | - And The documenturipath projection is up to date - Then I should have a redirect with sourceUri "en/company.html" and targetUri "en/my-company.html" + Then I should have a redirect with sourceUri "en/company.html" and targetUri "en/my-company.html" And I should have no redirect with sourceUri "en/company.html" and targetUri "en/company-old.html" And I should have a redirect with sourceUri "en/company/service.html" and targetUri "en/my-company/service.html" @@ -212,8 +205,7 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "buy" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"title": "my-buy"} | - And The documenturipath projection is up to date - Then I should have no redirect with sourceUri "en/buy.html" + Then I should have no redirect with sourceUri "en/buy.html" @fixtures Scenario: No redirect should be created for an restricted node by nodetype @@ -223,8 +215,7 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "restricted-by-nodetype" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"uriPathSegment": "restricted-by-nodetype-new"} | - And The documenturipath projection is up to date - Then I should have no redirect with sourceUri "en/restricted.html" + Then I should have no redirect with sourceUri "en/restricted.html" # @fixtures # Scenario: Redirects should be created for a hidden node @@ -234,15 +225,13 @@ Feature: Basic redirect handling with document nodes in one dimension # | nodeAggregateId | "mail" | # | coveredDimensionSpacePoint | {"language": "en"} | # | nodeVariantSelectionStrategy | "allVariants" | -# And the graph projection is fully up to date -# When the command SetNodeProperties is executed with payload: +## When the command SetNodeProperties is executed with payload: # | Key | Value | # | contentStreamId | "cs-identifier" | # | nodeAggregateId | "mail" | # | originDimensionSpacePoint | {"language": "en"} | # | propertyValues | {"uriPathSegment": "not-mail"} | -# And The documenturipath projection is up to date -# Then I should have a redirect with sourceUri "en/mail.html" and targetUri "en/not-mail.html" +# # Then I should have a redirect with sourceUri "en/mail.html" and targetUri "en/not-mail.html" @fixtures Scenario: Change the the `uriPathSegment` and a redirect will be created also for fallback @@ -253,7 +242,6 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "de"} | | propertyValues | {"uriPathSegment": "unternehmen"} | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "company.html" and targetUri "unternehmen.html" And I should have a redirect with sourceUri "company/service.html" and targetUri "unternehmen/service.html" @@ -269,8 +257,6 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "company" | | coveredDimensionSpacePoint | {"language": "en"} | | nodeVariantSelectionStrategy | "allSpecializations" | - And the graph projection is fully up to date - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "en/company.html" and statusCode "410" And I should have a redirect with sourceUri "en/company.html" and targetUri "" @@ -290,8 +276,6 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "company" | | coveredDimensionSpacePoint | {"language": "de"} | | nodeVariantSelectionStrategy | "allVariants" | - And the graph projection is fully up to date - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "en/company.html" and statusCode "410" And I should have a redirect with sourceUri "en/company.html" and targetUri "" @@ -316,8 +300,6 @@ Feature: Basic redirect handling with document nodes in one dimension | nodeAggregateId | "company" | | nodeVariantSelectionStrategy | "allSpecializations" | | coveredDimensionSpacePoint | {"language": "de"} | - And the graph projection is fully up to date - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "company.html" and statusCode "410" And I should have a redirect with sourceUri "company.html" and targetUri "" diff --git a/Tests/Behavior/Features/WithoutDimensions.feature b/Tests/Behavior/Features/WithoutDimensions.feature index db81705..ce75db5 100755 --- a/Tests/Behavior/Features/WithoutDimensions.feature +++ b/Tests/Behavior/Features/WithoutDimensions.feature @@ -48,7 +48,6 @@ Feature: Basic redirect handling with document nodes without dimensions | contentStreamId | "cs-identifier" | | nodeAggregateId | "site-root" | | nodeTypeName | "Neos.Neos:Sites" | - And the graph projection is fully up to date # site-root # behat @@ -82,7 +81,6 @@ Feature: Basic redirect handling with document nodes without dimensions resolver: factoryClassName: Neos\Neos\FrontendRouting\DimensionResolution\Resolver\NoopResolverFactory """ - And The documenturipath projection is up to date @fixtures Scenario: Move a node down into different node and a redirect will be created @@ -93,8 +91,7 @@ Feature: Basic redirect handling with document nodes without dimensions | dimensionSpacePoint | {} | | newParentNodeAggregateId | "company" | | newSucceedingSiblingNodeAggregateId | null | - And The documenturipath projection is up to date - Then I should have a redirect with sourceUri "imprint.html" and targetUri "company/imprint.html" + Then I should have a redirect with sourceUri "imprint.html" and targetUri "company/imprint.html" Scenario: Move a node up into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: @@ -104,8 +101,7 @@ Feature: Basic redirect handling with document nodes without dimensions | dimensionSpacePoint | {} | | newParentNodeAggregateId | "behat" | | newSucceedingSiblingNodeAggregateId | null | - And The documenturipath projection is up to date - Then I should have a redirect with sourceUri "company/service.html" and targetUri "service.html" + Then I should have a redirect with sourceUri "company/service.html" and targetUri "service.html" @fixtures Scenario: Change the the `uriPathSegment` and a redirect will be created @@ -115,8 +111,7 @@ Feature: Basic redirect handling with document nodes without dimensions | nodeAggregateId | "company" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "evil-corp"} | - And The documenturipath projection is up to date - Then I should have a redirect with sourceUri "company.html" and targetUri "evil-corp.html" + Then I should have a redirect with sourceUri "company.html" and targetUri "evil-corp.html" And I should have a redirect with sourceUri "company/service.html" and targetUri "evil-corp/service.html" @fixtures @@ -133,7 +128,6 @@ Feature: Basic redirect handling with document nodes without dimensions | nodeAggregateId | "company" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "more-evil-corp"} | - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "company.html" and targetUri "more-evil-corp.html" And I should have a redirect with sourceUri "company/service.html" and targetUri "more-evil-corp/service.html" @@ -152,8 +146,7 @@ Feature: Basic redirect handling with document nodes without dimensions | nodeAggregateId | "company" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "my-company"} | - And The documenturipath projection is up to date - Then I should have a redirect with sourceUri "company.html" and targetUri "my-company.html" + Then I should have a redirect with sourceUri "company.html" and targetUri "my-company.html" And I should have no redirect with sourceUri "company.html" and targetUri "company-old.html" And I should have a redirect with sourceUri "company/service.html" and targetUri "my-company/service.html" @@ -165,8 +158,7 @@ Feature: Basic redirect handling with document nodes without dimensions | nodeAggregateId | "buy" | | originDimensionSpacePoint | {} | | propertyValues | {"title": "my-buy"} | - And The documenturipath projection is up to date - Then I should have no redirect with sourceUri "buy.html" + Then I should have no redirect with sourceUri "buy.html" @fixtures Scenario: No redirect should be created for an restricted node by nodetype @@ -176,8 +168,7 @@ Feature: Basic redirect handling with document nodes without dimensions | nodeAggregateId | "restricted-by-nodetype" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "restricted-by-nodetype-new"} | - And The documenturipath projection is up to date - Then I should have no redirect with sourceUri "restricted.html" + Then I should have no redirect with sourceUri "restricted.html" @fixtures Scenario: Redirects should be created for a hidden node @@ -187,15 +178,13 @@ Feature: Basic redirect handling with document nodes without dimensions | nodeAggregateId | "mail" | | coveredDimensionSpacePoint | {} | | nodeVariantSelectionStrategy | "allVariants" | - And the graph projection is fully up to date When the command SetNodeProperties is executed with payload: | Key | Value | | contentStreamId | "cs-identifier" | | nodeAggregateId | "mail" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "not-mail"} | - And The documenturipath projection is up to date - Then I should have a redirect with sourceUri "mail.html" and targetUri "not-mail.html" + Then I should have a redirect with sourceUri "mail.html" and targetUri "not-mail.html" @fixtures Scenario: A removed node should lead to a GONE response with empty target uri @@ -204,8 +193,6 @@ Feature: Basic redirect handling with document nodes without dimensions | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | nodeVariantSelectionStrategy | "allVariants" | - And the graph projection is fully up to date - And The documenturipath projection is up to date Then I should have a redirect with sourceUri "company.html" and statusCode "410" And I should have a redirect with sourceUri "company.html" and targetUri "" From 85459b92c6154703de6f3c4096b11879147ed72e Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:49:55 +0200 Subject: [PATCH 3/9] TASK: Adjust tests to workspace aware commands --- .../Features/MultipleDimensions.feature | 17 +---------------- Tests/Behavior/Features/OneDimension.feature | 17 +---------------- .../Behavior/Features/WithoutDimensions.feature | 14 +------------- 3 files changed, 3 insertions(+), 45 deletions(-) diff --git a/Tests/Behavior/Features/MultipleDimensions.feature b/Tests/Behavior/Features/MultipleDimensions.feature index 4b0a03b..6e2501c 100644 --- a/Tests/Behavior/Features/MultipleDimensions.feature +++ b/Tests/Behavior/Features/MultipleDimensions.feature @@ -44,11 +44,11 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | Key | Value | | workspaceName | "live" | | newContentStreamId | "cs-identifier" | + And I am in workspace "live" and dimension space point {} And the command CreateRootNodeAggregateWithNode is executed with payload: | Key | Value | | nodeAggregateId | "site-root" | | nodeTypeName | "Neos.Neos:Sites" | - | contentStreamId | "cs-identifier" | # site-root # behat @@ -58,7 +58,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions # imprint # buy # mail - And I am in content stream "cs-identifier" and dimension space point {} And the following CreateNodeAggregateWithNode commands are executed: | nodeAggregateId | parentNodeAggregateId | nodeTypeName | initialPropertyValues | originDimensionSpacePoint | nodeName | | behat | site-root | Neos.Neos:Test.Redirect.Page | {"uriPathSegment": "home"} | {"language": "en", "market": "DE"} | node1 | @@ -138,7 +137,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: Move a node down into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "imprint" | | dimensionSpacePoint | {"language": "en", "market": "DE"} | | newParentNodeAggregateId | "company" | @@ -154,7 +152,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: Move a node up into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "service" | | dimensionSpacePoint | {"language": "en", "market": "DE"} | | newParentNodeAggregateId | "behat" | @@ -171,7 +168,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: Change the the `uriPathSegment` and a redirect will be created When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en", "market": "CH"} | | propertyValues | {"uriPathSegment": "evil-company"} | @@ -189,13 +185,11 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: Change the the `uriPathSegment` multiple times and multiple redirects will be created When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en", "market": "CH"} | | propertyValues | {"uriPathSegment": "evil-corp"} | And the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en", "market": "CH"} | | propertyValues | {"uriPathSegment": "more-evil-corp"} | @@ -218,7 +212,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | en_CH/company.html | en_CH/company-old.html | And the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en", "market": "CH"} | | propertyValues | {"uriPathSegment": "my-company"} | @@ -232,7 +225,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: No redirect should be created for an existing node if any non URI related property changes When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "buy" | | originDimensionSpacePoint | {"language": "en", "market": "DE"} | | propertyValues | {"title": "my-buy"} | @@ -242,7 +234,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: No redirect should be created for an restricted node by nodetype When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "restricted-by-nodetype" | | originDimensionSpacePoint | {"language": "en", "market": "DE"} | | propertyValues | {"uriPathSegment": "restricted-by-nodetype-new"} | @@ -252,13 +243,11 @@ Feature: Basic redirect handling with document nodes in multiple dimensions # Scenario: Redirects should be created for a hidden node # When the command DisableNodeAggregate is executed with payload: # | Key | Value | -# | contentStreamId | "cs-identifier" | # | nodeAggregateId | "mail" | # | coveredDimensionSpacePoint | {"language": "en", "market": "DE"} | # | nodeVariantSelectionStrategy | "allVariants" | # When the command SetNodeProperties is executed with payload: # | Key | Value | -# | contentStreamId | "cs-identifier" | # | nodeAggregateId | "mail" | # | originDimensionSpacePoint | {"language": "en", "market": "DE"} | # | propertyValues | {"uriPathSegment": "not-mail"} | @@ -269,7 +258,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: Change the the `uriPathSegment` and a redirect will be created also for fallback When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "de", "market": "DE"} | | propertyValues | {"uriPathSegment": "evil-company"} | @@ -292,7 +280,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: A removed node should lead to a GONE response with empty target uri (allSpecializations) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | coveredDimensionSpacePoint | {"language": "en", "market": "CH"} | | nodeVariantSelectionStrategy | "allSpecializations" | @@ -321,7 +308,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: A removed node should lead to a GONE response with empty target uri (allVariants) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | coveredDimensionSpacePoint | {"language": "de", "market": "CH"} | | nodeVariantSelectionStrategy | "allVariants" | @@ -365,7 +351,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Scenario: A removed node should lead to a GONE response with empty target uri also for fallback (allSpecializations) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | nodeVariantSelectionStrategy | "allSpecializations" | | coveredDimensionSpacePoint | {"language": "de", "market" : "DE"} | diff --git a/Tests/Behavior/Features/OneDimension.feature b/Tests/Behavior/Features/OneDimension.feature index 7acff91..c9ecf8e 100644 --- a/Tests/Behavior/Features/OneDimension.feature +++ b/Tests/Behavior/Features/OneDimension.feature @@ -43,11 +43,11 @@ Feature: Basic redirect handling with document nodes in one dimension | Key | Value | | workspaceName | "live" | | newContentStreamId | "cs-identifier" | + And I am in workspace "live" and dimension space point {} And the command CreateRootNodeAggregateWithNode is executed with payload: | Key | Value | | nodeAggregateId | "site-root" | | nodeTypeName | "Neos.Neos:Sites" | - | contentStreamId | "cs-identifier" | # site-root # behat @@ -57,7 +57,6 @@ Feature: Basic redirect handling with document nodes in one dimension # imprint # buy # mail - And I am in content stream "cs-identifier" and dimension space point {} And the following CreateNodeAggregateWithNode commands are executed: | nodeAggregateId | parentNodeAggregateId | nodeTypeName | initialPropertyValues | originDimensionSpacePoint | nodeName | | behat | site-root | Neos.Neos:Test.Redirect.Page | {"uriPathSegment": "home"} | {"language": "en"} | node1 | @@ -117,7 +116,6 @@ Feature: Basic redirect handling with document nodes in one dimension Scenario: Move a node down into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "imprint" | | dimensionSpacePoint | {"language": "en"} | | newParentNodeAggregateId | "company" | @@ -130,7 +128,6 @@ Feature: Basic redirect handling with document nodes in one dimension Scenario: Move a node up into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "service" | | dimensionSpacePoint | {"language": "en"} | | newParentNodeAggregateId | "behat" | @@ -143,7 +140,6 @@ Feature: Basic redirect handling with document nodes in one dimension Scenario: Change the the `uriPathSegment` and a redirect will be created When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"uriPathSegment": "evil-corp"} | @@ -165,13 +161,11 @@ Feature: Basic redirect handling with document nodes in one dimension Scenario: Change the the `uriPathSegment` multiple times and multiple redirects will be created When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"uriPathSegment": "evil-corp"} | And the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"uriPathSegment": "more-evil-corp"} | @@ -189,7 +183,6 @@ Feature: Basic redirect handling with document nodes in one dimension | company | company-old | And the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"uriPathSegment": "my-company"} | @@ -201,7 +194,6 @@ Feature: Basic redirect handling with document nodes in one dimension Scenario: No redirect should be created for an existing node if any non URI related property changes When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "buy" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"title": "my-buy"} | @@ -211,7 +203,6 @@ Feature: Basic redirect handling with document nodes in one dimension Scenario: No redirect should be created for an restricted node by nodetype When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "restricted-by-nodetype" | | originDimensionSpacePoint | {"language": "en"} | | propertyValues | {"uriPathSegment": "restricted-by-nodetype-new"} | @@ -221,13 +212,11 @@ Feature: Basic redirect handling with document nodes in one dimension # Scenario: Redirects should be created for a hidden node # When the command DisableNodeAggregate is executed with payload: # | Key | Value | -# | contentStreamId | "cs-identifier" | # | nodeAggregateId | "mail" | # | coveredDimensionSpacePoint | {"language": "en"} | # | nodeVariantSelectionStrategy | "allVariants" | ## When the command SetNodeProperties is executed with payload: # | Key | Value | -# | contentStreamId | "cs-identifier" | # | nodeAggregateId | "mail" | # | originDimensionSpacePoint | {"language": "en"} | # | propertyValues | {"uriPathSegment": "not-mail"} | @@ -238,7 +227,6 @@ Feature: Basic redirect handling with document nodes in one dimension And the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {"language": "de"} | | propertyValues | {"uriPathSegment": "unternehmen"} | @@ -253,7 +241,6 @@ Feature: Basic redirect handling with document nodes in one dimension Scenario: A removed node should lead to a GONE response with empty target uri (allSpecializations) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | coveredDimensionSpacePoint | {"language": "en"} | | nodeVariantSelectionStrategy | "allSpecializations" | @@ -272,7 +259,6 @@ Feature: Basic redirect handling with document nodes in one dimension Scenario: A removed node should lead to a GONE response with empty target uri (allVariants) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | coveredDimensionSpacePoint | {"language": "de"} | | nodeVariantSelectionStrategy | "allVariants" | @@ -296,7 +282,6 @@ Feature: Basic redirect handling with document nodes in one dimension Scenario: A removed node should lead to a GONE response with empty target uri also for fallback (allSpecializations) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | nodeVariantSelectionStrategy | "allSpecializations" | | coveredDimensionSpacePoint | {"language": "de"} | diff --git a/Tests/Behavior/Features/WithoutDimensions.feature b/Tests/Behavior/Features/WithoutDimensions.feature index ce75db5..89dfe04 100755 --- a/Tests/Behavior/Features/WithoutDimensions.feature +++ b/Tests/Behavior/Features/WithoutDimensions.feature @@ -43,9 +43,9 @@ Feature: Basic redirect handling with document nodes without dimensions | workspaceTitle | "Live" | | workspaceDescription | "The live workspace" | | newContentStreamId | "cs-identifier" | + And I am in workspace "live" and dimension space point {} And the command CreateRootNodeAggregateWithNode is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "site-root" | | nodeTypeName | "Neos.Neos:Sites" | @@ -57,7 +57,6 @@ Feature: Basic redirect handling with document nodes without dimensions # imprint # buy # mail - And I am in content stream "cs-identifier" and dimension space point {} And the following CreateNodeAggregateWithNode commands are executed: | nodeAggregateId | parentNodeAggregateId | nodeTypeName | initialPropertyValues | nodeName | | behat | site-root | Neos.Neos:Test.Redirect.Page | {"uriPathSegment": "home"} | node1 | @@ -86,7 +85,6 @@ Feature: Basic redirect handling with document nodes without dimensions Scenario: Move a node down into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "imprint" | | dimensionSpacePoint | {} | | newParentNodeAggregateId | "company" | @@ -96,7 +94,6 @@ Feature: Basic redirect handling with document nodes without dimensions Scenario: Move a node up into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "service" | | dimensionSpacePoint | {} | | newParentNodeAggregateId | "behat" | @@ -107,7 +104,6 @@ Feature: Basic redirect handling with document nodes without dimensions Scenario: Change the the `uriPathSegment` and a redirect will be created When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "evil-corp"} | @@ -118,13 +114,11 @@ Feature: Basic redirect handling with document nodes without dimensions Scenario: Change the the `uriPathSegment` multiple times and multiple redirects will be created When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "evil-corp"} | And the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "more-evil-corp"} | @@ -142,7 +136,6 @@ Feature: Basic redirect handling with document nodes without dimensions | company | company-old | And the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "my-company"} | @@ -154,7 +147,6 @@ Feature: Basic redirect handling with document nodes without dimensions Scenario: No redirect should be created for an existing node if any non URI related property changes When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "buy" | | originDimensionSpacePoint | {} | | propertyValues | {"title": "my-buy"} | @@ -164,7 +156,6 @@ Feature: Basic redirect handling with document nodes without dimensions Scenario: No redirect should be created for an restricted node by nodetype When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "restricted-by-nodetype" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "restricted-by-nodetype-new"} | @@ -174,13 +165,11 @@ Feature: Basic redirect handling with document nodes without dimensions Scenario: Redirects should be created for a hidden node When the command DisableNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "mail" | | coveredDimensionSpacePoint | {} | | nodeVariantSelectionStrategy | "allVariants" | When the command SetNodeProperties is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "mail" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "not-mail"} | @@ -190,7 +179,6 @@ Feature: Basic redirect handling with document nodes without dimensions Scenario: A removed node should lead to a GONE response with empty target uri Given the command RemoveNodeAggregate is executed with payload: | Key | Value | - | contentStreamId | "cs-identifier" | | nodeAggregateId | "company" | | nodeVariantSelectionStrategy | "allVariants" | From 6c8ff0b54ca04a815de970274b4f1a441e9d43a4 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:29:44 +0200 Subject: [PATCH 4/9] TASK: Remove obsolete `@fixtures` --- Tests/Behavior/Features/MultipleDimensions.feature | 14 +------------- Tests/Behavior/Features/OneDimension.feature | 14 +------------- Tests/Behavior/Features/WithoutDimensions.feature | 10 +--------- 3 files changed, 3 insertions(+), 35 deletions(-) diff --git a/Tests/Behavior/Features/MultipleDimensions.feature b/Tests/Behavior/Features/MultipleDimensions.feature index 6e2501c..e05f4bb 100644 --- a/Tests/Behavior/Features/MultipleDimensions.feature +++ b/Tests/Behavior/Features/MultipleDimensions.feature @@ -133,7 +133,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | sourceOrigin | {"language":"en", "market": "DE"} | | targetOrigin | {"language":"en", "market": "CH"} | - @fixtures Scenario: Move a node down into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | @@ -148,7 +147,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions Then I should have a redirect with sourceUri "ch_DE/imprint.html" and targetUri "ch_DE/company/imprint.html" Then I should have a redirect with sourceUri "ch_CH/imprint.html" and targetUri "ch_CH/company/imprint.html" - @fixtures Scenario: Move a node up into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | @@ -164,7 +162,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions And I should have a redirect with sourceUri "ch_DE/company/service.html" and targetUri "ch_DE/service.html" And I should have a redirect with sourceUri "ch_CH/company/service.html" and targetUri "ch_CH/service.html" - @fixtures Scenario: Change the the `uriPathSegment` and a redirect will be created When the command SetNodeProperties is executed with payload: | Key | Value | @@ -181,7 +178,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions And I should have no redirect with sourceUri "ch_CH/company.html" And I should have no redirect with sourceUri "ch_DE/company.html" - @fixtures Scenario: Change the the `uriPathSegment` multiple times and multiple redirects will be created When the command SetNodeProperties is executed with payload: | Key | Value | @@ -205,7 +201,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions And I should have no redirect with sourceUri "DE/company.html" And I should have no redirect with sourceUri "en_DE/company.html" - @fixtures Scenario: Retarget an existing redirect when the source URI matches the source URI of the new redirect When I have the following redirects: | sourceuripath | targeturipath | @@ -221,7 +216,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions And I should have no redirect with sourceUri "en_CH/company.html" and targetUri "en_CH/company-old.html" - @fixtures Scenario: No redirect should be created for an existing node if any non URI related property changes When the command SetNodeProperties is executed with payload: | Key | Value | @@ -230,7 +224,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | propertyValues | {"title": "my-buy"} | Then I should have no redirect with sourceUri "en_DE/buy.html" - @fixtures Scenario: No redirect should be created for an restricted node by nodetype When the command SetNodeProperties is executed with payload: | Key | Value | @@ -239,8 +232,7 @@ Feature: Basic redirect handling with document nodes in multiple dimensions | propertyValues | {"uriPathSegment": "restricted-by-nodetype-new"} | Then I should have no redirect with sourceUri "en/restricted.html" -# @fixtures -# Scenario: Redirects should be created for a hidden node +## Scenario: Redirects should be created for a hidden node # When the command DisableNodeAggregate is executed with payload: # | Key | Value | # | nodeAggregateId | "mail" | @@ -254,7 +246,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions # Then I should have a redirect with sourceUri "en_DE/mail.html" and targetUri "en_DE/not-mail.html" # Then I should have a redirect with sourceUri "en_CH/mail.html" and targetUri "en_CH/not-mail.html" - @fixtures Scenario: Change the the `uriPathSegment` and a redirect will be created also for fallback When the command SetNodeProperties is executed with payload: | Key | Value | @@ -276,7 +267,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions And I should have no redirect with sourceUri "en_CH/company.html" And I should have no redirect with sourceUri "en_CH/company/service.html" - @fixtures Scenario: A removed node should lead to a GONE response with empty target uri (allSpecializations) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | @@ -304,7 +294,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions And I should have no redirect with sourceUri "en_DE/company/service.html" And I should have no redirect with sourceUri "en_DE/company/about.html" - @fixtures Scenario: A removed node should lead to a GONE response with empty target uri (allVariants) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | @@ -347,7 +336,6 @@ Feature: Basic redirect handling with document nodes in multiple dimensions And I should have a redirect with sourceUri "en_DE/company/about.html" and targetUri "" - @fixtures Scenario: A removed node should lead to a GONE response with empty target uri also for fallback (allSpecializations) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | diff --git a/Tests/Behavior/Features/OneDimension.feature b/Tests/Behavior/Features/OneDimension.feature index c9ecf8e..e5957f4 100644 --- a/Tests/Behavior/Features/OneDimension.feature +++ b/Tests/Behavior/Features/OneDimension.feature @@ -112,7 +112,6 @@ Feature: Basic redirect handling with document nodes in one dimension | sourceOrigin | {"language":"en"} | | targetOrigin | {"language":"de"} | - @fixtures Scenario: Move a node down into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | @@ -124,7 +123,6 @@ Feature: Basic redirect handling with document nodes in one dimension And I should have a redirect with sourceUri "imprint.html" and targetUri "company/imprint.html" And I should have a redirect with sourceUri "ch/imprint.html" and targetUri "ch/company/imprint.html" - @fixtures Scenario: Move a node up into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | @@ -136,7 +134,6 @@ Feature: Basic redirect handling with document nodes in one dimension And I should have a redirect with sourceUri "company/service.html" and targetUri "service.html" And I should have a redirect with sourceUri "ch/company/service.html" and targetUri "ch/service.html" - @fixtures Scenario: Change the the `uriPathSegment` and a redirect will be created When the command SetNodeProperties is executed with payload: | Key | Value | @@ -157,7 +154,6 @@ Feature: Basic redirect handling with document nodes in one dimension And I should have no redirect with sourceUri "ch/company/service.html" - @fixtures Scenario: Change the the `uriPathSegment` multiple times and multiple redirects will be created When the command SetNodeProperties is executed with payload: | Key | Value | @@ -176,7 +172,6 @@ Feature: Basic redirect handling with document nodes in one dimension And I should have a redirect with sourceUri "en/evil-corp/service.html" and targetUri "en/more-evil-corp/service.html" - @fixtures Scenario: Retarget an existing redirect when the source URI matches the source URI of the new redirect When I have the following redirects: | sourceuripath | targeturipath | @@ -190,7 +185,6 @@ Feature: Basic redirect handling with document nodes in one dimension And I should have no redirect with sourceUri "en/company.html" and targetUri "en/company-old.html" And I should have a redirect with sourceUri "en/company/service.html" and targetUri "en/my-company/service.html" - @fixtures Scenario: No redirect should be created for an existing node if any non URI related property changes When the command SetNodeProperties is executed with payload: | Key | Value | @@ -199,7 +193,6 @@ Feature: Basic redirect handling with document nodes in one dimension | propertyValues | {"title": "my-buy"} | Then I should have no redirect with sourceUri "en/buy.html" - @fixtures Scenario: No redirect should be created for an restricted node by nodetype When the command SetNodeProperties is executed with payload: | Key | Value | @@ -208,8 +201,7 @@ Feature: Basic redirect handling with document nodes in one dimension | propertyValues | {"uriPathSegment": "restricted-by-nodetype-new"} | Then I should have no redirect with sourceUri "en/restricted.html" -# @fixtures -# Scenario: Redirects should be created for a hidden node +## Scenario: Redirects should be created for a hidden node # When the command DisableNodeAggregate is executed with payload: # | Key | Value | # | nodeAggregateId | "mail" | @@ -222,7 +214,6 @@ Feature: Basic redirect handling with document nodes in one dimension # | propertyValues | {"uriPathSegment": "not-mail"} | # # Then I should have a redirect with sourceUri "en/mail.html" and targetUri "en/not-mail.html" - @fixtures Scenario: Change the the `uriPathSegment` and a redirect will be created also for fallback And the command SetNodeProperties is executed with payload: @@ -237,7 +228,6 @@ Feature: Basic redirect handling with document nodes in one dimension And I should have a redirect with sourceUri "ch/company/service.html" and targetUri "ch/unternehmen/service.html" - @fixtures Scenario: A removed node should lead to a GONE response with empty target uri (allSpecializations) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | @@ -255,7 +245,6 @@ Feature: Basic redirect handling with document nodes in one dimension And I should have no redirect with sourceUri "ch/company.html" And I should have no redirect with sourceUri "ch/company/service.html" - @fixtures Scenario: A removed node should lead to a GONE response with empty target uri (allVariants) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | @@ -278,7 +267,6 @@ Feature: Basic redirect handling with document nodes in one dimension And I should have a redirect with sourceUri "ch/company/service.html" and statusCode "410" And I should have a redirect with sourceUri "ch/company/service.html" and targetUri "" - @fixtures Scenario: A removed node should lead to a GONE response with empty target uri also for fallback (allSpecializations) Given the command RemoveNodeAggregate is executed with payload: | Key | Value | diff --git a/Tests/Behavior/Features/WithoutDimensions.feature b/Tests/Behavior/Features/WithoutDimensions.feature index 89dfe04..bfcdfa3 100755 --- a/Tests/Behavior/Features/WithoutDimensions.feature +++ b/Tests/Behavior/Features/WithoutDimensions.feature @@ -81,7 +81,6 @@ Feature: Basic redirect handling with document nodes without dimensions factoryClassName: Neos\Neos\FrontendRouting\DimensionResolution\Resolver\NoopResolverFactory """ - @fixtures Scenario: Move a node down into different node and a redirect will be created When the command MoveNodeAggregate is executed with payload: | Key | Value | @@ -100,17 +99,15 @@ Feature: Basic redirect handling with document nodes without dimensions | newSucceedingSiblingNodeAggregateId | null | Then I should have a redirect with sourceUri "company/service.html" and targetUri "service.html" - @fixtures Scenario: Change the the `uriPathSegment` and a redirect will be created When the command SetNodeProperties is executed with payload: | Key | Value | | nodeAggregateId | "company" | | originDimensionSpacePoint | {} | | propertyValues | {"uriPathSegment": "evil-corp"} | - Then I should have a redirect with sourceUri "company.html" and targetUri "evil-corp.html" + Then I should have a redirect with sourceUri "company.html" and targetUri "evil-corp.html" And I should have a redirect with sourceUri "company/service.html" and targetUri "evil-corp/service.html" - @fixtures Scenario: Change the the `uriPathSegment` multiple times and multiple redirects will be created When the command SetNodeProperties is executed with payload: | Key | Value | @@ -129,7 +126,6 @@ Feature: Basic redirect handling with document nodes without dimensions And I should have a redirect with sourceUri "evil-corp/service.html" and targetUri "more-evil-corp/service.html" - @fixtures Scenario: Retarget an existing redirect when the source URI matches the source URI of the new redirect When I have the following redirects: | sourceuripath | targeturipath | @@ -143,7 +139,6 @@ Feature: Basic redirect handling with document nodes without dimensions And I should have no redirect with sourceUri "company.html" and targetUri "company-old.html" And I should have a redirect with sourceUri "company/service.html" and targetUri "my-company/service.html" - @fixtures Scenario: No redirect should be created for an existing node if any non URI related property changes When the command SetNodeProperties is executed with payload: | Key | Value | @@ -152,7 +147,6 @@ Feature: Basic redirect handling with document nodes without dimensions | propertyValues | {"title": "my-buy"} | Then I should have no redirect with sourceUri "buy.html" - @fixtures Scenario: No redirect should be created for an restricted node by nodetype When the command SetNodeProperties is executed with payload: | Key | Value | @@ -161,7 +155,6 @@ Feature: Basic redirect handling with document nodes without dimensions | propertyValues | {"uriPathSegment": "restricted-by-nodetype-new"} | Then I should have no redirect with sourceUri "restricted.html" - @fixtures Scenario: Redirects should be created for a hidden node When the command DisableNodeAggregate is executed with payload: | Key | Value | @@ -175,7 +168,6 @@ Feature: Basic redirect handling with document nodes without dimensions | propertyValues | {"uriPathSegment": "not-mail"} | Then I should have a redirect with sourceUri "mail.html" and targetUri "not-mail.html" - @fixtures Scenario: A removed node should lead to a GONE response with empty target uri Given the command RemoveNodeAggregate is executed with payload: | Key | Value | From c069c2d2094e435723a2de7adba6205554b86615 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:30:20 +0200 Subject: [PATCH 5/9] TASK: Remove call to removed `setupCRTestSuiteTrait` setting up the sync / async mode is not necessary anymore --- Tests/Behavior/Features/Bootstrap/FeatureContext.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Tests/Behavior/Features/Bootstrap/FeatureContext.php b/Tests/Behavior/Features/Bootstrap/FeatureContext.php index 345942f..4ea6d24 100644 --- a/Tests/Behavior/Features/Bootstrap/FeatureContext.php +++ b/Tests/Behavior/Features/Bootstrap/FeatureContext.php @@ -31,7 +31,6 @@ public function __construct() { self::bootstrapFlow(); $this->contentRepositoryRegistry = $this->getObject(ContentRepositoryRegistry::class); - $this->setupCRTestSuiteTrait(); } protected function getContentRepositoryService( From c1ba433544dd53abf76641faefeb264f79941144 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:34:31 +0200 Subject: [PATCH 6/9] BUGFIX: Adjust to new SucceedingSiblingsForCoverage in NodeMove Migrated in a similar fashion as the DocumentUriPathProjection here: https://github.com/neos/neos-development-collection/pull/4993/files#diff-2e3df51a3340b51e08cf9d2ba5aade329a8c0e073354c1d5a72e42c3aaf5a127R618 Solves: https://github.com/neos/redirecthandler-neosadapter/issues/76 --- .../DocumentUriPathProjectionHook.php | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/Classes/CatchUpHook/DocumentUriPathProjectionHook.php b/Classes/CatchUpHook/DocumentUriPathProjectionHook.php index f03c675..4734cbb 100644 --- a/Classes/CatchUpHook/DocumentUriPathProjectionHook.php +++ b/Classes/CatchUpHook/DocumentUriPathProjectionHook.php @@ -12,13 +12,11 @@ use Neos\RedirectHandler\NeosAdapter\Service\NodeRedirectService; use Neos\ContentRepository\Core\SharedModel\Workspace\ContentStreamId; use Neos\Neos\FrontendRouting\Projection\DocumentUriPathFinder; -use Neos\ContentRepository\Core\Feature\NodeMove\Dto\CoverageNodeMoveMapping; use Neos\Neos\FrontendRouting\Projection\DocumentNodeInfo; use Neos\Neos\FrontendRouting\Exception\NodeNotFoundException; use Neos\Neos\FrontendRouting\NodeAddress; use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint; use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; -use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; use Neos\Neos\FrontendRouting\NodeAddressFactory; final class DocumentUriPathProjectionHook implements CatchUpHookInterface @@ -197,25 +195,21 @@ private function handleNodeWasMoved(NodeAggregateWasMoved $event, \Closure $clos return; } - foreach ($event->nodeMoveMappings as $moveMapping) { - /* @var \Neos\ContentRepository\Core\Feature\NodeMove\Dto\OriginNodeMoveMapping $moveMapping */ - foreach ($moveMapping->newLocations as $newLocation) { - /* @var $newLocation CoverageNodeMoveMapping */ - $node = $this->findNodeByIdAndDimensionSpacePointHash($event->nodeAggregateId, $newLocation->coveredDimensionSpacePoint->hash); - if ($node === null) { - // node probably no document node, skip - continue; - } - - $closure($node, $this->getNodeAddress($event->contentStreamId, $newLocation->coveredDimensionSpacePoint, $node->getNodeAggregateId()), $this->contentRepository->id); - - $descendantsOfNode = $this->getState()->getDescendantsOfNode($node); - array_map(fn (DocumentNodeInfo $descendantOfNode) => $closure( - $descendantOfNode, - $this->getNodeAddress($event->contentStreamId, $newLocation->coveredDimensionSpacePoint, $descendantOfNode->getNodeAggregateId()), - $this->contentRepository->id - ), iterator_to_array($descendantsOfNode)); + foreach ($event->succeedingSiblingsForCoverage as $interdimensionalSibling) { + $node = $this->findNodeByIdAndDimensionSpacePointHash($event->nodeAggregateId, $interdimensionalSibling->dimensionSpacePoint->hash); + if ($node === null) { + // node probably no document node, skip + continue; } + + $closure($node, $this->getNodeAddress($event->contentStreamId, $interdimensionalSibling->dimensionSpacePoint, $node->getNodeAggregateId()), $this->contentRepository->id); + + $descendantsOfNode = $this->getState()->getDescendantsOfNode($node); + array_map(fn (DocumentNodeInfo $descendantOfNode) => $closure( + $descendantOfNode, + $this->getNodeAddress($event->contentStreamId, $interdimensionalSibling->dimensionSpacePoint, $descendantOfNode->getNodeAggregateId()), + $this->contentRepository->id + ), iterator_to_array($descendantsOfNode)); } } From 1b13fbdbd385f427ec0b88bb351864b1a47ae213 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:51:26 +0200 Subject: [PATCH 7/9] TASK: Run behat correctly in cli (like in Neos) --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 391450c..d548775 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -82,7 +82,7 @@ jobs: cd ${NEOS_BASE_FOLDER} composer require --no-update --no-interaction neos/redirecthandler:"^6.0" composer require --no-update --no-interaction neos/redirecthandler-databasestorage:"^6.0" - + git -C ../${{ env.PACKAGE_FOLDER }} checkout -b build composer config repositories.package '{ "type": "path", "url": "../${{ env.PACKAGE_FOLDER }}", "options": { "symlink": false } }' composer require --no-update --no-interaction neos/redirecthandler-neosadapter:"dev-build as dev-${PACKAGE_TARGET_VERSION}" @@ -94,7 +94,7 @@ jobs: - name: Setup Flow configuration run: | - cd ${NEOS_BASE_FOLDER} + cd ${NEOS_BASE_FOLDER} mkdir -p Configuration/Testing rm -f Configuration/Testing/Settings.yaml cat <> Configuration/Testing/Settings.yaml @@ -119,10 +119,10 @@ jobs: cd ${NEOS_BASE_FOLDER} ./flow cr:setup - - name: Run Functional tests + - name: Run Behavioral tests run: | cd ${NEOS_BASE_FOLDER} - CATCHUPTRIGGER_ENABLE_SYNCHRONOUS_OPTION=1 bin/behat -c Packages/Application/Neos.RedirectHandler.NeosAdapter/Tests/Behavior/behat.yml.dist + bin/behat -f progress --strict --no-interaction -vvv --stop-on-failure -c Packages/Application/Neos.RedirectHandler.NeosAdapter/Tests/Behavior/behat.yml.dist - name: Show log on failure if: ${{ failure() }} From 5886d3d4fde2347f2dcb5b5384bcea92dd57c098 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 23 Jun 2024 09:46:11 +0200 Subject: [PATCH 8/9] TASK: Execute behat tests from package dir This was fixed with https://github.com/neos/behat/pull/39 --- .github/workflows/tests.yml | 3 ++- composer.json | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d548775..7751ae9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -122,7 +122,8 @@ jobs: - name: Run Behavioral tests run: | cd ${NEOS_BASE_FOLDER} - bin/behat -f progress --strict --no-interaction -vvv --stop-on-failure -c Packages/Application/Neos.RedirectHandler.NeosAdapter/Tests/Behavior/behat.yml.dist + cd Packages/Application/Neos.RedirectHandler.NeosAdapter + composer run test:behavioral:stop-on-failure - name: Show log on failure if: ${{ failure() }} diff --git a/composer.json b/composer.json index a1bd313..e428b87 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,10 @@ "neos/neos": "^9.0", "neos/flow": "^9.0" }, + "scripts": { + "test:behat-cli": "../../../bin/behat -f progress --strict --no-interaction", + "test:behavioral:stop-on-failure": "@test:behat-cli -c Tests/Behavior/behat.yml.dist -vvv --stop-on-failure" + }, "autoload": { "psr-4": { "Neos\\RedirectHandler\\NeosAdapter\\": "Classes" From 325a10c2a16175c806d4d6e84a606ac5d6f5aa4b Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sun, 23 Jun 2024 09:52:25 +0200 Subject: [PATCH 9/9] TASK: Document CI hack --- .github/workflows/tests.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7751ae9..ab22063 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -109,19 +109,13 @@ jobs: dbname: 'neos_functional_testing' EOF - - name: Setup database schema - run: | - cd ${NEOS_BASE_FOLDER} - ./flow doctrine:migrate --quite - - - name: Setup CR - run: | - cd ${NEOS_BASE_FOLDER} - ./flow cr:setup - - name: Run Behavioral tests run: | cd ${NEOS_BASE_FOLDER} + # we have to doctrine migrate and setup the cr here as otherwise a transaction error will occur: + # see also https://github.com/neos/neos-development-collection/pull/5005 + FLOW_CONTEXT=Testing ./flow doctrine:migrate --quiet; FLOW_CONTEXT=Testing ./flow cr:setup + cd Packages/Application/Neos.RedirectHandler.NeosAdapter composer run test:behavioral:stop-on-failure