true() public static method

public static true ( $value, $message = '' )
示例#1
0
 /**
  * {@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;
 }
示例#2
0
 /**
  * {@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;
 }
 /**
  * {@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());
 }
 /**
  * {@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);
     }
 }
 /**
  * {@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;
 }
 /**
  * @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)));
 }
示例#7
0
 /**
  * @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));
 }
 /**
  * @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));
 }
 /**
  * @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));
 }
示例#10
0
 /**
  * @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.');
 }
 /**
  * @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));
 }
 /**
  * @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));
 }
 /**
  * @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.');
 }
示例#14
0
 /**
  * @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()));
 }
 /**
  * @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));
 }
 /**
  * @Then /^there should still be only one taxon with code "([^"]+)"$/
  */
 public function thereShouldStillBeOnlyOneTaxonWithCode($code)
 {
     Assert::true($this->updatePage->hasResourceValues(['code' => $code]), sprintf('Taxon with code %s cannot be found.', $code));
 }
示例#17
0
 /**
  * @param string $productName
  * @param string $productAssociationName
  *
  * @throws \InvalidArgumentException
  */
 private function assertIsProductIsInAssociation($productName, $productAssociationName)
 {
     Assert::true($this->showPage->hasProductInAssociation($productName, $productAssociationName), sprintf('There should be an associated product "%s" under association "%s" but it does not.', $productName, $productAssociationName));
 }
示例#18
0
 /**
  * @param string $message
  * @param string $recipient
  */
 private function assertEmailContainsMessageTo($message, $recipient)
 {
     Assert::true($this->emailChecker->hasMessageTo($message, $recipient), sprintf('Message "%s" was not sent to "%s".', $message, $recipient));
 }
 /**
  * @Then /^(this locale) should be disabled$/
  */
 public function thisLocaleShouldBeDisabled(LocaleInterface $locale)
 {
     Assert::true($this->indexPage->isLocaleDisabled($locale), sprintf('Locale %s should be disabled but it is not', $locale->getCode()));
 }
 /**
  * @param string $element
  * @param string $value
  */
 private function assertElementValue($element, $value)
 {
     Assert::true($this->updatePage->hasResourceValues([$element => $value]), sprintf('Product review should have %s with %s value.', $element, $value));
 }
 /**
  * {@inheritdoc}
  */
 public function getSupportedMethods(BasePaymentInterface $payment)
 {
     Assert::true($this->supports($payment), 'This payment method is not support by resolver');
     return $this->paymentMethodRepository->findEnabledForChannel($payment->getOrder()->getChannel());
 }
 /**
  * @param ZoneInterface $zone
  * @param ZoneMemberInterface $zoneMember
  *
  * @throws \InvalidArgumentException
  */
 private function assertZoneAndItsMember(ZoneInterface $zone, ZoneMemberInterface $zoneMember)
 {
     Assert::true($this->updatePage->hasResourceValues(['code' => $zone->getCode(), 'name' => $zone->getName()]), sprintf('Zone %s is not valid', $zone->getName()));
     Assert::true($this->updatePage->hasMember($zoneMember), sprintf('Zone %s has not %s zone member', $zone->getName(), $zoneMember->getCode()));
 }
示例#23
0
 /**
  * @Then I should be redirected back to PayPal Express Checkout page
  */
 public function iShouldBeRedirectedToPaypalExpressCheckoutPage()
 {
     Assert::true($this->paypalExpressCheckoutPage->isOpen());
 }
示例#24
0
 /**
  * @Then I should not be able to log in as :username authenticated by :password password
  */
 public function iShouldNotBeAbleToLogInAsAuthenticatedByPassword($username, $password)
 {
     $this->logInAgain($username, $password);
     Assert::true($this->loginPage->hasValidationErrorWith('Error Bad credentials.'), 'I should see validation error.');
     Assert::false($this->dashboardPage->isOpen(), 'I should not be able to log in.');
 }
示例#25
0
 /**
  * @param PageInterface $page
  * @param string $element
  * @param string $expectedMessage
  */
 private function assertFieldValidationMessage(PageInterface $page, $element, $expectedMessage)
 {
     Assert::true($page->checkValidationMessageFor($element, $expectedMessage), sprintf('There should be a message: "%s".', $expectedMessage));
 }
 /**
  * @Then there should still be only one tax category with :element :code
  */
 public function thereShouldStillBeOnlyOneTaxCategoryWith($element, $code)
 {
     $this->indexPage->open();
     Assert::true($this->indexPage->isSingleResourceOnPage([$element => $code]), sprintf('Tax category with %s %s cannot be found.', $element, $code));
 }
 /**
  * @Then this administrator with name :username should appear in the store
  * @Then there should still be only one administrator with name :username
  */
 public function thisAdministratorWithNameShouldAppearInTheStore($username)
 {
     $this->indexPage->open();
     Assert::true($this->indexPage->isSingleResourceOnPage(['username' => $username]), sprintf('Administrator with %s username does not exist', $username));
 }
示例#28
0
 /**
  * @Then I should not have a default address
  */
 public function iShouldHaveNoDefaultAddress()
 {
     Assert::true($this->addressBookIndexPage->hasNoDefaultAddress(), 'There should be no default address.');
 }
示例#29
0
 /**
  * @Then I should see :provinceName ad province in the billing address
  */
 public function iShouldSeeAdProvinceInTheBillingAddress($provinceName)
 {
     Assert::true($this->showPage->hasBillingProvinceName($provinceName), sprintf('Cannot find shipping address with province %s', $provinceName));
 }
 /**
  * @Then I should see that the :productVariantName variant has :quantity quantity on hand
  */
 public function iShouldSeeThatTheProductVariantHasQuantityOnHand($productVariantName, $quantity)
 {
     Assert::true($this->indexPage->isSingleResourceOnPage(['name' => $productVariantName, 'inventory' => sprintf('%s Available on hand', $quantity)]), sprintf('This "%s" variant should have %s on hand quantity, but it does not.', $productVariantName, $quantity));
 }