/**
  * Assertion that commodity options are displayed correctly
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser)
 {
     $this->openProductPage($product, $browser);
     // Prepare data
     $formCustomOptions = $catalogProductView->getCustomOptionsBlock()->getOptions($product);
     $actualPrice = $this->isPrice ? $this->getProductPrice($catalogProductView) : null;
     $fixtureCustomOptions = $this->prepareOptions($product, $actualPrice);
     $error = $this->verifyData($fixtureCustomOptions, $formCustomOptions);
     \PHPUnit_Framework_Assert::assertEmpty($error, $error);
 }
Exemplo n.º 2
0
 /**
  * Assert configurable product, corresponds to the product in the cart
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductConfigurable $configurable
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductConfigurable $configurable, Browser $browser, CheckoutCart $checkoutCart)
 {
     //Add product to cart
     $browser->open($_ENV['app_frontend_url'] . $configurable->getUrlKey() . '.html');
     $configurableData = $configurable->getConfigurableAttributesData();
     if (!empty($configurableData)) {
         $configurableOption = $catalogProductView->getCustomOptionsBlock();
         foreach ($configurableData['attributes_data'] as $attribute) {
             $configurableOption->selectProductCustomOption($attribute['title']);
         }
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
     $this->assertOnShoppingCart($configurable, $checkoutCart);
 }
 /**
  * Assert configurable product, corresponds to the product in the cart
  *
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductConfigurable $configurable
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, CatalogProductConfigurable $configurable, CheckoutCart $checkoutCart)
 {
     //Add product to cart
     $catalogProductView->init($configurable);
     $catalogProductView->open();
     $configurableData = $configurable->getConfigurableAttributesData();
     if (!empty($configurableData)) {
         $configurableOption = $catalogProductView->getCustomOptionsBlock();
         foreach ($configurableData['attributes_data'] as $attribute) {
             $configurableOption->selectProductCustomOption(reset($attribute['options'])['name']);
         }
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
     $this->assertOnShoppingCart($configurable, $checkoutCart);
 }
Exemplo n.º 4
0
 /**
  * Assertion that the product is correctly displayed in cart
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param Browser $browser
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, Browser $browser, CheckoutCart $checkoutCart)
 {
     // Add product to cart
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $productOptions = $product->getCustomOptions();
     if ($productOptions) {
         $customOption = $catalogProductView->getCustomOptionsBlock();
         $options = $customOption->getOptions();
         $key = $productOptions[0]['title'];
         $customOption->selectProductCustomOption($options[$key]['title']);
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
     // Check price
     $this->assertOnShoppingCart($product, $checkoutCart);
 }
Exemplo n.º 5
0
 /**
  * Assertion that the product is correctly displayed in cart
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @param CheckoutCart $checkoutCart
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product, CheckoutCart $checkoutCart)
 {
     // Add product to cart
     $catalogProductView->init($product);
     $catalogProductView->open();
     $productOptions = $product->getCustomOptions();
     if ($productOptions) {
         $customOption = $catalogProductView->getCustomOptionsBlock();
         $options = $customOption->getOptions();
         $key = $productOptions[0]['title'];
         $customOption->selectProductCustomOption(reset($options[$key]['value']));
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
     // Check price
     $this->assertOnShoppingCart($product, $checkoutCart);
 }
 /**
  * Assertion that commodity options are displayed correctly
  *
  * @param CatalogProductView $catalogProductView
  * @param FixtureInterface $product
  * @return void
  */
 public function processAssert(CatalogProductView $catalogProductView, FixtureInterface $product)
 {
     $this->product = $product;
     // TODO fix initialization url for frontend page
     // Open product view page
     $catalogProductView->init($this->product);
     $catalogProductView->open();
     // Prepare data
     $customOptions = $catalogProductView->getCustomOptionsBlock()->getOptions();
     foreach ($customOptions as &$option) {
         unset($option['value']);
     }
     unset($option);
     $compareOptions = $this->prepareOptionArray($this->product->getCustomOptions());
     $customOptions = $this->dataSortByKey($customOptions);
     $compareOptions = $this->dataSortByKey($compareOptions);
     \PHPUnit_Framework_Assert::assertEquals($customOptions, $compareOptions, 'Incorrect display of custom product options on the product page.');
 }
Exemplo n.º 7
0
 /**
  * Fill bundle option on frontend add click "Add to cart" button
  *
  * @param CatalogProductBundle $product
  * @param CatalogProductView $catalogProductView
  * @return void
  */
 public function addToCart(CatalogProductBundle $product, CatalogProductView $catalogProductView)
 {
     $fillData = $product->getDataFieldConfig('checkout_data')['source']->getPreset();
     if (isset($fillData['bundle_options'])) {
         $this->fillBundleOptions($fillData['bundle_options']);
     }
     if (isset($fillData['custom_options'])) {
         $catalogProductView->getCustomOptionsBlock()->fillCustomOptions($product, $fillData['custom_options']);
     }
     $catalogProductView->getViewBlock()->clickAddToCart();
 }