/**
  * Get grouped price with fixture product and product page
  *
  * @param View $view
  * @param FixtureInterface $product
  * @return array
  */
 protected function getGroupedPrice(View $view, FixtureInterface $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;
 }
 /**
  * Verify product special price on product view page
  *
  * @param FixtureInterface $product
  * @param View $productViewBlock
  * @return void
  */
 public function assertPrice(FixtureInterface $product, View $productViewBlock)
 {
     $fields = $product->getData();
     $specialPrice = $productViewBlock->getPriceBlock()->getSpecialPrice();
     if (isset($fields['special_price'])) {
         \PHPUnit_Framework_Assert::assertEquals(number_format($fields['special_price'], 2), $specialPrice, $this->errorMessage);
     }
 }
Exemplo n.º 3
0
 /**
  * Verify displayed product special price on product page(front-end) equals passed from fixture
  *
  * @return string|null
  */
 protected function verifySpecialPrice()
 {
     if (!$this->product->hasData('special_price')) {
         return null;
     }
     $fixtureProductSpecialPrice = $this->product->getSpecialPrice();
     $fixtureProductSpecialPrice = number_format($fixtureProductSpecialPrice, 2);
     $formProductSpecialPrice = $this->productView->getPriceBlock()->getSpecialPrice();
     if ($fixtureProductSpecialPrice == $formProductSpecialPrice) {
         return null;
     }
     return "Displayed product special price on product page(front-end) not equals passed from fixture. " . "Actual: {$formProductSpecialPrice}, expected: {$fixtureProductSpecialPrice}.";
 }
 /**
  * Get grouped price with fixture product and product page
  *
  * @param View $view
  * @param FixtureInterface $product
  * @return array
  */
 protected function getGroupedPrice(View $view, FixtureInterface $product)
 {
     $groupPrice = ['onPage' => ['price_regular_price' => $view->getPriceBlock()->getPrice(), 'price_from' => $view->getPriceBlock()->getPriceFrom()], 'fixture' => $product->getDataFieldConfig('price')['source']->getPreset()['price_from']];
     $groupPrice['onPage'] = isset($groupPrice['onPage']['price_regular_price']) ? str_replace('As low as $', '', $groupPrice['onPage']['price_regular_price']) : str_replace('$', '', $groupPrice['onPage']['price_from']);
     return $groupPrice;
 }