/**
  * Assert that gift card account present in grid.
  *
  * @param GiftCardAccount $giftCardAccount
  * @param GiftCardAccountIndex $giftCardAccountIndex
  * @param string $code
  * @return void
  */
 public function processAssert(GiftCardAccount $giftCardAccount, GiftCardAccountIndex $giftCardAccountIndex, $code)
 {
     $giftCardAccountIndex->open();
     $dateExpires = $giftCardAccount->hasData('date_expires') ? date("M j, Y", strtotime($giftCardAccount->getDateExpires())) : '--';
     $balance = $giftCardAccount->getBalance();
     \PHPUnit_Framework_Assert::assertTrue($giftCardAccountIndex->getGiftCardAccountGrid()->isRowVisible(['code' => $code], false), "Gift card with balance = '{$balance}', '{$code}' and expiration date = '{$dateExpires}' is absent in " . "gift card account grid.");
 }
 /**
  * Assert that displayed gift card account data on edit page equals passed from fixture.
  *
  * @param GiftCardAccount $giftCardAccount
  * @param GiftCardAccountNew $giftCardAccountNew
  * @param GiftCardAccountIndex $giftCardAccountIndex
  * @param string $code
  * @return void
  */
 public function processAssert(GiftCardAccount $giftCardAccount, GiftCardAccountNew $giftCardAccountNew, GiftCardAccountIndex $giftCardAccountIndex, $code)
 {
     $giftCardAccountIndex->open();
     $giftCardAccountIndex->getGiftCardAccountGrid()->searchAndOpen(['code' => $code], false);
     $formData = $giftCardAccountNew->getGiftCardAccountForm()->getData();
     $dataDiff = $this->verifyData($giftCardAccount->getData(), $formData);
     \PHPUnit_Framework_Assert::assertEmpty($dataDiff, "Gift card account form data does not equal to passed from fixture. \n" . $dataDiff);
 }
 /**
  * Create gift card account.
  *
  * @param GiftCardAccount $giftCardAccount
  * @return array
  */
 public function test(GiftCardAccount $giftCardAccount)
 {
     // Steps
     $this->giftCardAccountIndex->open();
     $this->giftCardAccountIndex->getMessagesBlock()->clickLinkInMessages('error', 'here');
     $this->giftCardAccountIndex->getGridPageActions()->addNew();
     $this->giftCardAccountNew->getGiftCardAccountForm()->fill($giftCardAccount);
     $this->giftCardAccountNew->getFormPageActions()->save();
     $code = $this->giftCardAccountIndex->getGiftCardAccountGrid()->getCode(['balance' => $giftCardAccount->getBalance()], false);
     return ['code' => $code];
 }
 /**
  * Assert that success message is displayed after gift card account save.
  *
  * @param GiftCardAccountIndex $giftCardAccountIndex
  * @return void
  */
 public function processAssert(GiftCardAccountIndex $giftCardAccountIndex)
 {
     \PHPUnit_Framework_Assert::assertEquals($giftCardAccountIndex->getMessagesBlock()->getSuccessMessages(), self::SUCCESS_MESSAGE);
 }