コード例 #1
0
ファイル: ProductContext.php プロジェクト: sylius/sylius
 /**
  * @Then I should be on :product product detailed page
  * @Then I should still be on product :product page
  */
 public function iShouldBeOnProductDetailedPage(ProductInterface $product)
 {
     Assert::true($this->showPage->isOpen(['slug' => $product->getSlug()]), sprintf('Product %s show page should be open, but it does not.', $product->getName()));
 }
コード例 #2
0
ファイル: CompletePage.php プロジェクト: ReissClothing/Sylius
 /**
  * @param ProductInterface $product
  *
  * @return NodeElement
  */
 private function getProductRowElement(ProductInterface $product)
 {
     return $this->getElement('product_row', ['%name%' => $product->getName()]);
 }
コード例 #3
0
 /**
  * @Then /^(this product) should no longer have price for channel "([^"]+)"$/
  */
 public function thisProductShouldNoLongerHavePriceForChannel(ProductInterface $product, $channelName)
 {
     $this->updateSimpleProductPage->open(['id' => $product->getId()]);
     try {
         $this->updateSimpleProductPage->getPriceForChannel($channelName);
     } catch (ElementNotFoundException $exception) {
         return;
     }
     throw new \Exception(sprintf('Product "%s" should not have price defined for channel "%s".', $product->getName(), $channelName));
 }
コード例 #4
0
 /**
  * @Then /^(product "[^"]+") should not have a "([^"]+)" attribute$/
  */
 public function productShouldNotHaveAttribute(ProductInterface $product, $attribute)
 {
     $this->updateSimpleProductPage->open(['id' => $product->getId()]);
     Assert::false($this->updateSimpleProductPage->hasAttribute($attribute), sprintf('Product "%s" should not have attribute "%s" but it does.', $product->getName(), $attribute));
 }
コード例 #5
0
ファイル: SummaryPage.php プロジェクト: origammi/Sylius
 /**
  * {@inheritdoc]
  */
 public function hasProductOutOfStockValidationMessage(ProductInterface $product)
 {
     $message = sprintf('%s does not have sufficient stock.', $product->getName());
     try {
         return $this->getElement('validation_errors')->getText() === $message;
     } catch (ElementNotFoundException $exception) {
         return false;
     }
 }
コード例 #6
0
 /**
  * @Then /^there should be no reviews of (this product)$/
  */
 public function thereAreNoProductReviews(ProductInterface $product)
 {
     $this->productReviewIndexPage->open();
     Assert::false($this->productReviewIndexPage->isSingleResourceOnPage(['reviewSubject' => $product->getName()]), sprintf('There should be no reviews of %s.', $product->getName()));
 }
コード例 #7
0
ファイル: CartContext.php プロジェクト: rpg600/Sylius
 /**
  * @Given /^(product "[^"]+") price should not be decreased$/
  */
 public function productPriceShouldNotBeDecreased(ProductInterface $product)
 {
     $this->cartSummaryPage->open();
     expect($this->cartSummaryPage->isItemDiscounted($product->getName()))->toBe(false);
 }
コード例 #8
0
ファイル: CartContextSpec.php プロジェクト: ahmadrabie/Sylius
 function it_throws_exception_if_discount_price_is_present_on_the_page_but_should_not(CartSummaryPageInterface $cartSummaryPage, ProductInterface $product)
 {
     $cartSummaryPage->open()->shouldBeCalled();
     $product->getName()->willReturn('Test product');
     $cartSummaryPage->isItemDiscounted('Test product')->willReturn(true);
     $this->shouldThrow(new FailureException('Expected <value>false</value>, but got <value>true</value>.'))->during('productPriceShouldNotBeDecreased', [$product]);
 }
コード例 #9
0
 /**
  * @Given /^(this product) is available in "([^"]+)" ([^"]+) priced at ("[^"]+")$/
  */
 public function thisProductIsAvailableInSize(ProductInterface $product, $optionValueName, $optionName, $price)
 {
     /** @var ProductVariantInterface $variant */
     $variant = $this->productVariantFactory->createNew();
     $optionValue = $this->sharedStorage->get(sprintf('%s_option_%s_value', $optionValueName, $optionName));
     $variant->addOptionValue($optionValue);
     $variant->addChannelPricing($this->createChannelPricingForChannel($price, $this->sharedStorage->get('channel')));
     $variant->setCode(sprintf("%s_%s", $product->getCode(), $optionValueName));
     $variant->setName($product->getName());
     $product->addVariant($variant);
     $this->objectManager->flush();
 }