diff --git a/config/set/contentrepository-90.php b/config/set/contentrepository-90.php index b3b6314..25b45ee 100644 --- a/config/set/contentrepository-90.php +++ b/config/set/contentrepository-90.php @@ -40,14 +40,17 @@ use Neos\Rector\ContentRepository90\Rules\NodeGetChildNodesRector; use Neos\Rector\ContentRepository90\Rules\NodeGetContextGetWorkspaceNameRector; use Neos\Rector\ContentRepository90\Rules\NodeGetContextGetWorkspaceRector; +use Neos\Rector\ContentRepository90\Rules\NodeGetContextPathRector; use Neos\Rector\ContentRepository90\Rules\NodeGetDepthRector; use Neos\Rector\ContentRepository90\Rules\NodeGetDimensionsRector; +use Neos\Rector\ContentRepository90\Rules\NodeGetHiddenBeforeAfterDateTimeRector; use Neos\Rector\ContentRepository90\Rules\NodeGetIdentifierRector; use Neos\Rector\ContentRepository90\Rules\NodeGetNodeTypeGetNameRector; use Neos\Rector\ContentRepository90\Rules\NodeGetNodeTypeRector; use Neos\Rector\ContentRepository90\Rules\NodeGetParentRector; use Neos\Rector\ContentRepository90\Rules\NodeGetPathRector; use Neos\Rector\ContentRepository90\Rules\NodeGetPropertyNamesRector; +use Neos\Rector\ContentRepository90\Rules\NodeIsAutoCreatedRector; use Neos\Rector\ContentRepository90\Rules\NodeIsHiddenInIndexRector; use Neos\Rector\ContentRepository90\Rules\NodeIsHiddenRector; use Neos\Rector\ContentRepository90\Rules\NodeLabelGeneratorRector; @@ -174,19 +177,20 @@ // Fusion: node.nodeType.name -> node.nodeTypeName $rectorConfig->rule(FusionNodeNodeTypeRector::class); // setHidden + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHidden', '!! Node::setHidden() is not supported by the new CR. Use the "EnableNodeAggregate" or "DisableNodeAggregate" command to change the visibility of the node.'); // isHidden $rectorConfig->rule(NodeIsHiddenRector::class); $rectorConfig->rule(FusionNodeHiddenRector::class); // TODO: Fusion NodeAccess // setHiddenBeforeDateTime - $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHiddenBeforeDateTime', '!! Node::setHiddenBeforeDateTime() is not supported by the new CR. Timed publishing will be implemented not on the read model, but by dispatching commands at a given time.'); + $rectorConfig->rule(NodeGetHiddenBeforeAfterDateTimeRector::class); // getHiddenBeforeDateTime - $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getHiddenBeforeDateTime', '!! Node::getHiddenBeforeDateTime() is not supported by the new CR. Timed publishing will be implemented not on the read model, but by dispatching commands at a given time.'); + // PHP: Covered by NodeGetHiddenBeforeAfterDateTimeRector $rectorConfig->rule(FusionNodeHiddenBeforeDateTimeRector::class); // setHiddenAfterDateTime - $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHiddenAfterDateTime', '!! Node::setHiddenAfterDateTime() is not supported by the new CR. Timed publishing will be implemented not on the read model, but by dispatching commands at a given time.'); + // PHP: Covered by NodeGetHiddenBeforeAfterDateTimeRector // getHiddenAfterDateTime - $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getHiddenAfterDateTime', '!! Node::getHiddenAfterDateTime() is not supported by the new CR. Timed publishing will be implemented not on the read model, but by dispatching commands at a given time.'); + // PHP: Covered by NodeGetHiddenBeforeAfterDateTimeRector $rectorConfig->rule(FusionNodeHiddenAfterDateTimeRector::class); // setHiddenInIndex $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setHiddenInIndex', '!! Node::setHiddenInIndex() is not supported by the new CR. Use the "SetNodeProperties" command to change the property value for "hiddenInMenu".'); @@ -204,7 +208,7 @@ $rectorConfig->rule(FusionNodePathRector::class); $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_path', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_path")" to "Neos.Node.path(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'); // getContextPath - // TODO: PHP + $rectorConfig->rule(NodeGetContextPathRector::class); $rectorConfig->rule(FusionNodeContextPathRector::class); $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_contextPath', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_contextPath")" to "Neos.Node.serializedNodeAddress(VARIABLE)". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'); // getDepth @@ -239,7 +243,9 @@ $rectorConfig->rule(NodeGetChildNodesRector::class); // hasChildNodes($nodeTypeFilter) - deprecated // remove() + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'remove', '!! Node::remove() is not supported by the new CR. Use the "RemoveNodeAggregate" command to remove a node.'); // setRemoved() + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'setRemoved', '!! Node::setRemoved() is not supported by the new CR. Use the "RemoveNodeAggregate" command to remove a node.'); // isRemoved() $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'isRemoved', '!! Node::isRemoved() - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.'); $fusionNodePropertyPathToWarningComments[] = new FusionNodePropertyPathToWarningComment('removed', 'Line %LINE: !! node.removed - the new CR *never* returns removed nodes; so you can simplify your code and just assume removed == FALSE in all scenarios.'); @@ -248,11 +254,17 @@ // hasAccessRestrictions() // isNodeTypeAllowedAsChildNode() // moveBefore() + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'moveBefore', '!! Node::moveBefore() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.'); // moveAfter() + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'moveAfter', '!! Node::moveAfter() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.'); // moveInto() + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'moveInto', '!! Node::moveInto() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node.'); // copyBefore() + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'copyBefore', '!! Node::copyBefore() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.'); // copyAfter() + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'copyAfter', '!! Node::copyAfter() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.'); // copyInto() + $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'copyInto', '!! Node::copyInto() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node.'); // getNodeData() $methodCallToWarningComments[] = new MethodCallToWarningComment(NodeLegacyStub::class, 'getNodeData', '!! Node::getNodeData() - the new CR is not based around the concept of NodeData anymore. You need to rewrite your code here.'); // getContext() @@ -267,7 +279,7 @@ // TODO: Fusion // createVariantForContext() // isAutoCreated() - // TODO: PHP + $rectorConfig->rule(NodeIsAutoCreatedRector::class); $rectorConfig->rule(FusionNodeAutoCreatedRector::class); $fusionFlowQueryPropertyToComments[] = new FusionFlowQueryNodePropertyToWarningComment('_autoCreated', 'Line %LINE: !! You very likely need to rewrite "q(VARIABLE).property("_autoCreated")" to "VARIABLE.classification.tethered". We did not auto-apply this migration because we cannot be sure whether the variable is a Node.'); diff --git a/docs/rules_overview.md b/docs/rules_overview.md index c869dc1..975ec97 100644 --- a/docs/rules_overview.md +++ b/docs/rules_overview.md @@ -1,4 +1,4 @@ -# 61 Rules Overview +# 64 Rules Overview ## ContentDimensionCombinatorGetAllAllowedCombinationsRector @@ -1359,7 +1359,7 @@ return static function (RectorConfig $rectorConfig): void { ## NodeGetContextGetWorkspaceNameRector -`"NodeInterface::getContext()::getWorkspace()"` will be rewritten +`"NodeInterface::getContext()::getWorkspaceName()"` will be rewritten - class: [`Neos\Rector\ContentRepository90\Rules\NodeGetContextGetWorkspaceNameRector`](../src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php) @@ -1409,6 +1409,31 @@ return static function (RectorConfig $rectorConfig): void {
+## NodeGetContextPathRector + +`"NodeInterface::getContextPath()"` will be rewritten + +- class: [`Neos\Rector\ContentRepository90\Rules\NodeGetContextPathRector`](../src/ContentRepository90/Rules/NodeGetContextPathRector.php) + +```diff + getContextPath(); ++ return \Neos\ContentRepository\Core\SharedModel\Node\NodeAddress::fromNode($node)->toJson(); + } + } + + ?> +``` + +
+ ## NodeGetDepthRector `"NodeInterface::getDepth()"` will be rewritten @@ -1437,7 +1462,7 @@ return static function (RectorConfig $rectorConfig): void { ## NodeGetDimensionsRector -`"NodeInterface::getChildNodes()"` will be rewritten +`"NodeInterface::getDimensions()"` will be rewritten - class: [`Neos\Rector\ContentRepository90\Rules\NodeGetDimensionsRector`](../src/ContentRepository90/Rules/NodeGetDimensionsRector.php) @@ -1462,6 +1487,51 @@ return static function (RectorConfig $rectorConfig): void {
+## NodeGetHiddenBeforeAfterDateTimeRector + +`"NodeInterface::getHiddenBeforeDateTime()",` `"NodeInterface::setHiddenBeforeDateTime()",` `"NodeInterface::getHiddenAfterDateTime()"` and `"NodeInterface::setHiddenAfterDateTime()"` will be rewritten + +- class: [`Neos\Rector\ContentRepository90\Rules\NodeGetHiddenBeforeAfterDateTimeRector`](../src/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector.php) + +```diff + getHiddenBeforeDateTime(); ++ // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. + ++ $dateTime = $node->getProperty('enableAfterDateTime'); ++ // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. ++ // Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime". ++ ++ + $node->setHiddenBeforeDateTime($dateTime); + } + + public function nodeHiddenAfterDateTime(NodeLegacyStub $node) + { +- $dateTime = $node->getHiddenAfterDateTime(); ++ // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. ++ ++ $dateTime = $node->getProperty('disableAfterDateTime'); ++ // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. ++ // Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime". ++ + + $node->setHiddenAfterDateTime($dateTime); + } + } + + ?> +``` + +
+ ## NodeGetIdentifierRector `"NodeInterface::getIdentifier()"` will be rewritten @@ -1533,8 +1603,7 @@ return static function (RectorConfig $rectorConfig): void { public function run(NodeLegacyStub $node) { - $nodeType = $node->getNodeType(); -+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories. -+ $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default')); ++ $contentRepository = $this->contentRepositoryRegistry->get($node->contentRepositoryId); + $nodeType = $contentRepository->getNodeTypeManager()->getNodeType($node->nodeTypeName); } } @@ -1623,6 +1692,31 @@ return static function (RectorConfig $rectorConfig): void {
+## NodeIsAutoCreatedRector + +"NodeInterface::isAutoCreated" will be rewritten + +- class: [`Neos\Rector\ContentRepository90\Rules\NodeIsAutoCreatedRector`](../src/ContentRepository90/Rules/NodeIsAutoCreatedRector.php) + +```diff + isAutoCreated(); ++ $bool = $node->classification->isTethered(); + } + } + + ?> +``` + +
+ ## NodeIsHiddenInIndexRector `"NodeInterface::isHiddenInIndex()"` will be rewritten @@ -1808,7 +1902,7 @@ return static function (RectorConfig $rectorConfig): void { $nodeName = NodeName::fromString('name'); $nodeType = $node->getNodeType(); - $type = $nodeType->getTypeOfAutoCreatedChildNode($nodeName); -+ // TODO 9.0 migration: Make this code aware of multiple Content Repositories. ++ // TODO 9.0 migration: Make this code aware of multiple Content Repositories. If you have a Node object around you can use $node->contentRepositoryId. + $contentRepository = $this->contentRepositoryRegistry->get(\Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId::fromString('default')); + $type = $contentRepository->getNodeTypeManager()->getNodeType($nodeType->tetheredNodeTypeDefinitions->get($nodeName)); } diff --git a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php index defc1c8..aad3b07 100644 --- a/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php +++ b/src/ContentRepository90/Rules/NodeGetContextGetWorkspaceNameRector.php @@ -17,13 +17,12 @@ final class NodeGetContextGetWorkspaceNameRector extends AbstractRector public function __construct( private readonly NodesToAddCollector $nodesToAddCollector - ) - { + ) { } public function getRuleDefinition(): RuleDefinition { - return CodeSampleLoader::fromFile('"NodeInterface::getContext()::getWorkspace()" will be rewritten', __CLASS__); + return CodeSampleLoader::fromFile('"NodeInterface::getContext()::getWorkspaceName()" will be rewritten', __CLASS__); } /** diff --git a/src/ContentRepository90/Rules/NodeGetContextPathRector.php b/src/ContentRepository90/Rules/NodeGetContextPathRector.php new file mode 100644 index 0000000..459bb48 --- /dev/null +++ b/src/ContentRepository90/Rules/NodeGetContextPathRector.php @@ -0,0 +1,61 @@ +> + */ + public function getNodeTypes(): array + { + return [\PhpParser\Node\Expr\MethodCall::class]; + } + + /** + * @param \PhpParser\Node\Expr\MethodCall $node + */ + public function refactor(Node $node): ?Node + { + assert($node instanceof Node\Expr\MethodCall); + + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { + return null; + } + if (!$this->isName($node->name, 'getContextPath')) { + return null; + } + + + return + $this->nodeFactory->createMethodCall( + $this->nodeFactory->createStaticCall( + NodeAddress::class, + 'fromNode', + [$node->var]), + 'toJson' + ); + } +} diff --git a/src/ContentRepository90/Rules/NodeGetDimensionsRector.php b/src/ContentRepository90/Rules/NodeGetDimensionsRector.php index 88c9704..25e6ffe 100644 --- a/src/ContentRepository90/Rules/NodeGetDimensionsRector.php +++ b/src/ContentRepository90/Rules/NodeGetDimensionsRector.php @@ -1,6 +1,7 @@ > */ - public function getNodeTypes() : array + public function getNodeTypes(): array { return [\PhpParser\Node\Expr\MethodCall::class]; } + /** * @param \PhpParser\Node\Expr\MethodCall $node */ - public function refactor(Node $node) : ?Node + public function refactor(Node $node): ?Node { assert($node instanceof Node\Expr\MethodCall); diff --git a/src/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector.php b/src/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector.php new file mode 100644 index 0000000..88afd33 --- /dev/null +++ b/src/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector.php @@ -0,0 +1,76 @@ +> + */ + public function getNodeTypes(): array + { + return [\PhpParser\Node\Expr\MethodCall::class]; + } + + /** + * @param \PhpParser\Node\Expr\MethodCall $node + */ + public function refactor(Node $node): ?Node + { + assert($node instanceof Node\Expr\MethodCall); + + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { + return null; + } + + if ( + !$this->isName($node->name, 'getHiddenBeforeDateTime') + && !$this->isName($node->name, 'setHiddenBeforeDateTime') + && !$this->isName($node->name, 'getHiddenAfterDateTime') + && !$this->isName($node->name, 'setHiddenAfterDateTime') + ) { + return null; + } + + $comment = 'Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details.'; + + if ($this->isName($node->name, 'getHiddenBeforeDateTime')) { + $newNode = $this->nodeFactory->createMethodCall($node->var, 'getProperty', ['enableAfterDateTime']); + } elseif ($this->isName($node->name, 'getHiddenAfterDateTime')) { + $newNode = $this->nodeFactory->createMethodCall($node->var, 'getProperty', ['disableAfterDateTime']); + } else { + $newNode = $node; + $comment .= PHP_EOL . '// Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime".'; + } + + $this->nodesToAddCollector->addNodesBeforeNode( + [ + self::todoComment($comment) + ], + $node + ); + + return $newNode; + } +} diff --git a/src/ContentRepository90/Rules/NodeIsAutoCreatedRector.php b/src/ContentRepository90/Rules/NodeIsAutoCreatedRector.php new file mode 100644 index 0000000..cc5f482 --- /dev/null +++ b/src/ContentRepository90/Rules/NodeIsAutoCreatedRector.php @@ -0,0 +1,58 @@ +> + */ + public function getNodeTypes(): array + { + return [\PhpParser\Node\Expr\MethodCall::class]; + } + + /** + * @param \PhpParser\Node\Expr\MethodCall $node + */ + public function refactor(Node $node): ?Node + { + assert($node instanceof Node\Expr\MethodCall); + + if (!$this->isObjectType($node->var, new ObjectType(\Neos\Rector\ContentRepository90\Legacy\NodeLegacyStub::class))) { + return null; + } + if (!$this->isName($node->name, 'isAutoCreated')) { + return null; + } + + return + $this->nodeFactory->createMethodCall( + $this->nodeFactory->createPropertyFetch( + $node->var, + 'classification'), + 'isTethered' + ); + } +} diff --git a/tests/ContentRepository90/Rules/NodeGetContextPathRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetContextPathRector/Fixture/some_class.php.inc new file mode 100644 index 0000000..3207ac7 --- /dev/null +++ b/tests/ContentRepository90/Rules/NodeGetContextPathRector/Fixture/some_class.php.inc @@ -0,0 +1,27 @@ +getContextPath(); + } +} + +?> +----- +toJson(); + } +} + +?> diff --git a/tests/ContentRepository90/Rules/NodeGetContextPathRector/NodeGetContextPathRectorTest.php b/tests/ContentRepository90/Rules/NodeGetContextPathRector/NodeGetContextPathRectorTest.php new file mode 100644 index 0000000..744db26 --- /dev/null +++ b/tests/ContentRepository90/Rules/NodeGetContextPathRector/NodeGetContextPathRectorTest.php @@ -0,0 +1,31 @@ +doTestFile($fileInfo); + } + + /** + * @return \Iterator + */ + public function provideData(): \Iterator + { + return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/tests/ContentRepository90/Rules/NodeGetContextPathRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetContextPathRector/config/configured_rule.php new file mode 100644 index 0000000..358d331 --- /dev/null +++ b/tests/ContentRepository90/Rules/NodeGetContextPathRector/config/configured_rule.php @@ -0,0 +1,10 @@ +rule(NodeGetContextPathRector::class); +}; diff --git a/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/Fixture/some_class.php.inc new file mode 100644 index 0000000..bd3d24d --- /dev/null +++ b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/Fixture/some_class.php.inc @@ -0,0 +1,55 @@ +getHiddenBeforeDateTime(); + + $node->setHiddenBeforeDateTime($dateTime); + } + + public function nodeHiddenAfterDateTime(NodeLegacyStub $node) + { + $dateTime = $node->getHiddenAfterDateTime(); + + $node->setHiddenAfterDateTime($dateTime); + } +} + +?> +----- +getProperty('enableAfterDateTime'); + // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. + // Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime". + + + $node->setHiddenBeforeDateTime($dateTime); + } + + public function nodeHiddenAfterDateTime(NodeLegacyStub $node) + { + // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. + + $dateTime = $node->getProperty('disableAfterDateTime'); + // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. + // Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime". + + + $node->setHiddenAfterDateTime($dateTime); + } +} + +?> diff --git a/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/NodeGetHiddenBeforeAfterDateTimeRectorTest.php b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/NodeGetHiddenBeforeAfterDateTimeRectorTest.php new file mode 100644 index 0000000..ba3e814 --- /dev/null +++ b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/NodeGetHiddenBeforeAfterDateTimeRectorTest.php @@ -0,0 +1,31 @@ +doTestFile($fileInfo); + } + + /** + * @return \Iterator + */ + public function provideData(): \Iterator + { + return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/config/configured_rule.php new file mode 100644 index 0000000..2e3f4c8 --- /dev/null +++ b/tests/ContentRepository90/Rules/NodeGetHiddenBeforeAfterDateTimeRector/config/configured_rule.php @@ -0,0 +1,10 @@ +rule(NodeGetHiddenBeforeAfterDateTimeRector::class); +}; diff --git a/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/Fixture/some_class.php.inc b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/Fixture/some_class.php.inc new file mode 100644 index 0000000..6444805 --- /dev/null +++ b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/Fixture/some_class.php.inc @@ -0,0 +1,27 @@ +isAutoCreated(); + } +} + +?> +----- +classification->isTethered(); + } +} + +?> diff --git a/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/NodeIsAutoCreatedRectorTest.php b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/NodeIsAutoCreatedRectorTest.php new file mode 100644 index 0000000..152981c --- /dev/null +++ b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/NodeIsAutoCreatedRectorTest.php @@ -0,0 +1,31 @@ +doTestFile($fileInfo); + } + + /** + * @return \Iterator + */ + public function provideData(): \Iterator + { + return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); + } + + public function provideConfigFilePath(): string + { + return __DIR__ . '/config/configured_rule.php'; + } +} diff --git a/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/config/configured_rule.php b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/config/configured_rule.php new file mode 100644 index 0000000..f0cbb95 --- /dev/null +++ b/tests/ContentRepository90/Rules/NodeIsAutoCreatedRector/config/configured_rule.php @@ -0,0 +1,10 @@ +rule(NodeIsAutoCreatedRector::class); +}; diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-auto-created.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-auto-created.php.inc new file mode 100644 index 0000000..46dbccb --- /dev/null +++ b/tests/Sets/ContentRepository90/Fixture/Node/node-auto-created.php.inc @@ -0,0 +1,28 @@ +isAutoCreated(); + } +} + +----- +classification->isTethered(); + } +} diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-copy.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-copy.php.inc new file mode 100644 index 0000000..b375b8e --- /dev/null +++ b/tests/Sets/ContentRepository90/Fixture/Node/node-copy.php.inc @@ -0,0 +1,39 @@ +copyBefore($otherNode); + $node->copyInto($otherNode); + $node->copyAfter($otherNode); + } +} + +----- +copyBefore($otherNode); + // TODO 9.0 migration: !! Node::copyInto() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node. + + $node->copyInto($otherNode); + // TODO 9.0 migration: !! Node::copyAfter() is not supported by the new CR. Use the "NodeDuplicationService::copyNodesRecursively" to copy a node. + + $node->copyAfter($otherNode); + } +} + diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-get-context-path.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-get-context-path.php.inc new file mode 100644 index 0000000..597b300 --- /dev/null +++ b/tests/Sets/ContentRepository90/Fixture/Node/node-get-context-path.php.inc @@ -0,0 +1,29 @@ +getContextPath(); + } +} + +----- +toJson(); + } +} + diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-before-after-date-time.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-before-after-date-time.php.inc new file mode 100644 index 0000000..8fa4070 --- /dev/null +++ b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden-before-after-date-time.php.inc @@ -0,0 +1,57 @@ +getHiddenBeforeDateTime(); + + $node->setHiddenBeforeDateTime($dateTime); + } + + public function nodeHiddenAfterDateTime(\Neos\ContentRepository\Domain\Model\Node $node) + { + $dateTime = $node->getHiddenAfterDateTime(); + + $node->setHiddenAfterDateTime($dateTime); + } +} + +----- +getProperty('enableAfterDateTime'); + // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. + // Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime". + + + $node->setHiddenBeforeDateTime($dateTime); + } + + public function nodeHiddenAfterDateTime(\Neos\ContentRepository\Core\Projection\ContentGraph\Node $node) + { + // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. + + $dateTime = $node->getProperty('disableAfterDateTime'); + // TODO 9.0 migration: Timed publishing has been conceptually changed and has been extracted into a dedicated package. Please check https://github.com/neos/timeable-node-visibility for further details. + // Use the "SetNodeProperties" command to change property values for "enableAfterDateTime" or "disableAfterDateTime". + + + $node->setHiddenAfterDateTime($dateTime); + } +} + diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-hidden.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden.php.inc new file mode 100644 index 0000000..5537113 --- /dev/null +++ b/tests/Sets/ContentRepository90/Fixture/Node/node-hidden.php.inc @@ -0,0 +1,39 @@ +isHidden(); + + $node->setHidden(false); + $node->setHidden(true); + } +} + +----- +tags->contain(\Neos\ContentRepository\Core\Feature\SubtreeTagging\Dto\SubtreeTag::disabled()); + // TODO 9.0 migration: !! Node::setHidden() is not supported by the new CR. Use the "EnableNodeAggregate" or "DisableNodeAggregate" command to change the visibility of the node. + + + $node->setHidden(false); + // TODO 9.0 migration: !! Node::setHidden() is not supported by the new CR. Use the "EnableNodeAggregate" or "DisableNodeAggregate" command to change the visibility of the node. + + $node->setHidden(true); + } +} + diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-move.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-move.php.inc new file mode 100644 index 0000000..62b867e --- /dev/null +++ b/tests/Sets/ContentRepository90/Fixture/Node/node-move.php.inc @@ -0,0 +1,39 @@ +moveBefore($otherNode); + $node->moveInto($otherNode); + $node->moveAfter($otherNode); + } +} + +----- +moveBefore($otherNode); + // TODO 9.0 migration: !! Node::moveInto() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node. + + $node->moveInto($otherNode); + // TODO 9.0 migration: !! Node::moveAfter() is not supported by the new CR. Use the "MoveNodeAggregate" command to move a node. + + $node->moveAfter($otherNode); + } +} + diff --git a/tests/Sets/ContentRepository90/Fixture/Node/node-remove.php.inc b/tests/Sets/ContentRepository90/Fixture/Node/node-remove.php.inc new file mode 100644 index 0000000..2acc3bb --- /dev/null +++ b/tests/Sets/ContentRepository90/Fixture/Node/node-remove.php.inc @@ -0,0 +1,35 @@ +remove(); + $node->setRemoved(false); + } +} + +----- +remove(); + // TODO 9.0 migration: !! Node::setRemoved() is not supported by the new CR. Use the "RemoveNodeAggregate" command to remove a node. + + $node->setRemoved(false); + } +} +