Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UpdateTaxRuleEntityTest.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Tax\Test\Page\Adminhtml\TaxRuleIndex;
11 use Magento\Tax\Test\Page\Adminhtml\TaxRuleNew;
12 use Magento\Mtf\Fixture\FixtureFactory;
13 use Magento\Mtf\TestCase\Injectable;
14 
31 class UpdateTaxRuleEntityTest extends Injectable
32 {
33  /* tags */
34  const MVP = 'yes';
35  /* end tags */
36 
42  protected $taxRuleIndexPage;
43 
49  protected $taxRuleNewPage;
50 
57  public function __prepare(FixtureFactory $fixtureFactory)
58  {
59  $customer = $fixtureFactory->createByCode('customer', ['dataset' => 'johndoe_retailer']);
60  $customer->persist();
61 
62  return ['customer' => $customer];
63  }
64 
72  public function __inject(TaxRuleIndex $taxRuleIndexPage, TaxRuleNew $taxRuleNewPage)
73  {
74  $this->taxRuleIndexPage = $taxRuleIndexPage;
75  $this->taxRuleNewPage = $taxRuleNewPage;
76  }
77 
85  public function testUpdateTaxRule(
86  TaxRule $initialTaxRule,
87  TaxRule $taxRule
88  ) {
89  // Precondition
90  $initialTaxRule->persist();
91 
92  // Steps
93  $this->taxRuleIndexPage->open();
94  $this->taxRuleIndexPage->getTaxRuleGrid()->searchAndOpen(['code' => $initialTaxRule->getCode()]);
95  $this->taxRuleNewPage->getTaxRuleForm()->fill($taxRule);
96  $this->taxRuleNewPage->getFormPageActions()->save();
97  }
98 
104  public function tearDown()
105  {
106  $this->objectManager->create(\Magento\Tax\Test\TestStep\DeleteAllTaxRulesStep::class, [])->run();
107  }
108 }
$customer
Definition: customers.php:11
__inject(TaxRuleIndex $taxRuleIndexPage, TaxRuleNew $taxRuleNewPage)
$taxRule
Definition: tax_rule.php:35
testUpdateTaxRule(TaxRule $initialTaxRule, TaxRule $taxRule)