setValidator() 공개 메소드

Sets a custom validator which is used supplementary to the base validation
public setValidator ( Neos\Flow\Validation\Validator\ValidatorInterface $validator ) : Argument
$validator Neos\Flow\Validation\Validator\ValidatorInterface The actual validator object
리턴 Argument Returns $this (used for fluent interface)
예제 #1
0
파일: ArgumentTest.php 프로젝트: neos/flow
 /**
  * @test
  */
 public function setValueShouldSetValidationErrorsIfValidatorIsSetAndValidationFailed()
 {
     $error = new FLowError\Error('Some Error', 1234);
     $mockValidator = $this->createMock(ValidatorInterface::class);
     $validationMessages = new FLowError\Result();
     $validationMessages->addError($error);
     $mockValidator->expects($this->once())->method('validate')->with('convertedValue')->will($this->returnValue($validationMessages));
     $this->simpleValueArgument->setValidator($mockValidator);
     $this->setupPropertyMapperAndSetValue();
     $this->assertEquals([$error], $this->simpleValueArgument->getValidationResults()->getErrors());
 }