Example #1
0
 /**
  * Get giftCard discount price.
  *
  * @param GiftCardAccountFixture $giftCardAccount
  * @return string|null
  */
 public function getGiftCardDiscount(GiftCardAccountFixture $giftCardAccount)
 {
     $selector = sprintf($this->giftCardDiscount, $giftCardAccount->getCode());
     return $this->escapeCurrency($this->_rootElement->find($selector, Locator::SELECTOR_XPATH)->getText());
 }
 /**
  * Assert that success apply gift card message is displayed on shopping cart page.
  *
  * @param CheckoutCart $checkoutCart
  * @param GiftCardAccount $giftCardAccount
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, GiftCardAccount $giftCardAccount)
 {
     \PHPUnit_Framework_Assert::assertEquals(sprintf(self::SUCCESS_APPLY_MESSAGE, $giftCardAccount->getCode()), $checkoutCart->getMessagesBlock()->getSuccessMessages(), 'Wrong success message is displayed.');
 }
 /**
  * Add GiftCard in ShoppingCart.
  *
  * @param Customer $customerFixture
  * @param GiftCardAccount $giftCardAccount
  * @param BrowserInterface $browser
  * @param string $product
  * @param string|null $customer
  * @return array
  */
 public function test(Customer $customerFixture, GiftCardAccount $giftCardAccount, BrowserInterface $browser, $product, $customer = null)
 {
     // Preconditions
     $product = $this->createProduct($product);
     // Steps
     if ($customer !== null) {
         $this->loginCustomer($customerFixture);
     }
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $this->catalogProductView->getViewBlock()->addToCart($product);
     $this->checkoutCart->getGiftCardAccountBlock()->addGiftCard($giftCardAccount->getCode());
     return ['giftCardAccount' => $giftCardAccount];
 }