/**
  * 表示件数の入力チェック
  * @test
  * @dataProvider displayCountValidateDataProvider
  */
 public function invalidDisplayCountCase($expected, $data, $msg)
 {
     $dto = new DnsUserCriteriaDto();
     EntitySupport::autoSet($dto, $data);
     $errors = $this->validator->validate($dto);
     $this->assertEquals($expected, count($errors), $msg);
 }
예제 #2
0
 /**
  * プロパティの入力チェックを行う
  * @test
  * @dataProvider dataProvider
  */
 public function validateProperty($expected, $data, $msg)
 {
     $dto = new DnsUserExportDto();
     EntitySupport::autoSet($dto, $data);
     $errors = $this->validator->validate($dto);
     $this->assertEquals($expected, count($errors), $msg);
 }
예제 #3
0
 /**
  * @param mixed $value
  * @return \hergot\databroker\DataAdapter\Parameter
  * @throws \InvalidArgumentException
  */
 public function setValue($value)
 {
     if ($this->validator instanceof ValidatorInterface && !$this->validator->isValid($value)) {
         throw new \InvalidArgumentException('Setting value for parameter "' . $this->getName() . '" failed. Validator: "' . get_class($this->validator) . '"');
     }
     $this->value = $value;
     return $this;
 }
예제 #4
0
 /**
  * Deletes asset by ID
  *
  * @param string $id    ID of the asset
  * @return response
  * @throws \Exception
  */
 public function deleteAsset($id)
 {
     $params = array('id' => $id);
     $params = $this->validator->validate($params);
     try {
         return $this->client->sendRequest('assets/{id}', $params, 'DELETE');
     } catch (\Exception $ex) {
         throw $ex;
     }
 }
예제 #5
0
 /**
  * @param ValidatorInterface $validator
  */
 public function add(ValidatorInterface $validator)
 {
     $this->validators[$validator->name()] = $validator;
 }
예제 #6
0
 /**
  * Validate the given subject.
  *
  * @param mixed $subject
  * @return bool
  */
 public function validate($subject) : bool
 {
     return !$this->validator->validate($subject);
 }
예제 #7
0
 /**
  * @return mixed
  */
 public function getValidationErrors()
 {
     return $this->validation->errors();
 }
예제 #8
0
 /**
  * @return array
  */
 public function getParams()
 {
     return $this->validator->getParams();
 }
예제 #9
0
 /**
  * Forward the invocation to the validate method of the validator.
  *
  * @return bool
  */
 public function __invoke(...$args) : bool
 {
     return $this->validator->validate(...$args);
 }
예제 #10
0
 /**
  * @expectedException Chippyash\SDO\Exceptions\SDOException
  * @expectedExceptionMessage No mapper set
  */
 public function testFetchWillThrowExceptionIfMapperNotSet()
 {
     $this->validator->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $sut = $this->getMockForAbstractClass('Chippyash\\SDO\\AbstractSDO', array($this->transport, null, $this->validator));
     $sut->fetch();
 }
예제 #11
0
 /**
  * execute a validator
  * @param mixed $value
  * @param \oat\oatbox\validator\ValidatorInterface $validator
  * @return boolena
  */
 protected function executeTest($value, ValidatorInterface $validator)
 {
     return $validator->evaluate($value);
 }
예제 #12
0
 /**
  * Performs validation.
  *
  * @return bool
  */
 public function validate()
 {
     return $this->validator->validate();
 }