/** * 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 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."); }
/** * 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 tax rate is absent in tax rule form. * * @param TaxRate $taxRate * @param TaxRuleNew $taxRuleNew * @return void */ public function processAssert(TaxRate $taxRate, TaxRuleNew $taxRuleNew) { $taxRuleNew->open(); $taxCode = $taxRate->getCode(); \PHPUnit_Framework_Assert::assertFalse($taxRuleNew->getTaxRuleForm()->isTaxRateAvailable($taxCode), "Tax Rate '{$taxCode}' is present in Tax Rule form."); }