public function iShouldBeAbleToCreateAChildNodeOfType($not, $nodeTypeName)
{
if ($this->isolated === true) {
$this->callStepInSubProcess(__METHOD__, sprintf(' %s %s %s %s', 'string', escapeshellarg(trim($not)), 'integer', escapeshellarg($nodeTypeName)));
} else {
$currentNode = $this->iShouldHaveOneNode();
$nodeType = $this->getObjectManager()->get(\Neos\ContentRepository\Domain\Service\NodeTypeManager::class)->getNodeType($nodeTypeName);
if (empty($not)) {
// ALLOWED to create node
Assert::assertTrue($currentNode->isNodeTypeAllowedAsChildNode($nodeType), 'isNodeTypeAllowed returned the wrong value');
// thus, the following line should not throw an exception
$currentNode->createNode(uniqid('custom-node'), $nodeType);
} else {
// FORBIDDEN to create node
Assert::assertFalse($currentNode->isNodeTypeAllowedAsChildNode($nodeType), 'isNodeTypeAllowed returned the wrong value');
// thus, the following line should throw an exception
try {
$currentNode->createNode(uniqid('custom-node'), $nodeType);
Assert::fail('It was possible to create a custom node, although it should have been prevented');
} catch (\Neos\ContentRepository\Exception\NodeConstraintException $nodeConstraintExceptio) {
// Expected exception
}
}
}
}