當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。