Skip to content

Commit

Permalink
4608 - Support setting DocumentUriPaths for site children
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard Schmitt committed Oct 13, 2023
1 parent 041670b commit 0bd77b1
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ public function theCommandSetPropertiesIsExecutedWithPayload(TableNode $payloadT
$commandArguments['originDimensionSpacePoint'] = $this->currentDimensionSpacePoint->jsonSerialize();
}

$rawNodeAggregateId = $commandArguments['nodeAggregateId'];
$command = SetNodeProperties::create(
ContentStreamId::fromString($commandArguments['contentStreamId']),
NodeAggregateId::fromString($commandArguments['nodeAggregateId']),
\str_starts_with($rawNodeAggregateId, '$')
? $this->rememberedNodeAggregateIds[\mb_substr($rawNodeAggregateId, 1)]
: NodeAggregateId::fromString($rawNodeAggregateId),
OriginDimensionSpacePoint::fromArray($commandArguments['originDimensionSpacePoint']),
$this->deserializeProperties($commandArguments['propertyValues']),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,6 @@ private function whenNodePropertiesWereSet(NodePropertiesWereSet $event, EventEn
continue;
}
$oldUriPath = $node->getUriPath();
// homepage -> TODO hacky?
if ($oldUriPath === '') {
continue;
}
/** @var string[] $uriPathSegments */
$uriPathSegments = explode('/', $oldUriPath);
$uriPathSegments[array_key_last($uriPathSegments)] = $newPropertyValues['uriPathSegment'];
$newUriPath = implode('/', $uriPathSegments);
Expand Down
4 changes: 3 additions & 1 deletion Neos.Neos/Tests/Behavior/Features/Bootstrap/RoutingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,9 @@ private function resolveUrl(string $nodeAggregateId, string $contentStreamId, st
$nodeAddress = new NodeAddress(
ContentStreamId::fromString($contentStreamId),
DimensionSpacePoint::fromJsonString($dimensionSpacePoint),
NodeAggregateId::fromString($nodeAggregateId),
\str_starts_with($nodeAggregateId, '$')
? $this->rememberedNodeAggregateIds[\mb_substr($nodeAggregateId, 1)]
: NodeAggregateId::fromString($nodeAggregateId),
WorkspaceName::forLive()
);
$httpRequest = $this->objectManager->get(ServerRequestFactoryInterface::class)->createServerRequest('GET', $this->requestUrl);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@fixtures @contentrepository
Feature: Basic routing functionality (match & resolve document nodes in one dimension)

Background:
Given using no content dimensions
And using the following node types:
"""yaml
'Neos.ContentRepository:Root': {}
'Neos.Neos:Sites':
superTypes:
'Neos.ContentRepository:Root': true
'Neos.Neos:Document':
properties:
uriPathSegment:
type: string
'Neos.Neos:Site':
superTypes:
'Neos.Neos:Document': true
properties:
uriPathSegment: ~
'Acme.Site:Document.Homepage':
superTypes:
'Neos.Neos:Site': true
childNodes:
notFound:
type: 'Neos.Neos:Document'
"""
And using identifier "default", I define a content repository
And I am in content repository "default"
And I am user identified by "initiating-user-identifier"

When the command CreateRootWorkspace is executed with payload:
| Key | Value |
| workspaceName | "live" |
| newContentStreamId | "cs-identifier" |
And the command CreateRootNodeAggregateWithNode is executed with payload:
| Key | Value |
| contentStreamId | "cs-identifier" |
| nodeAggregateId | "lady-eleonode-rootford" |
| nodeTypeName | "Neos.Neos:Sites" |
And the graph projection is fully up to date
And I am in content stream "cs-identifier" and dimension space point {}
And the following CreateNodeAggregateWithNode commands are executed:
| nodeAggregateId | parentNodeAggregateId | nodeTypeName | initialPropertyValues | nodeName |
| shernode-homes | lady-eleonode-rootford | Acme.Site:Document.Homepage | {} | site |
And A site exists for node name "site"
And the sites configuration is:
"""yaml
Neos:
Neos:
sites:
'*':
contentRepository: default
contentDimensions:
resolver:
factoryClassName: Neos\Neos\FrontendRouting\DimensionResolution\Resolver\NoopResolverFactory
"""
And The documenturipath projection is up to date

Scenario: Set tethered child uriPathSegment
When I remember NodeAggregateId of node "shernode-homes"s child "notFound" as "notFoundId"
And the command SetNodeProperties is executed with payload:
| Key | Value |
| nodeAggregateId | "$notFoundId" |
| propertyValues | {"uriPathSegment": "not-found"} |
And the graph projection is fully up to date
And The documenturipath projection is up to date
And I am on URL "/"
Then the matched node should be "shernode-homes" in content stream "cs-identifier" and dimension "{}"
And the node "$notFoundId" in content stream "cs-identifier" and dimension "{}" should resolve to URL "/not-found"

0 comments on commit 0bd77b1

Please sign in to comment.