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


PHP Assert::true方法代码示例

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


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

示例1: createForPromotion

 /**
  * {@inheritdoc}
  */
 public function createForPromotion(PromotionInterface $promotion)
 {
     Assert::true($promotion->isCouponBased(), sprintf('Promotion with name %s is not coupon based.', $promotion->getName()));
     $coupon = $this->factory->createNew();
     $coupon->setPromotion($promotion);
     return $coupon;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:CouponFactory.php

示例2: createForPromotion

 /**
  * {@inheritdoc}
  */
 public function createForPromotion($promotionId)
 {
     /** @var PromotionInterface $promotion */
     Assert::notNull($promotion = $this->promotionRepository->find($promotionId), sprintf('Promotion with id %s does not exist.', $promotionId));
     Assert::true($promotion->isCouponBased(), sprintf('Promotion with name %s is not coupon based.', $promotion->getName()));
     $coupon = $this->factory->createNew();
     $coupon->setPromotion($promotion);
     return $coupon;
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:12,代码来源:CouponFactory.php

示例3: getSupportedMethods

 /**
  * {@inheritdoc}
  */
 public function getSupportedMethods(ShippingSubjectInterface $subject)
 {
     /** @var ShipmentInterface $subject */
     Assert::true($this->supports($subject));
     /** @var OrderInterface $order */
     $order = $subject->getOrder();
     $zones = $this->zoneMatcher->matchAll($order->getShippingAddress());
     if (empty($zones)) {
         return [];
     }
     return $this->shippingMethodRepository->findEnabledForZonesAndChannel($zones, $order->getChannel());
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:15,代码来源:ZoneAndChannelBasedShippingMethodsResolver.php

示例4: generate

 /**
  * {@inheritdoc}
  */
 public function generate(ProductInterface $product)
 {
     Assert::true($product->hasOptions(), 'Cannot generate variants for an object without options.');
     $optionSet = [];
     $optionMap = [];
     foreach ($product->getOptions() as $key => $option) {
         foreach ($option->getValues() as $value) {
             $optionSet[$key][] = $value->getId();
             $optionMap[$value->getId()] = $value;
         }
     }
     $permutations = $this->setBuilder->build($optionSet);
     foreach ($permutations as $permutation) {
         $variant = $this->createVariant($product, $optionMap, $permutation);
         $product->addVariant($variant);
     }
 }
开发者ID:loic425,项目名称:Sylius,代码行数:20,代码来源:ProductVariantGenerator.php

示例5: getSupportedMethods

 /**
  * {@inheritdoc}
  */
 public function getSupportedMethods(ShippingSubjectInterface $subject)
 {
     /** @var ShipmentInterface $subject */
     Assert::true($this->supports($subject));
     /** @var OrderInterface $order */
     $order = $subject->getOrder();
     $zones = $this->zoneMatcher->matchAll($order->getShippingAddress());
     if (empty($zones)) {
         return [];
     }
     $methods = [];
     $shippingMethods = $this->shippingMethodRepository->findEnabledForZonesAndChannel($zones, $order->getChannel());
     foreach ($shippingMethods as $shippingMethod) {
         if ($this->eligibilityChecker->isEligible($subject, $shippingMethod)) {
             $methods[] = $shippingMethod;
         }
     }
     return $methods;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:22,代码来源:ZoneAndChannelBasedShippingMethodsResolver.php

示例6: assertIfFieldIsTrue

 /**
  * @param PromotionInterface $promotion
  * @param string $field
  */
 private function assertIfFieldIsTrue(PromotionInterface $promotion, $field)
 {
     $this->iWantToModifyAPromotion($promotion);
     Assert::true($this->updatePage->hasResourceValues([$field => 1]), sprintf('Promotion %s is not %s, but it should be.', $promotion->getName(), str_replace('_', ' ', $field)));
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:9,代码来源:ManagingPromotionsContext.php

示例7: assertElementValidationMessage

 /**
  * @param string $type
  * @param string $element
  * @param string $expectedMessage
  *
  * @throws \InvalidArgumentException
  */
 private function assertElementValidationMessage($type, $element, $expectedMessage)
 {
     $element = sprintf('%s_%s', $type, implode('_', explode(' ', $element)));
     Assert::true($this->addressPage->checkValidationMessageFor($element, $expectedMessage), sprintf('The %s should be required.', $element));
 }
开发者ID:starspire,项目名称:Sylius,代码行数:12,代码来源:CheckoutContext.php

示例8: thisProvinceShouldStillBeNamed

 /**
  * @Then /^the province should still be named "([^"]*)" in (this country)$/
  */
 public function thisProvinceShouldStillBeNamed($provinceName, CountryInterface $country)
 {
     $this->updatePage->open(['id' => $country->getId()]);
     Assert::true($this->updatePage->isThereProvince($provinceName), sprintf('%s is not a province of this country.', $provinceName));
 }
开发者ID:sylius,项目名称:sylius,代码行数:8,代码来源:ManagingCountriesContext.php

示例9: assertFieldValidationMessage

 /**
  * @param string $element
  * @param string $expectedMessage
  */
 private function assertFieldValidationMessage($element, $expectedMessage)
 {
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm($this->createPage, $this->updatePage);
     Assert::true($currentPage->checkValidationMessageFor($element, $expectedMessage), sprintf('Tax rate %s should be required.', $element));
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:9,代码来源:ManagingTaxRateContext.php

示例10: iShouldBeNotifiedThatProvinceCodeMustBeUnique

 /**
  * @Then /^I should be notified that province code must be unique$/
  */
 public function iShouldBeNotifiedThatProvinceCodeMustBeUnique()
 {
     Assert::true($this->updatePage->checkValidationMessageFor('code', 'Province code must be unique.'), 'Unique code violation message should appear on page, but it does not.');
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:7,代码来源:ManagingCountriesContext.php

示例11: thisChannelNameShouldBe

 /**
  * @Then /^(this customer group) should still be named "([^"]+)"$/
  */
 public function thisChannelNameShouldBe(CustomerGroupInterface $customerGroup, $customerGroupName)
 {
     $this->iWantToBrowseCustomerGroupsOfTheStore();
     Assert::true($this->indexPage->isSingleResourceOnPage(['name' => $customerGroup->getName()]), sprintf('Customer group name %s has not been assigned properly.', $customerGroupName));
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:8,代码来源:ManagingCustomerGroupsContext.php

示例12: iShouldBeNotifiedThatIsRequired

 /**
  * @Then I should be notified that :element is required
  */
 public function iShouldBeNotifiedThatIsRequired($element)
 {
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm($this->createPage, $this->updatePage);
     Assert::true($currentPage->checkValidationMessageFor($element, sprintf('Please enter tax category %s.', $element)), sprintf('Tax category %s should be required.', $element));
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:8,代码来源:ManagingTaxCategoryContext.php

示例13: iShouldBeNotifiedThatGeneratingCouponsWithCodeLengthIsNotPossible

 /**
  * @Then /^I should be notified that generating (\d+) coupons with code length equal to (\d+) is not possible$/
  */
 public function iShouldBeNotifiedThatGeneratingCouponsWithCodeLengthIsNotPossible($amount, $codeLength)
 {
     $message = sprintf('Invalid coupons code length or coupons amount. It is not possible to generate %d unique coupons with code length equals %d. Possible generate amount is 8.', $amount, $codeLength);
     Assert::true($this->generatePage->checkGenerationValidation($message), 'Generate violation message should appear on page, but it does not.');
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:8,代码来源:ManagingPromotionCouponsContext.php

示例14: iShouldBeNotifiedThatThisProductDoesNotHaveSufficientStock

 /**
  * @Then /^I should be notified that (this product) cannot be updated$/
  */
 public function iShouldBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product)
 {
     Assert::true($this->summaryPage->hasProductOutOfStockValidationMessage($product), sprintf('I should see validation message for %s product', $product->getName()));
 }
开发者ID:sylius,项目名称:sylius,代码行数:7,代码来源:CartContext.php

示例15: thisProductOptionShouldHaveTheOptionValue

 /**
  * @Then /^(this product option) should have the "([^"]*)" option value$/
  */
 public function thisProductOptionShouldHaveTheOptionValue(ProductOptionInterface $productOption, $optionValue)
 {
     $this->iWantToModifyAProductOption($productOption);
     Assert::true($this->updatePage->isThereOptionValue($optionValue), sprintf('%s is not a value of this product option.', $optionValue));
 }
开发者ID:sylius,项目名称:sylius,代码行数:8,代码来源:ManagingProductOptionsContext.php


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