Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CreateCurrencyRateTest.php
Go to the documentation of this file.
1 <?php
8 
11 use Magento\Mtf\TestCase\Injectable;
12 use Magento\Directory\Test\Fixture\CurrencyRate;
13 use Magento\CurrencySymbol\Test\Page\Adminhtml\SystemCurrencyIndex;
14 use Magento\Mtf\TestStep\TestStepFactory;
15 
31 class CreateCurrencyRateTest extends Injectable
32 {
33  /* tags */
34  const TEST_TYPE = 'acceptance_test, extended_acceptance_test';
35  const SEVERITY = 'S1';
36  /* end tags */
37 
43  protected $currencyIndexPage;
44 
50  private $stepFactory;
51 
58  public function __inject(SystemCurrencyIndex $currencyIndexPage, TestStepFactory $stepFactory)
59  {
60  $this->currencyIndexPage = $currencyIndexPage;
61  $this->stepFactory = $stepFactory;
62  }
63 
73  public function test(CurrencyRate $currencyRate, ConfigData $config, $product, array $productData = [])
74  {
75  // Preconditions:
76  $product = $this->stepFactory
77  ->create(CreateProductsStep::class, ['products' => [$product], 'data' => $productData])
78  ->run()['products'][0];
79  $config->persist();
80 
81  // Steps:
82  $this->currencyIndexPage->open();
83  $this->currencyIndexPage->getCurrencyRateForm()->fill($currencyRate);
84  $this->currencyIndexPage->getFormPageActions()->save();
85 
86  return ['product' => $product];
87  }
88 
94  public function tearDown()
95  {
96  $this->objectManager->create(
97  \Magento\Config\Test\TestStep\SetupConfigurationStep::class,
98  ['configData' => 'config_currency_symbols_usd']
99  )->run();
100  }
101 }
__inject(SystemCurrencyIndex $currencyIndexPage, TestStepFactory $stepFactory)
$config
Definition: fraud_order.php:17
test(CurrencyRate $currencyRate, ConfigData $config, $product, array $productData=[])
$productData