コード例 #1
0
 /**
  * Assert tax rule availability in Tax Rate grid
  *
  * @param TaxRateIndex $taxRateIndexPage
  * @param TaxRate $taxRate
  * @param TaxRate $initialTaxRate
  * @return void
  */
 public function processAssert(TaxRateIndex $taxRateIndexPage, TaxRate $taxRate, TaxRate $initialTaxRate = null)
 {
     $data = $initialTaxRate === null ? $taxRate->getData() : array_merge($initialTaxRate->getData(), $taxRate->getData());
     $filter = ['code' => $data['code'], 'tax_country_id' => $data['tax_country_id']];
     $filter['tax_postcode'] = $data['zip_is_range'] === 'No' ? $data['tax_postcode'] : $data['zip_from'] . '-' . $data['zip_to'];
     $taxRateIndexPage->open();
     \PHPUnit_Framework_Assert::assertTrue($taxRateIndexPage->getTaxRateGrid()->isRowVisible($filter), 'Tax Rate \'' . $filter['code'] . '\' is absent in Tax Rate grid.');
 }
コード例 #2
0
 /**
  * Assert that tax rate form filled correctly
  *
  * @param TaxRateIndex $taxRateIndexPage
  * @param TaxRateNew $taxRateNewPage
  * @param TaxRate $taxRate
  * @param TaxRate $initialTaxRate
  * @return void
  */
 public function processAssert(TaxRateIndex $taxRateIndexPage, TaxRateNew $taxRateNewPage, TaxRate $taxRate, TaxRate $initialTaxRate = null)
 {
     $data = $initialTaxRate !== null ? array_merge($initialTaxRate->getData(), $taxRate->getData()) : $taxRate->getData();
     $data = $this->prepareData($data);
     $filter = ['code' => $data['code']];
     $taxRateIndexPage->open();
     $taxRateIndexPage->getTaxRateGrid()->searchAndOpen($filter);
     $formData = $taxRateNewPage->getTaxRateForm()->getData($taxRate);
     $dataDiff = $this->verifyForm($formData, $data);
     \PHPUnit_Framework_Assert::assertTrue(empty($dataDiff), 'Tax Rate form was filled incorrectly.' . "\nLog:\n" . implode(";\n", $dataDiff));
 }
コード例 #3
0
 /**
  * Preparing data for verification
  *
  * @param TaxRate $taxRate
  * @param TaxRate $initialTaxRate
  * @return array
  */
 protected function prepareData(TaxRate $taxRate, TaxRate $initialTaxRate = null)
 {
     if ($initialTaxRate !== null) {
         $data = array_merge($initialTaxRate->getData(), $taxRate->getData());
         if ($taxRate->hasData('tax_country_id') && !$taxRate->hasData('tax_region_id')) {
             unset($data['tax_region_id']);
         }
     } else {
         $data = $taxRate->getData();
     }
     if ($data['zip_is_range'] === 'Yes') {
         unset($data['tax_postcode']);
     } else {
         unset($data['zip_from'], $data['zip_to']);
     }
     $data['rate'] = number_format($data['rate'], 4);
     return $data;
 }
コード例 #4
0
ファイル: Curl.php プロジェクト: kidaa30/magento2-platformsh
 /**
  * Prepare tax rate data.
  *
  * @param TaxRate $taxRate
  * @return array
  */
 public function prepareData(TaxRate $taxRate)
 {
     return $this->replaceMappingData($taxRate->getData());
 }