Skip to content

Commit 63dfb63

Browse files
committed
MQE-388: Write store settings before tests
- change output deletion beahvior - fix codesniffer method
1 parent 8d698c4 commit 63dfb63

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/Magento/FunctionalTestingFramework/Util/MetadataGenerator/MetadataGenUtil.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ class MetadataGenUtil
5050
*/
5151
private $inputString;
5252

53+
/**
54+
* The relative filepath for the *meta.xml file to be generated.
55+
*
56+
* @var string
57+
*/
58+
private $filepath;
59+
5360
/**
5461
* MetadataGenUtil constructor.
5562
*
@@ -64,6 +71,8 @@ public function __construct($operationName, $operationDataType, $operationUrl, $
6471
$this->operationDataType = $operationDataType;
6572
$this->operationUrl = $operationUrl;
6673
$this->inputString = $inputString;
74+
75+
$this->filepath = self::OUTPUT_DIR . DIRECTORY_SEPARATOR . $this->operationDataType . "-meta.xml";
6776
}
6877

6978
/**
@@ -83,7 +92,7 @@ public function generateMetadataFile()
8392
$output = $this->mustache_engine->render('operation', $data);
8493
$this->cleanAndCreateOutputDir();
8594
file_put_contents(
86-
self::OUTPUT_DIR . DIRECTORY_SEPARATOR . $this->operationDataType . "-meta.xml",
95+
$this->filepath,
8796
$output
8897
);
8998
}
@@ -153,16 +162,18 @@ private function convertResultToEntry($results, $defaultDataType)
153162
}
154163

155164
/**
156-
* Function which cleans and creates the _output dir.
165+
* Function which cleans any previously created fileand creates the _output dir.
157166
*
158167
* @return void
159168
*/
160169
private function cleanAndCreateOutputDir()
161170
{
162-
if (file_exists(self::OUTPUT_DIR)) {
163-
\Magento\FunctionalTestingFramework\Util\Filesystem\DirSetupUtil::rmdirRecursive(self::OUTPUT_DIR);
171+
if (!file_exists(self::OUTPUT_DIR)) {
172+
mkdir(self::OUTPUT_DIR);
164173
}
165174

166-
mkdir(self::OUTPUT_DIR);
175+
if (file_exists($this->filepath)) {
176+
unlink($this->filepath);
177+
}
167178
}
168179
}

src/Magento/FunctionalTestingFramework/Util/MetadataGenerator/_generateMetadtataFile.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
27
require_once '../../../../../vendor/autoload.php';
38

49
const INPUT_TXT_FILE = 'input.yml';

0 commit comments

Comments
 (0)