Iterates through selected errors of the request.
public render ( string $for = '', string $as = 'validationResults' ) : string | ||
$for | string | The name of the error name (e.g. argument name or property name). This can also be a property path (like blog.title), and will then only display the validation errors of that property. |
$as | string | The name of the variable to store the current error |
리턴 | string | Rendered string |
/** * @test */ public function renderAddsValidationResultsForOnePropertyIfForArgumentIsNotEmpty() { $mockPropertyValidationResults = $this->getMockBuilder(\Neos\Error\Messages\Result::class)->getMock(); $mockValidationResults = $this->getMockBuilder(\Neos\Error\Messages\Result::class)->getMock(); $mockValidationResults->expects($this->once())->method('forProperty')->with('somePropertyName')->will($this->returnValue($mockPropertyValidationResults)); $this->request->expects($this->atLeastOnce())->method('getInternalArgument')->with('__submittedArgumentValidationResults')->will($this->returnValue($mockValidationResults)); $this->templateVariableContainer->expects($this->at(0))->method('add')->with('validationResults', $mockPropertyValidationResults); $this->viewHelper->expects($this->once())->method('renderChildren'); $this->templateVariableContainer->expects($this->at(1))->method('remove')->with('validationResults'); $this->viewHelper->render('somePropertyName'); }