Author: Łukasz Chruściel (lukasz.chrusciel@lakion.com)
Author: Anna Walasek (anna.walasek@lakion.com)
Inheritance: extends Sylius\Behat\Page\PageInterface
Ejemplo n.º 1
0
 /**
  * @return NodeElement[]
  *
  * @throws \InvalidArgumentException
  */
 private function getProductAttributes()
 {
     $attributes = $this->showPage->getAttributes();
     Assert::notNull($attributes, 'The product has no attributes.');
     return $attributes;
 }
Ejemplo n.º 2
0
 /**
  * @Then I should see the product attribute :attributeName with value :AttributeValue
  */
 public function iShouldSeeTheProductAttributeWithValue($attributeName, $AttributeValue)
 {
     Assert::true($this->showPage->hasAttributeWithValue($attributeName, $AttributeValue), sprintf('Product should have attribute %s with value %s, but it does not.', $attributeName, $AttributeValue));
 }
Ejemplo n.º 3
0
 /**
  * @Given I have :product with :productOption :productOptionValue in the cart
  * @When I add :product with :productOption :productOptionValue to the cart
  */
 public function iAddThisProductWithToTheCart(ProductInterface $product, ProductOptionInterface $productOption, $productOptionValue)
 {
     $this->productShowPage->open(['slug' => $product->getSlug()]);
     $this->productShowPage->addToCartWithOption($productOption, $productOptionValue);
 }
Ejemplo n.º 4
0
 /**
  * @Then I should see a main image
  */
 public function iShouldSeeAMainImage()
 {
     Assert::true($this->showPage->isMainImageDisplayed(), 'The main image should have been displayed.');
 }
Ejemplo n.º 5
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));
 }
Ejemplo n.º 6
0
 /**
  * @Given I have :quantity products :product in the cart
  * @When I add :quantity products :product to the cart
  */
 public function iAddProductsToTheCart(ProductInterface $product, $quantity)
 {
     $this->productShowPage->open(['product' => $product]);
     $this->productShowPage->addToCartWithQuantity($quantity);
     $this->sharedStorage->set('product', $product);
 }
Ejemplo n.º 7
0
 /**
  * @Then /^I should not be notified that (this product) does not have sufficient stock$/
  */
 public function iShouldNotBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product)
 {
     Assert::false($this->showPage->hasProductOutOfStockValidationMessage($product), sprintf('I should see validation message for %s product', $product->getName()));
 }
Ejemplo n.º 8
0
 /**
  * @Then I should see the product price :price
  */
 public function iShouldSeeTheProductPrice($price)
 {
     Assert::same($price, $this->showPage->getPrice(), 'Product should have price %2$s, but it has %s');
 }
Ejemplo n.º 9
0
 /**
  * @Then I should not be able to access product :product
  */
 public function iShouldNotBeAbleToAccessProduct(ProductInterface $product)
 {
     $this->productShowPage->tryToOpen(['product' => $product]);
     expect($this->productShowPage->isOpen(['product' => $product]))->toBe(false);
 }
Ejemplo n.º 10
0
 function it_throws_an_exception_if_i_am_able_to_access_product_page_when_i_should_not(ShowPageInterface $productShowPage, ProductInterface $product)
 {
     $productShowPage->tryToOpen(['product' => $product])->shouldBeCalled();
     $productShowPage->isOpen(['product' => $product])->willReturn(true);
     $this->shouldThrow(NotEqualException::class)->during('iShouldNotBeAbleToAccessProduct', [$product]);
 }