Skip to content

Commit 93676a8

Browse files
authored
Merge pull request #88 from magento-commerce/imported-magento-magento2-functional-testing-framework-862
[Imported] 33581: Eliminated AspectMock where it was imported but never used
2 parents 75eb9f7 + 98f5e99 commit 93676a8

File tree

7 files changed

+461
-337
lines changed

7 files changed

+461
-337
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/DataObjectHandlerTest.php

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace tests\unit\Magento\FunctionalTestFramework\DataGenerator\Handlers;
89

9-
use AspectMock\Test as AspectMock;
10+
use Exception;
1011
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
1112
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;
1514
use tests\unit\Util\MagentoTestCase;
1615
use tests\unit\Util\ObjectHandlerUtil;
1716
use tests\unit\Util\TestLoggingUtil;
@@ -22,9 +21,9 @@
2221
class DataObjectHandlerTest extends MagentoTestCase
2322
{
2423
/**
25-
* Setup method
24+
* @inheritDoc
2625
*/
27-
public function setUp(): void
26+
protected function setUp(): void
2827
{
2928
TestLoggingUtil::getInstance()->setMockLoggingUtil();
3029
}
@@ -145,9 +144,12 @@ public function setUp(): void
145144
];
146145

147146
/**
148-
* getAllObjects should contain the expected data object
147+
* Validate getAllObjects should contain the expected data object.
148+
*
149+
* @return void
150+
* @throws Exception
149151
*/
150-
public function testGetAllObjects()
152+
public function testGetAllObjects(): void
151153
{
152154
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT);
153155

@@ -161,9 +163,12 @@ public function testGetAllObjects()
161163
}
162164

163165
/**
164-
* test deprecated data object
166+
* Validate test deprecated data object.
167+
*
168+
* @return void
169+
* @throws Exception
165170
*/
166-
public function testDeprecatedDataObject()
171+
public function testDeprecatedDataObject(): void
167172
{
168173
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_DEPRECATED);
169174

@@ -173,15 +178,18 @@ public function testDeprecatedDataObject()
173178
//validate deprecation warning
174179
TestLoggingUtil::getInstance()->validateMockLogStatement(
175180
'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']
178183
);
179184
}
180185

181186
/**
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
183191
*/
184-
public function testGetObject()
192+
public function testGetObject(): void
185193
{
186194
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT);
187195

@@ -194,9 +202,12 @@ public function testGetObject()
194202
}
195203

196204
/**
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
198209
*/
199-
public function testGetObjectNull()
210+
public function testGetObjectNull(): void
200211
{
201212
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT);
202213

@@ -205,9 +216,12 @@ public function testGetObjectNull()
205216
}
206217

207218
/**
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
209223
*/
210-
public function testGetAllObjectsWithDataExtends()
224+
public function testGetAllObjectsWithDataExtends(): void
211225
{
212226
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_WITH_EXTEND);
213227

@@ -229,9 +243,12 @@ public function testGetAllObjectsWithDataExtends()
229243
}
230244

231245
/**
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
233250
*/
234-
public function testGetObjectWithDataExtends()
251+
public function testGetObjectWithDataExtends(): void
235252
{
236253
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_WITH_EXTEND);
237254

@@ -252,15 +269,18 @@ public function testGetObjectWithDataExtends()
252269
}
253270

254271
/**
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
256276
*/
257-
public function testGetAllObjectsWithDataExtendsItself()
277+
public function testGetAllObjectsWithDataExtendsItself(): void
258278
{
259279
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_WITH_EXTEND_INVALID);
260280

261-
$this->expectException(\Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException::class);
281+
$this->expectException(TestFrameworkException::class);
262282
$this->expectExceptionMessage(
263-
"Mftf Data can not extend from itself: "
283+
'Mftf Data can not extend from itself: '
264284
. self::PARSER_OUTPUT_WITH_EXTEND_INVALID['entity']['EntityOne']['name']
265285
);
266286

@@ -269,15 +289,18 @@ public function testGetAllObjectsWithDataExtendsItself()
269289
}
270290

271291
/**
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
273296
*/
274-
public function testGetObjectWithDataExtendsItself()
297+
public function testGetObjectWithDataExtendsItself(): void
275298
{
276299
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_WITH_EXTEND_INVALID);
277300

278-
$this->expectException(\Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException::class);
301+
$this->expectException(TestFrameworkException::class);
279302
$this->expectExceptionMessage(
280-
"Mftf Data can not extend from itself: "
303+
'Mftf Data can not extend from itself: '
281304
. self::PARSER_OUTPUT_WITH_EXTEND_INVALID['entity']['EntityOne']['name']
282305
);
283306

@@ -288,7 +311,7 @@ public function testGetObjectWithDataExtendsItself()
288311
}
289312

290313
/**
291-
* clean up function runs after all tests
314+
* @inheritDoc
292315
*/
293316
public static function tearDownAfterClass(): void
294317
{

0 commit comments

Comments
 (0)