/** * Verify product tier price on product view page * * @param FixtureInterface $product * @param View $productViewBlock * @return void */ public function assertPrice(FixtureInterface $product, View $productViewBlock) { $noError = true; $match = []; $index = 1; $tierPrices = $product->getTierPrice(); foreach ($tierPrices as $tierPrice) { $text = $productViewBlock->getTierPrices($index++); $noError = (bool) preg_match('#^[^\\d]+(\\d+)[^\\d]+(\\d+(?:(?:,\\d+)*)+(?:.\\d+)*).*#i', $text, $match); if (!$noError) { break; } if (count($match) < 2 && $match[1] != $tierPrice['price_qty'] || $match[2] !== number_format($tierPrice['price'], $this->priceFormat)) { $noError = false; break; } } \PHPUnit_Framework_Assert::assertTrue($noError, $this->errorMessage); }