public function render($for = null)
{
/** @var $request ActionRequest */
$request = $this->controllerContext->getRequest();
/** @var $validationResults Result */
$validationResults = $request->getInternalArgument('__submittedArgumentValidationResults');
if ($validationResults !== null) {
// if $for is not set, ->forProperty will return the initial Result object untouched
$validationResults = $validationResults->forProperty($for);
if ($validationResults->hasErrors()) {
return $this->renderThenChild();
}
}
return $this->renderElseChild();
}
/** * @test */ public function queriesResultForPropertyIfPropertyPathIsGiven() { $resultMock = $this->createMock(\Neos\Error\Messages\Result::class); $resultMock->expects($this->once())->method('forProperty')->with('foo.bar.baz')->will($this->returnValue(new Result())); /** @var $requestMock \PHPUnit_Framework_MockObject_MockObject */ $requestMock = $this->request; $requestMock->expects($this->once())->method('getInternalArgument')->with('__submittedArgumentValidationResults')->will($this->returnValue($resultMock)); $this->viewHelper->render('foo.bar.baz'); }