3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
6
7
7
8
namespace tests \unit \Magento \FunctionalTestFramework \DataGenerator \Handlers ;
8
9
9
- use AspectMock \ Test as AspectMock ;
10
+ use Exception ;
10
11
use Magento \FunctionalTestingFramework \DataGenerator \Handlers \DataObjectHandler ;
11
12
use Magento \FunctionalTestingFramework \DataGenerator \Objects \EntityDataObject ;
12
- use Magento \FunctionalTestingFramework \DataGenerator \Parsers \DataProfileSchemaParser ;
13
- use Magento \FunctionalTestingFramework \ObjectManager ;
14
- use Magento \FunctionalTestingFramework \ObjectManagerFactory ;
13
+ use Magento \FunctionalTestingFramework \Exceptions \TestFrameworkException ;
15
14
use tests \unit \Util \MagentoTestCase ;
16
15
use tests \unit \Util \ObjectHandlerUtil ;
17
16
use tests \unit \Util \TestLoggingUtil ;
22
21
class DataObjectHandlerTest extends MagentoTestCase
23
22
{
24
23
/**
25
- * Setup method
24
+ * @inheritDoc
26
25
*/
27
- public function setUp (): void
26
+ protected function setUp (): void
28
27
{
29
28
TestLoggingUtil::getInstance ()->setMockLoggingUtil ();
30
29
}
@@ -145,9 +144,12 @@ public function setUp(): void
145
144
];
146
145
147
146
/**
148
- * getAllObjects should contain the expected data object
147
+ * Validate getAllObjects should contain the expected data object.
148
+ *
149
+ * @return void
150
+ * @throws Exception
149
151
*/
150
- public function testGetAllObjects ()
152
+ public function testGetAllObjects (): void
151
153
{
152
154
ObjectHandlerUtil::mockDataObjectHandlerWithData (self ::PARSER_OUTPUT );
153
155
@@ -161,9 +163,12 @@ public function testGetAllObjects()
161
163
}
162
164
163
165
/**
164
- * test deprecated data object
166
+ * Validate test deprecated data object.
167
+ *
168
+ * @return void
169
+ * @throws Exception
165
170
*/
166
- public function testDeprecatedDataObject ()
171
+ public function testDeprecatedDataObject (): void
167
172
{
168
173
ObjectHandlerUtil::mockDataObjectHandlerWithData (self ::PARSER_OUTPUT_DEPRECATED );
169
174
@@ -173,15 +178,18 @@ public function testDeprecatedDataObject()
173
178
//validate deprecation warning
174
179
TestLoggingUtil::getInstance ()->validateMockLogStatement (
175
180
'warning ' ,
176
- " DEPRECATION: The data entity 'EntityOne' is deprecated. " ,
177
- [" fileName " => " filename.xml " , " deprecatedMessage " => " deprecation message " ]
181
+ ' DEPRECATION: The data entity \ 'EntityOne \ ' is deprecated. ' ,
182
+ [' fileName ' => ' filename.xml ' , ' deprecatedMessage ' => ' deprecation message ' ]
178
183
);
179
184
}
180
185
181
186
/**
182
- * getObject should return the expected data object if it exists
187
+ * Validate getObject should return the expected data object if it exists.
188
+ *
189
+ * @return void
190
+ * @throws Exception
183
191
*/
184
- public function testGetObject ()
192
+ public function testGetObject (): void
185
193
{
186
194
ObjectHandlerUtil::mockDataObjectHandlerWithData (self ::PARSER_OUTPUT );
187
195
@@ -194,9 +202,12 @@ public function testGetObject()
194
202
}
195
203
196
204
/**
197
- * getAllObjects should return the expected data object if it exists
205
+ * Validate getAllObjects should return the expected data object if it exists.
206
+ *
207
+ * @return void
208
+ * @throws Exception
198
209
*/
199
- public function testGetObjectNull ()
210
+ public function testGetObjectNull (): void
200
211
{
201
212
ObjectHandlerUtil::mockDataObjectHandlerWithData (self ::PARSER_OUTPUT );
202
213
@@ -205,9 +216,12 @@ public function testGetObjectNull()
205
216
}
206
217
207
218
/**
208
- * getAllObjects should contain the expected data object with extends
219
+ * Validate getAllObjects should contain the expected data object with extends.
220
+ *
221
+ * @return void
222
+ * @throws Exception
209
223
*/
210
- public function testGetAllObjectsWithDataExtends ()
224
+ public function testGetAllObjectsWithDataExtends (): void
211
225
{
212
226
ObjectHandlerUtil::mockDataObjectHandlerWithData (self ::PARSER_OUTPUT_WITH_EXTEND );
213
227
@@ -229,9 +243,12 @@ public function testGetAllObjectsWithDataExtends()
229
243
}
230
244
231
245
/**
232
- * getObject should return the expected data object with extended data if it exists
246
+ * Validate getObject should return the expected data object with extended data if it exists.
247
+ *
248
+ * @return void
249
+ * @throws Exception
233
250
*/
234
- public function testGetObjectWithDataExtends ()
251
+ public function testGetObjectWithDataExtends (): void
235
252
{
236
253
ObjectHandlerUtil::mockDataObjectHandlerWithData (self ::PARSER_OUTPUT_WITH_EXTEND );
237
254
@@ -252,15 +269,18 @@ public function testGetObjectWithDataExtends()
252
269
}
253
270
254
271
/**
255
- * getAllObjects should throw TestFrameworkException exception if some data extends itself
272
+ * Validate getAllObjects should throw TestFrameworkException exception if some data extends itself.
273
+ *
274
+ * @return void
275
+ * @throws Exception
256
276
*/
257
- public function testGetAllObjectsWithDataExtendsItself ()
277
+ public function testGetAllObjectsWithDataExtendsItself (): void
258
278
{
259
279
ObjectHandlerUtil::mockDataObjectHandlerWithData (self ::PARSER_OUTPUT_WITH_EXTEND_INVALID );
260
280
261
- $ this ->expectException (\ Magento \ FunctionalTestingFramework \ Exceptions \ TestFrameworkException::class);
281
+ $ this ->expectException (TestFrameworkException::class);
262
282
$ this ->expectExceptionMessage (
263
- " Mftf Data can not extend from itself: "
283
+ ' Mftf Data can not extend from itself: '
264
284
. self ::PARSER_OUTPUT_WITH_EXTEND_INVALID ['entity ' ]['EntityOne ' ]['name ' ]
265
285
);
266
286
@@ -269,15 +289,18 @@ public function testGetAllObjectsWithDataExtendsItself()
269
289
}
270
290
271
291
/**
272
- * getObject should throw TestFrameworkException exception if requested data extends itself
292
+ * Validate getObject should throw TestFrameworkException exception if requested data extends itself.
293
+ *
294
+ * @return void
295
+ * @throws Exception
273
296
*/
274
- public function testGetObjectWithDataExtendsItself ()
297
+ public function testGetObjectWithDataExtendsItself (): void
275
298
{
276
299
ObjectHandlerUtil::mockDataObjectHandlerWithData (self ::PARSER_OUTPUT_WITH_EXTEND_INVALID );
277
300
278
- $ this ->expectException (\ Magento \ FunctionalTestingFramework \ Exceptions \ TestFrameworkException::class);
301
+ $ this ->expectException (TestFrameworkException::class);
279
302
$ this ->expectExceptionMessage (
280
- " Mftf Data can not extend from itself: "
303
+ ' Mftf Data can not extend from itself: '
281
304
. self ::PARSER_OUTPUT_WITH_EXTEND_INVALID ['entity ' ]['EntityOne ' ]['name ' ]
282
305
);
283
306
@@ -288,7 +311,7 @@ public function testGetObjectWithDataExtendsItself()
288
311
}
289
312
290
313
/**
291
- * clean up function runs after all tests
314
+ * @inheritDoc
292
315
*/
293
316
public static function tearDownAfterClass (): void
294
317
{
0 commit comments