@@ -50,6 +50,13 @@ class MetadataGenUtil
50
50
*/
51
51
private $ inputString ;
52
52
53
+ /**
54
+ * The relative filepath for the *meta.xml file to be generated.
55
+ *
56
+ * @var string
57
+ */
58
+ private $ filepath ;
59
+
53
60
/**
54
61
* MetadataGenUtil constructor.
55
62
*
@@ -64,6 +71,8 @@ public function __construct($operationName, $operationDataType, $operationUrl, $
64
71
$ this ->operationDataType = $ operationDataType ;
65
72
$ this ->operationUrl = $ operationUrl ;
66
73
$ this ->inputString = $ inputString ;
74
+
75
+ $ this ->filepath = self ::OUTPUT_DIR . DIRECTORY_SEPARATOR . $ this ->operationDataType . "-meta.xml " ;
67
76
}
68
77
69
78
/**
@@ -83,7 +92,7 @@ public function generateMetadataFile()
83
92
$ output = $ this ->mustache_engine ->render ('operation ' , $ data );
84
93
$ this ->cleanAndCreateOutputDir ();
85
94
file_put_contents (
86
- self :: OUTPUT_DIR . DIRECTORY_SEPARATOR . $ this ->operationDataType . " -meta.xml " ,
95
+ $ this ->filepath ,
87
96
$ output
88
97
);
89
98
}
@@ -153,16 +162,18 @@ private function convertResultToEntry($results, $defaultDataType)
153
162
}
154
163
155
164
/**
156
- * Function which cleans and creates the _output dir.
165
+ * Function which cleans any previously created fileand creates the _output dir.
157
166
*
158
167
* @return void
159
168
*/
160
169
private function cleanAndCreateOutputDir ()
161
170
{
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 );
164
173
}
165
174
166
- mkdir (self ::OUTPUT_DIR );
175
+ if (file_exists ($ this ->filepath )) {
176
+ unlink ($ this ->filepath );
177
+ }
167
178
}
168
179
}
0 commit comments