-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '4609-multipleContentCollectionPublishing' into 4608-tet…
…heredSiteChildrenUriPathSegment
- Loading branch information
Showing
7 changed files
with
231 additions
and
41 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
....BehavioralTests/Tests/Behavior/Features/NodePublishing/IndividualNodePublication.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
@contentrepository @adapters=DoctrineDBAL | ||
Feature: Individual node publication | ||
|
||
Publishing an individual node works | ||
|
||
Background: | ||
Given using no content dimensions | ||
And using the following node types: | ||
"""yaml | ||
'Neos.ContentRepository:Root': {} | ||
'Neos.ContentRepository.Testing:Content': {} | ||
'Neos.ContentRepository.Testing:Document': | ||
childNodes: | ||
child1: | ||
type: 'Neos.ContentRepository.Testing:Content' | ||
child2: | ||
type: 'Neos.ContentRepository.Testing:Content' | ||
""" | ||
And using identifier "default", I define a content repository | ||
And I am in content repository "default" | ||
And the command CreateRootWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "live" | | ||
| newContentStreamId | "cs-identifier" | | ||
And the graph projection is fully up to date | ||
And the command CreateRootNodeAggregateWithNode is executed with payload: | ||
| Key | Value | | ||
| contentStreamId | "cs-identifier" | | ||
| nodeAggregateId | "lady-eleonode-rootford" | | ||
| nodeTypeName | "Neos.ContentRepository:Root" | | ||
|
||
# Create user workspace | ||
And the command CreateWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| baseWorkspaceName | "live" | | ||
| newContentStreamId | "user-cs-identifier" | | ||
And the graph projection is fully up to date | ||
|
||
################ | ||
# PUBLISHING | ||
################ | ||
Scenario: It is possible to publish a single node; and only this one is live. | ||
# create nodes in user WS | ||
Given I am in content stream "user-cs-identifier" and dimension space point {} | ||
And the following CreateNodeAggregateWithNode commands are executed: | ||
| nodeAggregateId | nodeTypeName | parentNodeAggregateId | nodeName | tetheredDescendantNodeAggregateIds | | ||
| sir-david-nodenborough | Neos.ContentRepository.Testing:Document | lady-eleonode-rootford | document | {} | | ||
And I remember NodeAggregateId of node "sir-david-nodenborough"s child "child2" as "child2Id" | ||
And the following CreateNodeAggregateWithNode commands are executed: | ||
| nodeAggregateId | nodeTypeName | parentNodeAggregateId | nodeName | tetheredDescendantNodeAggregateIds | | ||
| nody-mc-nodeface | Neos.ContentRepository.Testing:Content | $child2Id | nody | {} | | ||
When the command PublishIndividualNodesFromWorkspace is executed with payload: | ||
| Key | Value | | ||
| workspaceName | "user-test" | | ||
| nodesToPublish | [{"contentStreamId": "user-cs-identifier", "dimensionSpacePoint": {}, "nodeAggregateId": "sir-david-nodenborough"}] | | ||
| contentStreamIdForRemainingPart | "user-cs-identifier-remaining" | | ||
And the graph projection is fully up to date | ||
|
||
And I am in content stream "cs-identifier" | ||
|
||
Then I expect a node identified by cs-identifier;sir-david-nodenborough;{} to exist in the content graph | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
...ntRepository.Core/Tests/Unit/Feature/NodeCreation/Dto/NodeAggregateIdsByNodePathsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Neos.ContentRepository.Core package. | ||
* | ||
* (c) Contributors of the Neos Project - www.neos.io | ||
* | ||
* This package is Open Source Software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Neos\ContentRepository\Core\Tests\Unit\Feature\NodeCreation\Dto; | ||
|
||
use Neos\ContentRepository\Core\Feature\NodeCreation\Dto\NodeAggregateIdsByNodePaths; | ||
use Neos\ContentRepository\Core\NodeType\DefaultNodeLabelGeneratorFactory; | ||
use Neos\ContentRepository\Core\NodeType\NodeTypeManager; | ||
use Neos\ContentRepository\Core\NodeType\NodeTypeName; | ||
use Neos\ContentRepository\Core\Projection\ContentGraph\NodePath; | ||
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Test cases for {@see NodeAggregateIdsByNodePaths} | ||
*/ | ||
class NodeAggregateIdsByNodePathsTest extends TestCase | ||
{ | ||
/** | ||
* @param array<string,NodeAggregateId|null> $expectedNodeAggregateIdsByPath, null if the actual value is not important | ||
* @dataProvider subjectProvider | ||
*/ | ||
public function testCompleteForNodeOfType(NodeAggregateIdsByNodePaths $subject, array $expectedNodeAggregateIdsByPath): void | ||
{ | ||
$nodeTypeManager = new NodeTypeManager( | ||
fn (): array => [ | ||
'Neos.ContentRepository.Testing:Content' => [], | ||
'Neos.ContentRepository.Testing:LeafDocument' => [ | ||
'childNodes' => [ | ||
'grandchild1' => [ | ||
'type' => 'Neos.ContentRepository.Testing:Content' | ||
], | ||
'grandchild2' => [ | ||
'type' => 'Neos.ContentRepository.Testing:Content' | ||
] | ||
] | ||
], | ||
'Neos.ContentRepository.Testing:Document' => [ | ||
'childNodes' => [ | ||
'child1' => [ | ||
'type' => 'Neos.ContentRepository.Testing:LeafDocument' | ||
], | ||
'child2' => [ | ||
'type' => 'Neos.ContentRepository.Testing:LeafDocument' | ||
] | ||
] | ||
] | ||
], | ||
new DefaultNodeLabelGeneratorFactory() | ||
); | ||
|
||
$completeSubject = $subject->completeForNodeOfType( | ||
NodeTypeName::fromString('Neos.ContentRepository.Testing:Document'), | ||
$nodeTypeManager | ||
); | ||
|
||
foreach ($expectedNodeAggregateIdsByPath as $path => $explicitExpectedNodeAggregateId) { | ||
$actualNodeAggregateId = $completeSubject->getNodeAggregateId(NodePath::fromString($path)); | ||
self::assertInstanceOf(NodeAggregateId::class, $actualNodeAggregateId); | ||
if ($explicitExpectedNodeAggregateId instanceof NodeAggregateId) { | ||
self::assertTrue($actualNodeAggregateId->equals($explicitExpectedNodeAggregateId)); | ||
} | ||
} | ||
} | ||
|
||
public static function subjectProvider(): iterable | ||
{ | ||
yield 'emptySubject' => [ | ||
'subject' => NodeAggregateIdsByNodePaths::createEmpty(), | ||
'expectedNodeAggregateIdsByPath' => [ | ||
'child1' => null, | ||
'child2' => null, | ||
'child1/grandchild1' => null, | ||
'child1/grandchild2' => null, | ||
'child2/grandchild1' => null, | ||
'child2/grandchild2' => null, | ||
] | ||
]; | ||
|
||
yield 'alreadyCompleteSubject' => [ | ||
'subject' => NodeAggregateIdsByNodePaths::fromArray([ | ||
'child1' => NodeAggregateId::fromString('child-1'), | ||
'child2' => NodeAggregateId::fromString('child-2'), | ||
'child1/grandchild1' => NodeAggregateId::fromString('grandchild-1-1'), | ||
'child1/grandchild2' => NodeAggregateId::fromString('grandchild-1-2'), | ||
'child2/grandchild1' => NodeAggregateId::fromString('grandchild-2-1'), | ||
'child2/grandchild2' => NodeAggregateId::fromString('grandchild-2-1'), | ||
]), | ||
'expectedNodeAggregateIdsByPath' => [ | ||
'child1' => NodeAggregateId::fromString('child-1'), | ||
'child2' => NodeAggregateId::fromString('child-2'), | ||
'child1/grandchild1' => NodeAggregateId::fromString('grandchild-1-1'), | ||
'child1/grandchild2' => NodeAggregateId::fromString('grandchild-1-2'), | ||
'child2/grandchild1' => NodeAggregateId::fromString('grandchild-2-1'), | ||
'child2/grandchild2' => NodeAggregateId::fromString('grandchild-2-1'), | ||
] | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters