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


PHP ExecutionContextInterface::expects方法代码示例

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


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

示例1: testValidate

 public function testValidate()
 {
     $this->repository->expects($this->once())->method('findDuplicate')->with($this->lineItem)->will($this->returnValue(true));
     $this->registry->expects($this->once())->method('getRepository')->with(self::LINE_ITEM_SHORTCUT)->will($this->returnValue($this->repository));
     $this->context->expects($this->once())->method('addViolation')->with($this->constraint->message);
     $validator = new LineItemValidator($this->registry);
     $validator->initialize($this->context);
     $validator->validate($this->lineItem, $this->constraint);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:9,代码来源:LineItemValidatorTest.php

示例2: testValidate

 /**
  * @dataProvider validateDataProvider
  * @param mixed $data
  * @param boolean $correct
  */
 public function testValidate($data, $correct)
 {
     if (!$correct) {
         $this->context->expects($this->once())->method('addViolation')->with($this->constraint->message);
     } else {
         $this->context->expects($this->never())->method('addViolation');
     }
     $this->validator->validate($data, $this->constraint);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:14,代码来源:LettersTest.php

示例3: testValidate

 /**
  * @param mixed $data
  * @param bool  $expected
  *
  * @dataProvider validateDataProvider
  */
 public function testValidate($data, $expected)
 {
     $constraint = new ExtensionLoaded();
     $this->context = $this->getMock('Symfony\\Component\\Validator\\ExecutionContextInterface');
     if ($expected) {
         $this->validator->initialize($this->context);
         $this->context->expects($this->once())->method('addViolation')->with($this->isType('string'));
     }
     $this->validator->validate($data, $constraint);
 }
开发者ID:Maksold,项目名称:platform,代码行数:16,代码来源:ExtensionLoadedValidatorTest.php

示例4: testValidateNotExistingProduct

 public function testValidateNotExistingProduct()
 {
     $price = $this->getProductPrice();
     // Set null to product and productSku
     $class = new \ReflectionClass($price);
     $product = $class->getProperty('product');
     $product->setAccessible(true);
     $product->setValue($price, null);
     $productSku = $class->getProperty('productSku');
     $productSku->setAccessible(true);
     $productSku->setValue($price, null);
     $this->context->expects($this->once())->method('addViolationAt')->with('product', $this->constraint->notExistingProductMessage);
     $this->validator->validate($price, $this->constraint);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:14,代码来源:ProductPriceAllowedUnitsTest.php

示例5: testNoViolationsOnUniqueUserProperty

 public function testNoViolationsOnUniqueUserProperty()
 {
     $this->ldapManagerMock->expects($this->once())->method('findUserByUsername')->will($this->returnValue(null))->with($this->equalTo($this->user->getUsername()));
     $this->validatorContext->expects($this->never())->method('addViolation');
     $this->validator->validate($this->user, $this->constraint);
 }
开发者ID:Mapaxe,项目名称:FR3DLdapBundle,代码行数:6,代码来源:UniqueValidatorTest.php

示例6: expectValidateValueAt

 protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group)
 {
     $this->context->expects($this->at($i))->method('validateValue')->with($value, $constraints, $propertyPath, $group);
 }
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:4,代码来源:AbstractConstraintValidatorTest.php

示例7: testValidate

 /**
  * @param mixed $data
  * @param boolean $valid
  * @dataProvider validateProvider
  */
 public function testValidate($data, $valid)
 {
     $this->context->expects($valid ? $this->never() : $this->once())->method('addViolationAt')->with('productUnit', $this->constraint->message);
     $this->validator->validate($data, $this->constraint);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:10,代码来源:QuoteProductOfferValidatorTest.php

示例8: testWithoutPrice

 public function testWithoutPrice()
 {
     $productPrice = new ProductPrice();
     $this->context->expects($this->never())->method('addViolationAt');
     $this->validator->validate($productPrice, $this->constraint);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:6,代码来源:ProductPriceCurrencyTest.php

示例9: testValidateWithDuplications

 public function testValidateWithDuplications()
 {
     $this->context->expects($this->once())->method('addViolation')->with($this->constraint->message);
     $data = new ArrayCollection([$this->createPriceList(1, 10, 'kg', 'USD'), $this->createPriceList(1, 10, 'kg', 'USD')]);
     $this->validator->validate($data, $this->constraint);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:6,代码来源:UniqueProductPricesTest.php

示例10: testValidate

 /**
  * @param $options
  * @param $value
  * @param $violation
  *
  * @dataProvider validateDataProvider
  */
 public function testValidate($options, $value, $violation)
 {
     $this->context->expects($violation ? $this->once() : $this->never())->method('addViolation');
     $constraint = new Decimal($options);
     $this->validator->validate($value, $constraint);
 }
开发者ID:Maksold,项目名称:platform,代码行数:13,代码来源:DecimalValidatorTest.php

示例11: testValidate

 /**
  * @param boolean $isValid
  * @param mixed $inputData
  * @dataProvider validateProvider
  */
 public function testValidate($isValid, $inputData)
 {
     $this->context->expects($isValid ? $this->never() : $this->once())->method('addViolationAt')->with('currency', $this->constraint->message);
     $this->validator->validate($inputData, $this->constraint);
 }
开发者ID:hafeez3000,项目名称:orocommerce,代码行数:10,代码来源:OptionalPriceValidatorTest.php


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