/**
* @param string $expectedResult
* @param string $nodeName
* @param string $nodeTypeName
* @throws NodeTypeNotFoundException
* @Given /^I should get (TRUE|FALSE) when asking the node authorization service if creating a new "([^"]*)" child node of type "([^"]*)" is granted$/
*/
public function iShouldGetFalseWhenAskingTheNodeAuthorizationServiceIfCreatingAChildNodeOfTypeIsGranted($expectedResult, $nodeName, $nodeTypeName)
{
if ($this->isolated === true) {
$this->callStepInSubProcess(__METHOD__, sprintf(' %s %s %s %s %s %s', 'string', escapeshellarg(trim($expectedResult)), 'string', escapeshellarg($nodeName), 'string', escapeshellarg($nodeTypeName)));
} else {
/** @var NodeTypeManager $nodeTypeManager */
$nodeTypeManager = $this->getObjectManager()->get(\Neos\ContentRepository\Domain\Service\NodeTypeManager::class);
$nodeType = $nodeTypeManager->getNodeType($nodeTypeName);
if ($expectedResult === 'TRUE') {
if ($this->nodeAuthorizationService->isGrantedToCreateNode($this->currentNodes[0], $nodeType) !== true) {
Assert::fail('The node authorization service did not return TRUE!');
}
} else {
if ($this->nodeAuthorizationService->isGrantedToCreateNode($this->currentNodes[0], $nodeType) !== false) {
Assert::fail('The node authorization service did not return FALSE!');
}
}
}
}