Skip to content

Commit 78296ef

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-65339' into MAGETWO-65339
2 parents d18cc7b + 0068910 commit 78296ef

File tree

6 files changed

+53
-22
lines changed

6 files changed

+53
-22
lines changed

dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(CurlTransport $transport)
4141
* @param array $options [optional]
4242
* @return void
4343
*/
44-
protected function execute($command, $options = [])
44+
public function execute($command, $options = [])
4545
{
4646
$curl = $this->transport;
4747
$curl->write($this->prepareUrl($command, $options), [], CurlInterface::GET);
@@ -53,10 +53,10 @@ protected function execute($command, $options = [])
5353
* Prepare url.
5454
*
5555
* @param string $command
56-
* @param array $options
56+
* @param array $options [optional]
5757
* @return string
5858
*/
59-
private function prepareUrl($command, array $options)
59+
private function prepareUrl($command, $options = [])
6060
{
6161
$command .= ' ' . implode(' ', $options);
6262
return $_ENV['app_frontend_url'] . self::URL . '?command=' . urlencode($command);

dev/tests/functional/lib/Magento/Mtf/Util/Command/Cli/Cache.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,24 @@
1111
/**
1212
* Handle cache for tests executions.
1313
*/
14-
class Cache extends Cli
14+
class Cache
1515
{
16+
/**
17+
* Perform bin/magento commands from command line for functional tests executions.
18+
*
19+
* @var Cli
20+
*/
21+
private $cli;
22+
23+
/**
24+
* Cache constructor.
25+
* @param Cli $cli
26+
*/
27+
public function __construct(Cli $cli)
28+
{
29+
$this->cli = $cli;
30+
}
31+
1632
/**
1733
* Parameter for flush cache command.
1834
*/
@@ -38,7 +54,7 @@ class Cache extends Cli
3854
public function flush(array $cacheTypes = [])
3955
{
4056
$options = empty($cacheTypes) ? '' : ' ' . implode(' ', $cacheTypes);
41-
parent::execute(Cache::PARAM_CACHE_FLUSH . $options);
57+
$this->cli->execute(Cache::PARAM_CACHE_FLUSH . $options);
4258
}
4359

4460
/**
@@ -49,7 +65,7 @@ public function flush(array $cacheTypes = [])
4965
*/
5066
public function disableCache($cacheType = null)
5167
{
52-
parent::execute(Cache::PARAM_CACHE_DISABLE . ($cacheType ? " $cacheType" : ''));
68+
$this->cli->execute(Cache::PARAM_CACHE_DISABLE . ($cacheType ? " $cacheType" : ''));
5369
}
5470

5571
/**
@@ -60,6 +76,6 @@ public function disableCache($cacheType = null)
6076
*/
6177
public function enableCache($cacheType = null)
6278
{
63-
parent::execute(Cache::PARAM_CACHE_ENABLE . ($cacheType ? " $cacheType" : ''));
79+
$this->cli->execute(Cache::PARAM_CACHE_ENABLE . ($cacheType ? " $cacheType" : ''));
6480
}
6581
}

dev/tests/functional/tests/app/Magento/Config/Test/TestStep/SetupConfigurationStep.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ class SetupConfigurationStep implements TestStepInterface
3838
protected $rollback;
3939

4040
/**
41-
* Flush cache.
41+
* Flush cache after change config flag.
4242
*
4343
* @var bool
4444
*/
45-
protected $flushCache;
45+
private $flushCache;
4646

4747
/**
4848
* Cli command to do operations with cache.
@@ -94,7 +94,7 @@ public function run()
9494
$config = $this->fixtureFactory->createByCode('configData', ['dataset' => $configDataSet . $prefix]);
9595
if ($config->hasData('section')) {
9696
$config->persist();
97-
$result = array_merge($result, $config->getSection());
97+
$result = array_replace_recursive($result, $config->getSection());
9898
}
9999
if ($this->flushCache) {
100100
$this->cache->flush();

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ class CreateConfigurableProductEntityTest extends Injectable
6767
*/
6868
protected $testStepFactory;
6969

70+
/**
71+
* Configuration data holder.
72+
*
73+
* @var string
74+
*/
75+
protected $configData = null;
76+
7077
/**
7178
* Injection data.
7279
*
@@ -89,17 +96,17 @@ public function __inject(
8996
* Test create catalog Configurable product run.
9097
*
9198
* @param ConfigurableProduct $product
99+
* @param string|null $configData
92100
* @return void
93101
*/
94-
public function test(ConfigurableProduct $product, $displayOutOfStockProducts = false)
102+
public function test(ConfigurableProduct $product, $configData = null)
95103
{
96104
//Preconditions
97-
if ($displayOutOfStockProducts) {
98-
$this->testStepFactory->create(
99-
SetupConfigurationStep::class,
100-
['configData' => 'display_out_of_stock_products', 'flushCache' => true]
101-
)->run();
102-
}
105+
$this->configData = $configData;
106+
$this->testStepFactory->create(
107+
SetupConfigurationStep::class,
108+
['configData' => $this->configData, 'flushCache' => true]
109+
)->run();
103110

104111
// Steps
105112
$this->productIndex->open();
@@ -115,7 +122,7 @@ public function teatDown()
115122
{
116123
$this->testStepFactory->create(
117124
SetupConfigurationStep::class,
118-
['configData' => 'display_out_of_stock_products', 'flushCache' => true]
125+
['configData' => $this->configData, 'flushCache' => true]
119126
)->cleanUp();
120127
}
121128
}

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
<data name="product/data/category_ids/dataset" xsi:type="string">default_subcategory</data>
141141
<data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data>
142142
<data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data>
143-
<data name="displayOutOfStockProducts">true</data>
143+
<data name="configData">display_out_of_stock_products</data>
144144
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />
145145
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" />
146146
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableAttributesBlockIsAbsentOnProductPage" />
@@ -158,7 +158,7 @@
158158
<data name="product/data/category_ids/dataset" xsi:type="string">default_subcategory</data>
159159
<data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data>
160160
<data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data>
161-
<data name="displayOutOfStockProducts">true</data>
161+
<data name="configData">display_out_of_stock_products</data>
162162
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />
163163
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" />
164164
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableAttributesBlockIsAbsentOnProductPage" />
@@ -176,7 +176,7 @@
176176
<data name="product/data/category_ids/dataset" xsi:type="string">default_subcategory</data>
177177
<data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data>
178178
<data name="product/data/affected_attribute_set" xsi:type="string">custom_attribute_set_%isolation%</data>
179-
<data name="displayOutOfStockProducts">true</data>
179+
<data name="configData">display_out_of_stock_products</data>
180180
<constraint name="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" />
181181
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductForm" />
182182
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableAttributesBlockIsAbsentOnProductPage" />

dev/tests/functional/utils/command.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
$commandList = [
8+
'cache:flush',
9+
'cache:disable',
10+
'cache:enable',
11+
];
12+
713
if (isset($_GET['command'])) {
814
$command = urldecode($_GET['command']);
9-
exec('php -f ../../../../bin/magento ' . $command);
15+
if (in_array($command, $commandList)) {
16+
exec('php -f ../../../../bin/magento ' . $command);
17+
}
1018
} else {
1119
throw new \InvalidArgumentException("Command GET parameter is not set.");
1220
}

0 commit comments

Comments
 (0)