/** * @Then /^(its|theirs) price should be decreased by ("[^"]+")$/ * @Then /^(product "[^"]+") price should be decreased by ("[^"]+")$/ */ public function itsPriceShouldBeDecreasedBy(ProductInterface $product, $amount) { $this->cartSummaryPage->open(); $discountPrice = $this->getPriceFromString($this->cartSummaryPage->getItemDiscountPrice($product->getName())); $regularPrice = $this->getPriceFromString($this->cartSummaryPage->getItemRegularPrice($product->getName())); expect($discountPrice)->toBe($regularPrice - $amount); }
function it_throws_not_equal_exception_if_cart_item_discount_is_incorrect(CartSummaryPageInterface $cartSummaryPage, ProductInterface $product) { $cartSummaryPage->open()->shouldBeCalled(); $product->getName()->willReturn('Test product'); $cartSummaryPage->getItemDiscountPrice('Test product')->willReturn('€30.00'); $cartSummaryPage->getItemRegularPrice('Test product')->willReturn('€50.00'); $this->shouldThrow(NotEqualException::class)->during('itsPriceShouldBeDecreasedBy', [$product, 1000]); }