コード例 #1
0
 /**
  * Delete Tax Rule Entity test.
  *
  * @param TaxRule $taxRule
  * @return void
  */
 public function testDeleteTaxRule(TaxRule $taxRule)
 {
     // Precondition
     $taxRule->persist();
     // Steps
     $this->taxRuleIndexPage->open();
     $this->taxRuleIndexPage->getTaxRuleGrid()->searchAndOpen(['code' => $taxRule->getCode()]);
     $this->taxRuleNewPage->getFormPageActions()->delete();
 }
コード例 #2
0
 /**
  * Update Tax Rule Entity test.
  *
  * @param TaxRule $initialTaxRule
  * @param TaxRule $taxRule
  * @return void
  */
 public function testUpdateTaxRule(TaxRule $initialTaxRule, TaxRule $taxRule)
 {
     // Precondition
     $initialTaxRule->persist();
     // Steps
     $this->taxRuleIndexPage->open();
     $this->taxRuleIndexPage->getTaxRuleGrid()->searchAndOpen(['code' => $initialTaxRule->getCode()]);
     $this->taxRuleNewPage->getTaxRuleForm()->fill($taxRule);
     $this->taxRuleNewPage->getFormPageActions()->save();
 }
コード例 #3
0
 /**
  * Automatic Apply Tax Based on VAT ID.
  *
  * @param ConfigData $vatConfig
  * @param OrderInjectable $order
  * @param TaxRule $taxRule
  * @param Cart $cart
  * @param string $configData
  * @param string $customerGroup
  * @return array
  */
 public function test(ConfigData $vatConfig, OrderInjectable $order, TaxRule $taxRule, Cart $cart, $configData, $customerGroup)
 {
     // Preconditions
     $this->configData = $configData;
     $this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $this->configData])->run();
     $taxRule->persist();
     // Prepare data
     $this->customer = $order->getDataFieldConfig('customer_id')['source']->getCustomer();
     $address = $this->customer->getDataFieldConfig('address')['source']->getAddresses()[0];
     $this->prepareVatConfig($vatConfig, $customerGroup);
     $poducts = $order->getEntityId()['products'];
     $cart = $this->fixtureFactory->createByCode('cart', ['data' => array_merge($cart->getData(), ['items' => ['products' => $poducts]])]);
     // Steps
     $order->persist();
     $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $this->customer])->run();
     $this->objectManager->create('Magento\\Checkout\\Test\\TestStep\\AddProductsToTheCartStep', $order->getEntityId())->run();
     $this->checkoutCart->open();
     $this->checkoutCart->getCartBlock()->waitCartContainerLoading();
     $this->checkoutCart->getShippingBlock()->fillEstimateShippingAndTax($address);
     $this->checkoutCart->getCartBlock()->waitCartContainerLoading();
     return ['customer' => $this->customer, 'address' => $address, 'orderId' => $order->getId(), 'cart' => $cart, 'products' => $poducts];
 }
コード例 #4
0
 /**
  * Update Tax Rule Entity test
  *
  * @param TaxRule $initialTaxRule
  * @param TaxRule $taxRule
  * @param AddressInjectable $address
  * @param array $shipping
  * @return void
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function testUpdateTaxRule(TaxRule $initialTaxRule, TaxRule $taxRule, AddressInjectable $address, array $shipping)
 {
     // Precondition
     $initialTaxRule->persist();
     // Steps
     $filters = ['code' => $initialTaxRule->getCode()];
     $this->taxRuleIndexPage->open();
     $this->taxRuleIndexPage->getTaxRuleGrid()->searchAndOpen($filters);
     $this->taxRuleNewPage->getTaxRuleForm()->fill($taxRule);
     $this->taxRuleNewPage->getFormPageActions()->save();
 }
コード例 #5
0
 /**
  * Create tax report entity.
  *
  * @param OrderInjectable $order
  * @param TaxRule $taxRule
  * @param array $report
  * @param string $orderSteps
  * @return void
  */
 public function test(OrderInjectable $order, TaxRule $taxRule, array $report, $orderSteps)
 {
     // Precondition
     $taxRule->persist();
     $this->taxRule = $taxRule;
     $order->persist();
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $this->processOrder($orderSteps, $order);
     $this->reportStatistic->open();
     $this->reportStatistic->getGridBlock()->massaction([['report' => 'Tax']], 'Refresh Statistics for the Last Day', true);
     // Steps
     $this->salesTaxReport->open();
     $this->salesTaxReport->getFilterBlock()->viewsReport($report);
     $this->salesTaxReport->getActionBlock()->showReport();
 }