当前位置: 首页>>代码示例>>PHP>>正文


PHP ConstraintViolationList::__toString方法代码示例

本文整理汇总了PHP中Symfony\Component\Validator\ConstraintViolationList::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP ConstraintViolationList::__toString方法的具体用法?PHP ConstraintViolationList::__toString怎么用?PHP ConstraintViolationList::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Validator\ConstraintViolationList的用法示例。


在下文中一共展示了ConstraintViolationList::__toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 function it_throws_exception_on_validation_failure(MethodInterface $method, ValidatorInterface $validator, ConstraintViolationList $violations)
 {
     $attributes = ['field' => 'value'];
     $constraints = ['constraints'];
     $method->getValidationConstraints()->shouldBeCalled()->willReturn($constraints);
     $method->getAttributes()->shouldBeCalled()->willReturn($attributes);
     $violations->count()->willReturn(1);
     $violations->__toString()->willReturn('');
     $validator->validate($attributes, $constraints)->willReturn($violations);
     $this->shouldThrow('Cardinity\\Exception\\InvalidAttributeValue')->duringValidate($method);
 }
开发者ID:web3d,项目名称:mincart,代码行数:11,代码来源:ValidatorSpec.php

示例2: isValidRedirectUrl

 /**
  * Checks whether the given value is a valid URL that may probably be safely used as a redirect url.
  *
  * @param string $value URL to validate
  *
  * @return boolean true if the url is correct
  */
 protected function isValidRedirectUrl($value)
 {
     $validator = Validation::createValidator();
     $constraints = array(new Constraints\Type(array('type' => 'string')), new Constraints\Length(array('min' => $this->getParameter('min_length', 10), 'max' => $this->getParameter('max_length', 1000))), new Constraints\Url(array('protocols' => $this->getParameter('allowed_protocols', array('http', 'https')))));
     if ($this->getParameter('check_base_href', true)) {
         $constraints[] = new Constraints\Callback(array('methods' => array(array($this, 'hasCorrectBaseHref'))));
     }
     $violations = new ConstraintViolationList();
     foreach ($constraints as $constraint) {
         $violations->addAll($validator->validateValue($value, $constraint));
     }
     if ($violations->count() === 0) {
         return true;
     } else {
         $this->getContext()->getLoggerManager()->logTo('default', \AgaviLogger::WARNING, __METHOD__, $violations->__toString());
         return false;
     }
 }
开发者ID:honeybee,项目名称:honeybee-agavi-cmf-vendor,代码行数:25,代码来源:RedirectValidator.php

示例3: let

 function let(ConstraintViolationList $violations)
 {
     $violations->__toString()->willReturn($this->violation);
     $this->beConstructedWith('Message', $violations);
 }
开发者ID:web3d,项目名称:mincart,代码行数:5,代码来源:InvalidAttributeValueSpec.php


注:本文中的Symfony\Component\Validator\ConstraintViolationList::__toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。