/** * @test * @author Sebastian Kurfürst <*****@*****.**> */ public function setValueShouldSetValidationErrorsIfValidatorIsSetAndValidationFailed() { $error = new \TYPO3\CMS\Extbase\Error\Error('Some Error', 1234); $mockValidator = $this->getMock('TYPO3\\CMS\\Extbase\\Validation\\Validator\\ValidatorInterface', array('validate', 'getOptions')); $validationMessages = new \TYPO3\CMS\Extbase\Error\Result(); $validationMessages->addError($error); $mockValidator->expects($this->once())->method('validate')->with('convertedValue')->will($this->returnValue($validationMessages)); $this->simpleValueArgument->setValidator($mockValidator); $this->setupPropertyMapperAndSetValue(); $this->assertFalse($this->simpleValueArgument->isValid()); $this->assertEquals(array($error), $this->simpleValueArgument->getValidationResults()->getErrors()); }