Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigureSecureUrlsTest.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\TestCase\Injectable;
10 use Magento\Mtf\Fixture\FixtureFactory;
11 use Magento\Backend\Test\Page\Adminhtml\SystemConfigEdit;
14 
56 class ConfigureSecureUrlsTest extends Injectable
57 {
58  /* tags */
59  const MVP = 'no';
60  const SEVERITY = 'S1';
61  /* end tags */
62 
68  protected $fixtureFactory;
69 
76 
82  protected $cache;
83 
89  protected $staticContent;
90 
98  public function __inject(
99  FixtureFactory $fixtureFactory,
100  SystemConfigEdit $configurationAdminPage
101  ) {
102  $this->fixtureFactory = $fixtureFactory;
103  $this->configurationAdminPage = $configurationAdminPage;
104  }
105 
112  public function test($configData)
113  {
114  $data = [
115  'web/secure/base_url' => [
116  'scope' => 'default',
117  'scope_id' => 0,
118  'value' => str_replace(['http', 'index.php/'], ['https', ''], $_ENV['app_frontend_url'])
119  ]
120  ];
121  $config = $this->fixtureFactory->createByCode('configData', ['dataset' => $configData, 'data' => $data]);
122  $config->persist();
123 
124  // Workaround until MTA-3879 is delivered.
125  $this->configurationAdminPage->open();
126  $this->configurationAdminPage->getForm()
127  ->getGroup('web', 'secure')
128  ->setValue('web', 'secure', 'use_in_adminhtml', 'Yes');
129  $this->configurationAdminPage->getPageActions()->save();
130  $_ENV['app_backend_url'] = str_replace('http', 'https', $_ENV['app_backend_url']);
131 
132  $this->configurationAdminPage = $this->objectManager->create(
133  \Magento\Backend\Test\Page\Adminhtml\SystemConfigEdit::class
134  );
135 
136  $this->cache = $this->objectManager->create(\Magento\Mtf\Util\Command\Cli\Cache::class);
137  $this->cache->flush(['config', 'full_page']);
138 
139  $this->staticContent = $this->objectManager->create(\Magento\Mtf\Util\Command\Cli\StaticContent::class);
140  $this->staticContent->deploy();
141  }
142 
148  public function tearDown()
149  {
150  $this->configurationAdminPage->open();
151  $this->configurationAdminPage->getForm()
152  ->getGroup('web', 'secure')
153  ->setValue('web', 'secure', 'use_in_adminhtml', 'No');
154  $this->configurationAdminPage->getPageActions()->save();
155  $this->cache->flush(['config', 'full_page']);
156  $this->staticContent->deploy();
157  }
158 }
__inject(FixtureFactory $fixtureFactory, SystemConfigEdit $configurationAdminPage)
$config
Definition: fraud_order.php:17