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 \Test \Handlers ;
8
9
9
- use AspectMock \Test as AspectMock ;
10
-
11
- use Magento \FunctionalTestingFramework \ObjectManager ;
12
- use Magento \FunctionalTestingFramework \ObjectManagerFactory ;
10
+ use Exception ;
13
11
use Magento \FunctionalTestingFramework \Test \Handlers \TestObjectHandler ;
14
12
use Magento \FunctionalTestingFramework \Test \Objects \ActionObject ;
15
13
use Magento \FunctionalTestingFramework \Test \Objects \TestHookObject ;
16
14
use Magento \FunctionalTestingFramework \Test \Objects \TestObject ;
17
- use Magento \FunctionalTestingFramework \Test \Parsers \TestDataParser ;
18
15
use Magento \FunctionalTestingFramework \Test \Util \TestObjectExtractor ;
16
+ use Magento \FunctionalTestingFramework \Util \GenerationErrorHandler ;
19
17
use tests \unit \Util \MagentoTestCase ;
18
+ use tests \unit \Util \MockModuleResolverBuilder ;
20
19
use tests \unit \Util \ObjectHandlerUtil ;
21
20
use tests \unit \Util \TestDataArrayBuilder ;
22
- use tests \unit \Util \MockModuleResolverBuilder ;
23
21
use tests \unit \Util \TestLoggingUtil ;
24
- use Magento \FunctionalTestingFramework \Util \GenerationErrorHandler ;
25
22
26
23
class TestObjectHandlerTest extends MagentoTestCase
27
24
{
28
- public function setUp (): void
25
+ /**
26
+ * Before test functionality.
27
+ *
28
+ * @return void
29
+ * @throws Exception
30
+ */
31
+ protected function setUp (): void
29
32
{
30
33
TestLoggingUtil::getInstance ()->setMockLoggingUtil ();
31
34
}
32
35
33
36
/**
34
37
* Basic test to validate array => test object conversion.
35
38
*
36
- * @throws \Exception
39
+ * @return void
40
+ * @throws Exception
37
41
*/
38
- public function testGetTestObject ()
42
+ public function testGetTestObject (): void
39
43
{
40
44
// set up mock data
41
45
$ testDataArrayBuilder = new TestDataArrayBuilder ();
@@ -53,7 +57,6 @@ public function testGetTestObject()
53
57
54
58
// run object handler method
55
59
$ toh = TestObjectHandler::getInstance ();
56
- $ mockConfig = AspectMock::double (TestObjectHandler::class, ['initTestData ' => false ]);
57
60
$ actualTestObject = $ toh ->getObject ($ testDataArrayBuilder ->testName );
58
61
59
62
// perform asserts
@@ -114,19 +117,22 @@ public function testGetTestObject()
114
117
}
115
118
116
119
/**
117
- * Tests basic getting of a test that has a fileName
120
+ * Tests basic getting of a test that has a fileName.
121
+ *
122
+ * @return void
118
123
*/
119
- public function testGetTestWithFileName ()
124
+ public function testGetTestWithFileName (): void
120
125
{
121
126
$ this ->markTestIncomplete ('TODO ' );
122
127
}
123
128
124
129
/**
125
130
* Tests the function used to get a series of relevant tests by group.
126
131
*
127
- * @throws \Exception
132
+ * @return void
133
+ * @throws Exception
128
134
*/
129
- public function testGetTestsByGroup ()
135
+ public function testGetTestsByGroup (): void
130
136
{
131
137
// set up mock data with Exclude Test
132
138
$ includeTest = (new TestDataArrayBuilder ())
@@ -155,11 +161,12 @@ public function testGetTestsByGroup()
155
161
}
156
162
157
163
/**
158
- * Tests the function used to parse and determine a test's Module (used in allure Features annotation)
164
+ * Tests the function used to parse and determine a test's Module (used in allure Features annotation).
159
165
*
160
- * @throws \Exception
166
+ * @return void
167
+ * @throws Exception
161
168
*/
162
- public function testGetTestWithModuleName ()
169
+ public function testGetTestWithModuleName (): void
163
170
{
164
171
// set up Test Data
165
172
$ moduleExpected = "SomeModuleName " ;
@@ -201,11 +208,12 @@ public function testGetTestWithModuleName()
201
208
}
202
209
203
210
/**
204
- * getObject should throw exception if test extends from itself
211
+ * getObject should throw exception if test extends from itself.
205
212
*
206
- * @throws \Exception
213
+ * @return void
214
+ * @throws Exception
207
215
*/
208
- public function testGetTestObjectWithInvalidExtends ()
216
+ public function testGetTestObjectWithInvalidExtends (): void
209
217
{
210
218
// set up Test Data
211
219
$ testOne = (new TestDataArrayBuilder ())
@@ -230,11 +238,12 @@ public function testGetTestObjectWithInvalidExtends()
230
238
}
231
239
232
240
/**
233
- * getAllObjects should throw exception if test extends from itself
241
+ * getAllObjects should throw exception if test extends from itself.
234
242
*
235
- * @throws \Exception
243
+ * @return void
244
+ * @throws Exception
236
245
*/
237
- public function testGetAllTestObjectsWithInvalidExtends ()
246
+ public function testGetAllTestObjectsWithInvalidExtends (): void
238
247
{
239
248
// set up Test Data
240
249
$ testOne = (new TestDataArrayBuilder ())
@@ -270,11 +279,12 @@ public function testGetAllTestObjectsWithInvalidExtends()
270
279
}
271
280
272
281
/**
273
- * Validate test object when ENABLE_PAUSE is set to true
282
+ * Validate test object when ENABLE_PAUSE is set to true.
274
283
*
275
- * @throws \Exception
284
+ * @return void
285
+ * @throws Exception
276
286
*/
277
- public function testGetTestObjectWhenEnablePause ()
287
+ public function testGetTestObjectWhenEnablePause (): void
278
288
{
279
289
// set up mock data
280
290
putenv ('ENABLE_PAUSE=true ' );
@@ -293,7 +303,6 @@ public function testGetTestObjectWhenEnablePause()
293
303
294
304
// run object handler method
295
305
$ toh = TestObjectHandler::getInstance ();
296
- $ mockConfig = AspectMock::double (TestObjectHandler::class, ['initTestData ' => false ]);
297
306
$ actualTestObject = $ toh ->getObject ($ testDataArrayBuilder ->testName );
298
307
299
308
// perform asserts
@@ -363,14 +372,13 @@ public function testGetTestObjectWhenEnablePause()
363
372
}
364
373
365
374
/**
366
- * After method functionality
375
+ * After method functionality.
367
376
*
368
377
* @return void
369
378
*/
370
- public function tearDown (): void
379
+ protected function tearDown (): void
371
380
{
372
381
TestLoggingUtil::getInstance ()->clearMockLoggingUtil ();
373
- AspectMock::clean ();
374
382
parent ::tearDownAfterClass ();
375
383
}
376
384
}
0 commit comments