/**
  * Verify displayed product short description on product page(front-end) equals passed from fixture.
  *
  * @return string|null
  */
 protected function verifyShortDescription()
 {
     $fixtureProductShortDescription = $this->product->getShortDescription();
     $formProductShortDescription = $this->productView->getProductShortDescription();
     if ($fixtureProductShortDescription == $formProductShortDescription) {
         return null;
     }
     return "Displayed product short description on product page(front-end) not equals passed from fixture. " . "Actual: {$formProductShortDescription}, expected: {$fixtureProductShortDescription}.";
 }
 /**
  * Verify product tier price on product view page.
  *
  * @param InjectableFixture $product
  * @param View $productViewBlock
  * @return void
  */
 public function assertPrice(InjectableFixture $product, View $productViewBlock)
 {
     $errors = [];
     $tierPrices = $this->prepareTierPrices($product);
     foreach ($tierPrices as $key => $tierPrice) {
         $formTierPrice = $productViewBlock->getTierPrices($key + 1);
         preg_match($this->pattern, $formTierPrice, $match);
         $errors = $this->verifyItemTierPrice($tierPrice, $match);
     }
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  * Return product options.
  *
  * @param InjectableFixture $product [optional]
  * @return array
  */
 public function getOptions(InjectableFixture $product = null)
 {
     $options = ['configurable_options' => $this->getConfigurableOptionsBlock()->getOptions($product)];
     $options += parent::getOptions($product);
     return $options;
 }
Ejemplo n.º 4
0
 /**
  * Return product options.
  *
  * @param InjectableFixture $product [optional]
  * @return array
  */
 public function getOptions(InjectableFixture $product = null)
 {
     $options['bundle_options'] = $this->getBundleBlock()->getOptions($product);
     $options += parent::getOptions($product);
     return $options;
 }
Ejemplo n.º 5
0
 /**
  * Add product to shopping cart.
  *
  * @param InjectableFixture $product
  * @return void
  */
 public function fillOptions(InjectableFixture $product)
 {
     $this->getGiftCardForm()->fill($product);
     parent::fillOptions($product);
 }
 /**
  * Verify product special price on product view page.
  *
  * @param InjectableFixture $product
  * @param View $productViewBlock
  * @return void
  */
 public function assertPrice(InjectableFixture $product, View $productViewBlock)
 {
     \PHPUnit_Framework_Assert::assertEquals(number_format($product->getSpecialPrice(), 2), $productViewBlock->getPriceBlock()->getSpecialPrice(), $this->errorMessage);
 }
Ejemplo n.º 7
0
 /**
  * Return product options.
  *
  * @param InjectableFixture $product
  * @return array
  */
 public function getOptions(InjectableFixture $product)
 {
     $downloadableOptions = [];
     if ($this->_rootElement->find($this->blockDownloadableLinks)->isVisible()) {
         $downloadableOptions['downloadable_links'] = ['title' => $this->getDownloadableLinksBlock()->getTitle(), 'downloadable' => ['link' => $this->getDownloadableLinksBlock()->getLinks()]];
     }
     if ($this->_rootElement->find($this->blockDownloadableSamples)->isVisible()) {
         $downloadableOptions['downloadable_sample'] = ['title' => $this->getDownloadableSamplesBlock()->getTitle(), 'downloadable' => ['sample' => $this->getDownloadableSamplesBlock()->getLinks()]];
     }
     return ['downloadable_options' => $downloadableOptions] + parent::getOptions($product);
 }
 /**
  * Get grouped price with fixture product and product page.
  *
  * @param View $view
  * @param InjectableFixture $product
  * @return array
  */
 protected function getGroupedPrice(View $view, InjectableFixture $product)
 {
     $fields = $product->getData();
     $groupPrice['onPage'] = $view->getPriceBlock()->getSpecialPrice();
     $groupPrice['fixture'] = number_format($fields['group_price'][array_search($this->customerGroup, $fields['group_price'])]['price'], 2);
     return $groupPrice;
 }