/** * Verify displayed product special price on product page(front-end) equals passed from fixture. * * @return string|null */ protected function verifySpecialPrice() { $fixtureProductSpecialPrice = $this->product->getSpecialPrice(); if (!$fixtureProductSpecialPrice) { return null; } $fixtureProductSpecialPrice = number_format($fixtureProductSpecialPrice, 2); $formProductSpecialPrice = $this->productView->getPriceBlock()->getSpecialPrice(); if ($fixtureProductSpecialPrice == $formProductSpecialPrice) { return null; } return "\nDisplayed product special price on product page(front-end) not equals passed from fixture. " . "Actual: {$formProductSpecialPrice}, expected: {$fixtureProductSpecialPrice}."; }
/** * 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); }
/** * 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; }