/**
  * {@inheritdoc}
  * 
  * @throws \LogicException
  */
 public function getCurrentPageWithForm(array $pages, ProductInterface $product = null)
 {
     $resolvedPage = $this->currentPageResolver->getCurrentPageWithForm($pages);
     if (!$resolvedPage instanceof UpdatePageInterface) {
         return $resolvedPage;
     }
     Assert::notNull($product, 'It is not possible to determine a product edit page without product provided.');
     if ($product->isSimple()) {
         $resolvedPage = $this->getSimplePage($pages);
     } else {
         $resolvedPage = $this->getConfigurablePage($pages);
     }
     Assert::notNull($resolvedPage, 'Route name could not be matched to provided pages.');
     return $resolvedPage;
 }
Пример #2
0
 /**
  * @return SymfonyPageInterface
  */
 private function getCurrentPage()
 {
     return $this->currentPageResolver->getCurrentPageWithForm([$this->addressBookCreatePage, $this->addressBookUpdatePage]);
 }
 function it_throws_an_exception_if_product_page_could_not_be_matched(ProductInterface $product, CurrentPageResolverInterface $currentPageResolver, UpdateConfigurableProductPageInterface $configurableUpdatePage)
 {
     $product->isSimple()->willReturn(true);
     $currentPageResolver->getCurrentPageWithForm([$configurableUpdatePage])->willReturn($configurableUpdatePage);
     $this->shouldThrow(new \InvalidArgumentException('Route name could not be matched to provided pages.'))->during('getCurrentPageWithForm', [[$configurableUpdatePage], $product]);
 }
 /**
  * @Then I should be notified that coupon usage limit must be at least one
  */
 public function iShouldBeNotifiedThatCouponUsageLimitMustBeAtLeast()
 {
     /** @var CreatePageInterface|UpdatePageInterface $currentPage */
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     Assert::same($currentPage->getValidationMessage('usage_limit'), 'Coupon usage limit must be at least 1.');
 }
 /**
  * @When I add the :value option value identified by :code
  */
 public function iAddTheOptionValueWithCodeAndValue($value, $code)
 {
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     $currentPage->addOptionValue($code, $value);
 }
Пример #6
0
 /**
  * @When I attach the :path image with a code :code
  */
 public function iAttachImageWithACode($path, $code)
 {
     /** @var CreatePageInterface|UpdatePageInterface $currentPage */
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     $currentPage->attachImageWithCode($code, $path);
 }
Пример #7
0
 /**
  * @When I select the :paymentMethodName payment method
  */
 public function iSelectThePaymentMethod($paymentMethodName)
 {
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     $currentPage->choosePaymentMethod($paymentMethodName);
 }
Пример #8
0
 /**
  * @return SymfonyPageInterface
  */
 private function resolveCurrentStepPage()
 {
     $possiblePages = [$this->addressPage, $this->selectPaymentPage, $this->selectShippingPage];
     return $this->currentPageResolver->getCurrentPageWithForm($possiblePages);
 }
Пример #9
0
 /**
  * @Then I should be notified that exchange rate is required
  */
 public function iShouldBeNotifiedThatExchangeRateIsRequired()
 {
     /** @var CreatePageInterface|UpdatePageInterface $currentPage */
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     Assert::same($currentPage->getValidationMessage('exchangeRate'), 'Please enter exchange rate.');
 }
Пример #10
0
 /**
  * @Then this customer should have :groupName as their group
  */
 public function thisCustomerShouldHaveAsTheirGroup($groupName)
 {
     /** @var UpdatePageInterface|ShowPageInterface $currentPage */
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->updatePage, $this->showPage]);
     Assert::same($groupName, $currentPage->getGroupName(), sprintf('Customer should have %s as group, but it does not.', $groupName));
 }
 /**
  * @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('Product attribute %s should be required.', $element));
 }
Пример #12
0
 /**
  * @return SymfonyPageInterface
  */
 private function resolveCurrentPage()
 {
     return $this->currentPageResolver->getCurrentPageWithForm([$this->indexPage, $this->indexPerTaxonPage, $this->createSimpleProductPage, $this->createConfigurableProductPage, $this->updateSimpleProductPage, $this->updateConfigurableProductPage]);
 }
 /**
  * @Then I should be notified that coupon usage limit must be at least one
  */
 public function iShouldBeNotifiedThatCouponUsageLimitMustBeAtLeast()
 {
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     Assert::true($currentPage->checkValidationMessageFor('usage_limit', 'Coupon usage limit must be at least 1.'), 'Min usage limit violation message should appear on page, but it did not.');
 }
 /**
  * @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));
 }
Пример #15
0
 /**
  * @Then I should be notified that :element is required
  */
 public function iShouldBeNotifiedThatIsRequired($element)
 {
     /** @var CreatePageInterface|UpdatePageInterface $currentPage */
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     Assert::same($currentPage->getValidationMessage($element), sprintf('Please enter taxon %s.', $element));
 }
Пример #16
0
 /**
  * @When I add the :provinceName province with :provinceCode code
  * @When I add the :provinceName province with :provinceCode code and :provinceAbbreviation abbreviation
  */
 public function iAddProvinceWithCode($provinceName, $provinceCode, $provinceAbbreviation = null)
 {
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     $currentPage->addProvince($provinceName, $provinceCode, $provinceAbbreviation);
 }
 /**
  * @When I select the :taxCalculationStrategy as tax calculation strategy
  */
 public function iSelectTaxCalculationStrategy($taxCalculationStrategy)
 {
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     $currentPage->chooseTaxCalculationStrategy($taxCalculationStrategy);
 }
 /**
  * @param string $element
  * @param string $expectedMessage
  */
 private function assertFieldValidationMessage($element, $expectedMessage)
 {
     /** @var CreatePageInterface|UpdatePageInterface $currentPage */
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     Assert::same($currentPage->getValidationMessage($element), $expectedMessage);
 }
Пример #19
0
 /**
  * @Then I should be notified that exchange rate is required
  */
 public function iShouldBeNotifiedThatExchangeRateIsRequired()
 {
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     Assert::true($currentPage->checkValidationMessageFor('exchangeRate', 'Please enter exchange rate.'), 'Currency exchange rate should be required.');
 }