Neos\FluidAdaptor\Tests\Unit\ViewHelpers\Form\AbstractFormFieldViewHelperTest::setErrorClassAttributeSetsCustomErrorClassIfAnErrorOccurred PHP Метод

setErrorClassAttributeSetsCustomErrorClassIfAnErrorOccurred() публичный Метод

    public function setErrorClassAttributeSetsCustomErrorClassIfAnErrorOccurred()
    {
        $formViewHelper = $this->getAccessibleMock(\Neos\FluidAdaptor\ViewHelpers\Form\AbstractFormFieldViewHelper::class, array('hasArgument', 'getMappingResultsForProperty'), array(), '', false);
        $this->injectDependenciesIntoViewHelper($formViewHelper);
        $formViewHelper->expects($this->at(0))->method('hasArgument')->with('class')->will($this->returnValue(false));
        $formViewHelper->expects($this->at(2))->method('hasArgument')->with('errorClass')->will($this->returnValue(true));
        $formViewHelper->_set('arguments', array('errorClass' => 'custom-error-class'));
        $mockResult = $this->createMock(\Neos\Error\Messages\Result::class);
        $mockResult->expects($this->atLeastOnce())->method('hasErrors')->will($this->returnValue(true));
        $formViewHelper->expects($this->once())->method('getMappingResultsForProperty')->will($this->returnValue($mockResult));
        $this->tagBuilder->expects($this->once())->method('addAttribute')->with('class', 'custom-error-class');
        $formViewHelper->_call('setErrorClassAttribute');
    }
AbstractFormFieldViewHelperTest