-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathCopyNodesTest.php
More file actions
75 lines (65 loc) · 3.18 KB
/
CopyNodesTest.php
File metadata and controls
75 lines (65 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
declare(strict_types=1);
namespace Flowpack\NodeTemplates\Tests\Functional\Features\CopyNodes;
use Flowpack\NodeTemplates\Tests\Functional\AbstractNodeTemplateTestCase;
use Neos\ContentRepository\Core\Feature\NodeCreation\Command\CreateNodeAggregateWithNode;
use Neos\ContentRepository\Core\Feature\NodeCreation\Dto\NodeAggregateIdsByNodePaths;
use Neos\ContentRepository\Core\Feature\NodeModification\Dto\PropertyValuesToWrite;
use Neos\ContentRepository\Core\NodeType\NodeTypeName;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeName;
class CopyNodesTest extends AbstractNodeTemplateTestCase
{
/** @test */
public function itMatchesSnapshot1(): void
{
$this->getContentRepository()->handle(
CreateNodeAggregateWithNode::create(
$this->homePageNode->subgraphIdentity->contentStreamId,
$source = NodeAggregateId::fromString('source-node'),
NodeTypeName::fromString('Flowpack.NodeTemplates:Document.Page'),
$this->homePageNode->originDimensionSpacePoint,
$this->homePageNode->nodeAggregateId,
nodeName: NodeName::fromString(uniqid('node-')),
)->withTetheredDescendantNodeAggregateIds(NodeAggregateIdsByNodePaths::fromArray([
'main' => $main = NodeAggregateId::fromString('source-node-main-collection'),
]))
)->block();
$this->getContentRepository()->handle(
CreateNodeAggregateWithNode::create(
$this->homePageNode->subgraphIdentity->contentStreamId,
NodeAggregateId::fromString('source-node-text-1'),
NodeTypeName::fromString('Flowpack.NodeTemplates:Content.Text'),
$this->homePageNode->originDimensionSpacePoint,
$main,
nodeName: NodeName::fromString(uniqid('node-')),
initialPropertyValues: PropertyValuesToWrite::fromArray([
'text' => 'Lorem ipsum 1'
])
)
)->block();
$this->getContentRepository()->handle(
CreateNodeAggregateWithNode::create(
$this->homePageNode->subgraphIdentity->contentStreamId,
NodeAggregateId::fromString('source-node-text-2'),
NodeTypeName::fromString('Flowpack.NodeTemplates:Content.Text'),
$this->homePageNode->originDimensionSpacePoint,
$main,
nodeName: NodeName::fromString(uniqid('node-')),
initialPropertyValues: PropertyValuesToWrite::fromArray([
'text' => 'Lorem ipsum 2'
])
)
)->block();
$createdNode = $this->createNodeInto(
$this->homePageMainContentCollectionNode,
'Flowpack.NodeTemplates:Content.StaticNodeCopy',
[
'sourceNode' => $this->subgraph->findNodeById($main)
]
);
$this->assertLastCreatedTemplateMatchesSnapshot('StaticNodeCopy');
$this->assertNoExceptionsWereCaught();
$this->assertNodeDumpAndTemplateDumpMatchSnapshot('StaticNodeCopy', $createdNode);
}
}