/** * 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 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."); }
/** * 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); }
/** * 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."); }