Skip to content

Commit d76e7ae

Browse files
committed
MQE-386: MFTF Compatibility with Windows Machine
- replace hardcoded dir references with DIRECTORY_SEPARATOR constant
1 parent 7c4954b commit d76e7ae

File tree

6 files changed

+19
-17
lines changed

6 files changed

+19
-17
lines changed

src/Magento/FunctionalTestingFramework/Config/FileResolver/Mask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function getFileCollection($filename, $scope)
6464
$modulesPath = $this->moduleResolver->getModulesPath();
6565

6666
foreach ($modulesPath as $modulePath) {
67-
$path = $modulePath . '/' . $scope . '/';
67+
$path = $modulePath . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR;
6868
if (is_readable($path)) {
6969
$directoryIterator = new \RecursiveIteratorIterator(
7070
new \RecursiveDirectoryIterator(

src/Magento/FunctionalTestingFramework/Config/FileResolver/Primary.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function get($filename, $scope)
2828
if (!$filename) {
2929
return [];
3030
}
31-
$scope = str_replace('\\', '/', $scope);
31+
$scope = str_replace('\\', DIRECTORY_SEPARATOR, $scope);
3232
return new File($this->getFilePaths($filename, $scope));
3333
}
3434

@@ -59,19 +59,20 @@ private function getPathPatterns($filename, $scope)
5959
{
6060
if (substr($scope, 0, strlen(FW_BP)) === FW_BP) {
6161
$patterns = [
62-
$scope . '/' . $filename,
63-
$scope . '/*/' . $filename
62+
$scope . DIRECTORY_SEPARATOR . $filename,
63+
$scope . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . $filename
6464
];
6565
} else {
6666
$defaultPath = dirname(dirname(dirname(dirname(__DIR__))));
67-
$defaultPath = str_replace('\\', '/', $defaultPath);
67+
$defaultPath = str_replace('\\', DIRECTORY_SEPARATOR, $defaultPath);
6868
$patterns = [
69-
$defaultPath . '/' . $scope . '/' . $filename,
70-
$defaultPath . '/' . $scope . '/*/' . $filename,
71-
FW_BP . '/' . $scope . '/' . $filename,
72-
FW_BP . '/' . $scope . '/*/' . $filename
69+
$defaultPath . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR . $filename,
70+
$defaultPath . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR
71+
. $filename,
72+
FW_BP . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR . $filename,
73+
FW_BP . DIRECTORY_SEPARATOR . $scope . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . $filename
7374
];
7475
}
75-
return str_replace('/', DIRECTORY_SEPARATOR, $patterns);
76+
return str_replace(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $patterns);
7677
}
7778
}

src/Magento/FunctionalTestingFramework/Config/SchemaLocator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class SchemaLocator implements \Magento\FunctionalTestingFramework\Config\Schema
2525
*/
2626
public function __construct($schemaPath)
2727
{
28-
if (constant('FW_BP') && file_exists(FW_BP . '/' . $schemaPath)) {
29-
$this->schemaPath = FW_BP . '/' . $schemaPath;
28+
if (constant('FW_BP') && file_exists(FW_BP . DIRECTORY_SEPARATOR . $schemaPath)) {
29+
$this->schemaPath = FW_BP . DIRECTORY_SEPARATOR . $schemaPath;
3030
} else {
3131
$path = dirname(dirname(dirname(__DIR__)));
32-
$path = str_replace('\\', '/', $path);
33-
$this->schemaPath = $path . '/' . $schemaPath;
32+
$path = str_replace('\\', DIRECTORY_SEPARATOR, $path);
33+
$this->schemaPath = $path . DIRECTORY_SEPARATOR . $schemaPath;
3434
}
3535
}
3636

src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private function initDataObjects()
132132
*/
133133
private function parseEnvVariables()
134134
{
135-
$envFilename = PROJECT_ROOT . '/.env';
135+
$envFilename = PROJECT_ROOT . DIRECTORY_SEPARATOR . '.env';
136136
if (file_exists($envFilename)) {
137137
$envData = [];
138138
$envFile = file($envFilename);

src/Magento/FunctionalTestingFramework/Module/MagentoSequence.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class MagentoSequence extends Sequence
2020
}
2121

2222
if (!function_exists('msq') && !function_exists('msqs')) {
23-
require_once __DIR__ . '/../Util/msq.php';
23+
require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Util' . DIRECTORY_SEPARATOR . 'msq.php';
2424
} else {
2525
throw new ModuleException('Magento\FunctionalTestingFramework\Module\MagentoSequence', "function 'msq' and 'msqs' already defined");
2626
}

src/Magento/FunctionalTestingFramework/ObjectManager/Config/SchemaLocator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ class SchemaLocator implements SchemaLocatorInterface
2222
*/
2323
public function getSchema()
2424
{
25-
return realpath(__DIR__ . '/../etc/') . DIRECTORY_SEPARATOR . 'config.xsd';
25+
return realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'etc' . DIRECTORY_SEPARATOR)
26+
. DIRECTORY_SEPARATOR . 'config.xsd';
2627
}
2728

2829
/**

0 commit comments

Comments
 (0)