Skip to content

Commit ca49def

Browse files
author
Korshenko, Olexii(okorshenko)
committed
Merge pull request #294 from magento-qmt/develop
[Mavericks] Implement fallback mechanism to generators
2 parents 2114377 + 85a3669 commit ca49def

File tree

3 files changed

+83
-6
lines changed

3 files changed

+83
-6
lines changed

dev/tests/functional/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"magento/mtf": "1.0.0-rc38",
3+
"magento/mtf": "1.0.0-rc39",
44
"php": "~5.5.0|~5.6.0|~7.0.0",
55
"phpunit/phpunit": "4.1.0",
66
"phpunit/phpunit-selenium": ">=1.2"
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Mtf\Util\ModuleResolver;
7+
8+
/**
9+
* Module sequence sorter.
10+
*/
11+
class SequenceSorter implements SequenceSorterInterface
12+
{
13+
/**
14+
* Magento ObjectManager.
15+
*
16+
* @var \Magento\Framework\ObjectManagerInterface
17+
*/
18+
protected $magentoObjectManager;
19+
20+
/**
21+
* @constructor
22+
*/
23+
public function __construct()
24+
{
25+
$this->initObjectManager();
26+
}
27+
28+
/**
29+
* Initialize Magento ObjectManager.
30+
*
31+
* @return void
32+
*/
33+
protected function initObjectManager()
34+
{
35+
if (!$this->magentoObjectManager) {
36+
$objectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(
37+
BP,
38+
$_SERVER
39+
);
40+
$this->magentoObjectManager = $objectManagerFactory->create($_SERVER);
41+
}
42+
}
43+
44+
/**
45+
* Get Magento module sequence load.
46+
*
47+
* @return array
48+
*/
49+
protected function getModuleSequence()
50+
{
51+
return $this->magentoObjectManager->create('\Magento\Framework\Module\ModuleList\Loader')->load();
52+
}
53+
54+
/**
55+
* Sort files according to specified sequence.
56+
*
57+
* @param array $paths
58+
* @return array
59+
*/
60+
public function sort(array $paths)
61+
{
62+
$sortedPaths = [];
63+
$modules = array_keys($this->getModuleSequence());
64+
foreach ($modules as $module) {
65+
foreach ($paths as $key => $path) {
66+
$modulePath = realpath(MTF_TESTS_PATH . str_replace('_', '/', $module));
67+
if (strpos($path, $modulePath) !== false) {
68+
$sortedPaths[] = $path;
69+
unset($paths[$key]);
70+
}
71+
}
72+
}
73+
$sortedPaths = array_merge($sortedPaths, $paths);
74+
75+
return $sortedPaths;
76+
}
77+
}

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/Fixture/ConfigurableProduct/ConfigurableAttributesData.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,14 @@ protected function addVariationMatrix(array $variationsMatrix, array $attribute,
339339
}
340340

341341
foreach ($variationsMatrix as $rowKey => $row) {
342-
$rowIsolation = mt_rand(1, 100);
343-
$row['name'] .= ' ' . $rowIsolation;
344-
$row['sku'] .= '_' . $rowIsolation;
342+
$randIsolation = mt_rand(1, 100);
343+
$rowName = $row['name'];
344+
$rowSku = $row['sku'];
345345
$index = 1;
346346
foreach ($attribute['options'] as $optionKey => $option) {
347347
$compositeKey = "{$attributeKey}:{$optionKey}";
348-
$row['name'] .= ' ' . $index;
349-
$row['sku'] .= '_' . $index;
348+
$row['name'] = $rowName . ' ' . $randIsolation . ' ' . $index;
349+
$row['sku'] = $rowSku . '_' . $randIsolation . '_' . $index;
350350
$row['price'] = $option['pricing_value'];
351351
$newRowKey = $rowKey ? "{$rowKey} {$compositeKey}" : $compositeKey;
352352
$result[$newRowKey] = $row;

0 commit comments

Comments
 (0)