/**
  * Assert that necessary tax rate is present in "Tax Rule Information" on TaxRuleEdit page.
  *
  * @param TaxRuleIndex $taxRuleIndex
  * @param TaxRuleNew $taxRuleNew
  * @param TaxRate $taxRate
  * @return void
  */
 public function processAssert(TaxRuleIndex $taxRuleIndex, TaxRuleNew $taxRuleNew, TaxRate $taxRate)
 {
     $taxRateCode = $taxRate->getCode();
     $taxRuleIndex->open()->getPageActionsBlock()->addNew();
     $availableTaxRates = $taxRuleNew->getTaxRuleForm()->getAvailableTaxRates();
     \PHPUnit_Framework_Assert::assertTrue(in_array($taxRateCode, $availableTaxRates), "{$taxRateCode} is not present in Tax Rates multiselect on TaxRuleEdit page.");
 }
 /**
  * Test create tax rule.
  *
  * @param TaxRule $taxRule
  * @return void
  */
 public function test(TaxRule $taxRule)
 {
     // Steps
     $this->taxRuleIndexPage->open();
     $this->taxRuleIndexPage->getPageActionsBlock()->addNew();
     $this->taxRuleNewPage->getTaxRuleForm()->fill($taxRule);
     $this->taxRuleNewPage->getFormPageActions()->save();
 }
Exemplo n.º 3
0
 /**
  * Assert that tax rule form filled right.
  *
  * @param TaxRuleNew $taxRuleNew
  * @param TaxRuleIndex $taxRuleIndex
  * @param TaxRule $taxRule
  * @return void
  */
 public function processAssert(TaxRuleNew $taxRuleNew, TaxRuleIndex $taxRuleIndex, TaxRule $taxRule)
 {
     $fixtureData = $taxRule->getData();
     $taxRuleIndex->open();
     $taxRuleIndex->getTaxRuleGrid()->searchAndOpen(['code' => $taxRule->getCode()]);
     $formData = $taxRuleNew->getTaxRuleForm()->getData($taxRule);
     $dataDiff = $this->verifyForm($formData, $fixtureData);
     \PHPUnit_Framework_Assert::assertEmpty($dataDiff, implode($dataDiff));
 }
Exemplo n.º 4
0
 /**
  * Delete all Tax Rules on backend.
  *
  * @return array
  */
 public function run()
 {
     $this->taxRuleIndexPage->open();
     $this->taxRuleIndexPage->getTaxRuleGrid()->resetFilter();
     while ($this->taxRuleIndexPage->getTaxRuleGrid()->isFirstRowVisible()) {
         $this->taxRuleIndexPage->getTaxRuleGrid()->openFirstRow();
         $this->taxRuleNewPage->getFormPageActions()->delete();
     }
 }
Exemplo n.º 5
0
 /**
  * Assert tax rule availability in Tax Rule grid.
  *
  * @param TaxRuleIndex $taxRuleIndex
  * @param TaxRule $taxRule
  * @return void
  */
 public function processAssert(TaxRuleIndex $taxRuleIndex, TaxRule $taxRule)
 {
     $filter = ['code' => $taxRule->getCode()];
     $taxRuleIndex->open();
     \PHPUnit_Framework_Assert::assertTrue($taxRuleIndex->getTaxRuleGrid()->isRowVisible($filter), "Tax Rule '{$filter['code']}' is absent in Tax Rule grid.");
 }
 /**
  * Assert that success message is displayed after tax rule saved.
  *
  * @param TaxRuleIndex $taxRuleIndex
  * @return void
  */
 public function processAssert(TaxRuleIndex $taxRuleIndex)
 {
     \PHPUnit_Framework_Assert::assertEquals(self::SUCCESS_MESSAGE, $taxRuleIndex->getMessagesBlock()->getSuccessMessages());
 }