/**
  * Assert tax rule availability in Tax Rate grid.
  *
  * @param TaxRateIndex $taxRateIndexPage
  * @param TaxRate $taxRate
  * @return void
  */
 public function processAssert(TaxRateIndex $taxRateIndexPage, TaxRate $taxRate)
 {
     $data = $taxRate->getData();
     $filter = ['code' => $data['code'], 'tax_country_id' => $data['tax_country_id'], 'tax_postcode' => $data['zip_is_range'] === 'No' ? $data['tax_postcode'] : $data['zip_from'] . '-' . $data['zip_to']];
     $taxRateIndexPage->open();
     \PHPUnit_Framework_Assert::assertTrue($taxRateIndexPage->getTaxRatesGrid()->isRowVisible($filter), "Tax Rate {$filter['code']} is absent in Tax Rate grid.");
 }
 /**
  * Assert that necessary tax rate percent is in correct range between 0 and 100.
  *
  * @param TaxRateIndex $taxRateIndex
  * @param TaxRateEdit $taxRateEdit
  * @param TaxRate $taxRate
  * @return void
  */
 public function processAssert(TaxRateIndex $taxRateIndex, TaxRateEdit $taxRateEdit, TaxRate $taxRate)
 {
     $taxRateCode = $taxRate->getCode();
     $taxRateIndex->open()->getTaxRatesGrid()->searchAndOpen(['code' => $taxRateCode]);
     $ratePercentage = $taxRateEdit->getTaxRateForm()->getTaxRatePercentage();
     \PHPUnit_Framework_Assert::assertTrue($ratePercentage >= 0 && $ratePercentage <= 100, "{$taxRateCode} rate percent {$ratePercentage} is not in correct range between 0 and 100.");
 }
 /**
  * Assert that tax rate form filled correctly.
  *
  * @param TaxRateIndex $taxRateIndex
  * @param TaxRateNew $taxRateNew
  * @param TaxRate $taxRate
  * @return void
  */
 public function processAssert(TaxRateIndex $taxRateIndex, TaxRateNew $taxRateNew, TaxRate $taxRate)
 {
     $data = $this->prepareData($taxRate->getData());
     $taxRateIndex->open()->getTaxRatesGrid()->searchAndOpen(['code' => $data['code']]);
     $formData = $taxRateNew->getTaxRateForm()->getData($taxRate);
     $errors = $this->verifyData($data, $formData);
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
 /**
  * Create Tax Rate Entity test.
  *
  * @param TaxRate $taxRate
  * @return void
  */
 public function test(TaxRate $taxRate)
 {
     // Steps:
     $this->taxRateIndexPage->open();
     $this->taxRateIndexPage->getPageActionsBlock()->addNew();
     $this->taxRateNewPage->getTaxRateForm()->fill($taxRate);
     $this->taxRateNewPage->getFormPageActions()->save();
 }
 /**
  * Delete Tax Rate Entity test.
  *
  * @param TaxRate $taxRate
  * @return void
  */
 public function testDeleteTaxRate(TaxRate $taxRate)
 {
     // Precondition
     $taxRate->persist();
     // Steps
     $this->taxRateIndex->open();
     $this->taxRateIndex->getTaxRatesGrid()->searchAndOpen(['code' => $taxRate->getCode()]);
     $this->taxRateEdit->getFormPageActions()->deleteAndAcceptAlert();
 }
 /**
  * Assert that tax rate is absent in Tax Rate grid.
  *
  * @param TaxRateIndex $taxRateIndex
  * @param TaxRate $taxRate
  * @return void
  */
 public function processAssert(TaxRateIndex $taxRateIndex, TaxRate $taxRate)
 {
     $filter = ['code' => $taxRate->getCode()];
     $taxRateIndex->open();
     \PHPUnit_Framework_Assert::assertFalse($taxRateIndex->getTaxRatesGrid()->isRowVisible($filter), 'Tax Rate \'' . $filter['code'] . '\' is present in Tax Rate grid.');
 }
 /**
  * Assert that success message is displayed after tax rate saved.
  *
  * @param TaxRateIndex $taxRateIndexPage
  * @return void
  */
 public function processAssert(TaxRateIndex $taxRateIndexPage)
 {
     \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $taxRateIndexPage->getMessagesBlock()->getSuccessMessages());
 }