コード例 #1
0
ファイル: TaxRuleTest.php プロジェクト: aiesh/magento2
 /**
  * Assert existing tax rule on manage tax rule grid
  *
  * @param TaxRule $fixture
  */
 protected function _assertOnGrid(TaxRule $fixture)
 {
     //Data
     $filter = ['code' => $fixture->getCode(), 'tax_rate' => implode(', ', $fixture->getTaxRate())];
     if ($fixture->getTaxCustomerClass() !== null) {
         $filter['tax_customer_class'] = implode(', ', $fixture->getTaxCustomerClass());
     }
     if ($fixture->getTaxProductClass() !== null) {
         $filter['tax_product_class'] = implode(', ', $fixture->getTaxProductClass());
     }
     //Verification
     $taxGridPage = Factory::getPageFactory()->getTaxRuleIndex();
     $taxGridPage->open();
     $this->assertTrue($taxGridPage->getTaxRuleGrid()->isRowVisible($filter), 'New tax rule was not found.');
 }
コード例 #2
0
ファイル: Form.php プロジェクト: andrewhowdencom/m2onk8s
 /**
  * Method to add new tax rate.
  *
  * @param TaxRule $taxRule
  * @return void
  */
 protected function addNewTaxRates($taxRule)
 {
     $rootForm = $this;
     $taxRateMultiSelectList = $this->taxRateMultiSelectList;
     $taxRateDefaultMultiSelect = $this->taxRateDefaultMultiSelect;
     $this->browser->waitUntil(function () use($rootForm, $taxRateDefaultMultiSelect) {
         $element = $rootForm->browser->find($taxRateDefaultMultiSelect);
         return $element->isVisible() ? null : true;
     });
     $this->browser->waitUntil(function () use($rootForm, $taxRateMultiSelectList) {
         $element = $rootForm->browser->find($taxRateMultiSelectList);
         return $element->isVisible() ? true : null;
     });
     $taxRateBlock = $this->_rootElement->find($this->taxRateBlock, Locator::SELECTOR_CSS, 'multiselectlist');
     /** @var \Magento\Tax\Test\Block\Adminhtml\Rule\Edit\TaxRate $taxRateForm */
     $taxRateForm = $this->blockFactory->create('Magento\\Tax\\Test\\Block\\Adminhtml\\Rule\\Edit\\TaxRate', ['element' => $this->browser->find($this->taxRateForm)]);
     /** @var \Magento\Tax\Test\Fixture\TaxRule\TaxRate $taxRatesFixture */
     $taxRatesFixture = $taxRule->getDataFieldConfig('tax_rate')['source'];
     $taxRatesFixture = $taxRatesFixture->getFixture();
     $taxRatesData = $taxRule->getTaxRate();
     foreach ($taxRatesData as $key => $taxRate) {
         $option = $taxRateBlock->find(sprintf($this->optionMaskElement, $taxRate), Locator::SELECTOR_XPATH);
         if (!$option->isVisible()) {
             $taxRate = $taxRatesFixture[$key];
             $this->clickAddNewButton($taxRateBlock);
             $taxRateForm->fill($taxRate);
             $taxRateForm->saveTaxRate();
             /** @var \Magento\Tax\Test\Fixture\TaxRate $taxRate */
             $code = $taxRate->getCode();
             $this->waitUntilOptionIsVisible($taxRateBlock, $code);
         }
     }
 }
コード例 #3
0
 /**
  * Assert sales info in report: Tax, Rate, Orders, Tax Amount on tax report page
  *
  * @param SalesTaxReport $salesTaxReport
  * @param OrderInjectable $order
  * @param TaxRule $taxRule
  * @param string $taxAmount
  * @return void
  */
 public function processAssert(SalesTaxReport $salesTaxReport, OrderInjectable $order, TaxRule $taxRule, $taxAmount)
 {
     $filter = ['tax' => $taxRule->getTaxRate()[0], 'rate' => $taxRule->getDataFieldConfig('tax_rate')['source']->getFixture()[0]->getRate(), 'orders' => count($order->getEntityId()['products']), 'tax_amount' => $taxAmount];
     \PHPUnit_Framework_Assert::assertTrue($salesTaxReport->getGridBlock()->isRowVisible($filter, false), "Tax Report is not visible in grid on tax report page.");
 }