Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

33581: Eliminated AspectMock where it was imported but never used #862

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

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

use AspectMock\Test as AspectMock;
use Exception;
use Magento\FunctionalTestingFramework\DataGenerator\Handlers\DataObjectHandler;
use Magento\FunctionalTestingFramework\DataGenerator\Objects\EntityDataObject;
use Magento\FunctionalTestingFramework\DataGenerator\Parsers\DataProfileSchemaParser;
use Magento\FunctionalTestingFramework\ObjectManager;
use Magento\FunctionalTestingFramework\ObjectManagerFactory;
use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException;
use tests\unit\Util\MagentoTestCase;
use tests\unit\Util\ObjectHandlerUtil;
use tests\unit\Util\TestLoggingUtil;
Expand All @@ -22,9 +21,9 @@
class DataObjectHandlerTest extends MagentoTestCase
{
/**
* Setup method
* @inheritDoc
*/
public function setUp(): void
protected function setUp(): void
{
TestLoggingUtil::getInstance()->setMockLoggingUtil();
}
Expand Down Expand Up @@ -145,9 +144,12 @@ public function setUp(): void
];

/**
* getAllObjects should contain the expected data object
* Validate getAllObjects should contain the expected data object.
*
* @return void
* @throws Exception
*/
public function testGetAllObjects()
public function testGetAllObjects(): void
{
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT);

Expand All @@ -161,9 +163,12 @@ public function testGetAllObjects()
}

/**
* test deprecated data object
* Validate test deprecated data object.
*
* @return void
* @throws Exception
*/
public function testDeprecatedDataObject()
public function testDeprecatedDataObject(): void
{
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_DEPRECATED);

Expand All @@ -173,15 +178,18 @@ public function testDeprecatedDataObject()
//validate deprecation warning
TestLoggingUtil::getInstance()->validateMockLogStatement(
'warning',
"DEPRECATION: The data entity 'EntityOne' is deprecated.",
["fileName" => "filename.xml", "deprecatedMessage" => "deprecation message"]
'DEPRECATION: The data entity \'EntityOne\' is deprecated.',
['fileName' => 'filename.xml', 'deprecatedMessage' => 'deprecation message']
);
}

/**
* getObject should return the expected data object if it exists
* Validate getObject should return the expected data object if it exists.
*
* @return void
* @throws Exception
*/
public function testGetObject()
public function testGetObject(): void
{
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT);

Expand All @@ -194,9 +202,12 @@ public function testGetObject()
}

/**
* getAllObjects should return the expected data object if it exists
* Validate getAllObjects should return the expected data object if it exists.
*
* @return void
* @throws Exception
*/
public function testGetObjectNull()
public function testGetObjectNull(): void
{
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT);

Expand All @@ -205,9 +216,12 @@ public function testGetObjectNull()
}

/**
* getAllObjects should contain the expected data object with extends
* Validate getAllObjects should contain the expected data object with extends.
*
* @return void
* @throws Exception
*/
public function testGetAllObjectsWithDataExtends()
public function testGetAllObjectsWithDataExtends(): void
{
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_WITH_EXTEND);

Expand All @@ -229,9 +243,12 @@ public function testGetAllObjectsWithDataExtends()
}

/**
* getObject should return the expected data object with extended data if it exists
* Validate getObject should return the expected data object with extended data if it exists.
*
* @return void
* @throws Exception
*/
public function testGetObjectWithDataExtends()
public function testGetObjectWithDataExtends(): void
{
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_WITH_EXTEND);

Expand All @@ -252,15 +269,18 @@ public function testGetObjectWithDataExtends()
}

/**
* getAllObjects should throw TestFrameworkException exception if some data extends itself
* Validate getAllObjects should throw TestFrameworkException exception if some data extends itself.
*
* @return void
* @throws Exception
*/
public function testGetAllObjectsWithDataExtendsItself()
public function testGetAllObjectsWithDataExtendsItself(): void
{
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_WITH_EXTEND_INVALID);

$this->expectException(\Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException::class);
$this->expectException(TestFrameworkException::class);
$this->expectExceptionMessage(
"Mftf Data can not extend from itself: "
'Mftf Data can not extend from itself: '
. self::PARSER_OUTPUT_WITH_EXTEND_INVALID['entity']['EntityOne']['name']
);

Expand All @@ -269,15 +289,18 @@ public function testGetAllObjectsWithDataExtendsItself()
}

/**
* getObject should throw TestFrameworkException exception if requested data extends itself
* Validate getObject should throw TestFrameworkException exception if requested data extends itself.
*
* @return void
* @throws Exception
*/
public function testGetObjectWithDataExtendsItself()
public function testGetObjectWithDataExtendsItself(): void
{
ObjectHandlerUtil::mockDataObjectHandlerWithData(self::PARSER_OUTPUT_WITH_EXTEND_INVALID);

$this->expectException(\Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException::class);
$this->expectException(TestFrameworkException::class);
$this->expectExceptionMessage(
"Mftf Data can not extend from itself: "
'Mftf Data can not extend from itself: '
. self::PARSER_OUTPUT_WITH_EXTEND_INVALID['entity']['EntityOne']['name']
);

Expand All @@ -288,7 +311,7 @@ public function testGetObjectWithDataExtendsItself()
}

/**
* clean up function runs after all tests
* @inheritDoc
*/
public static function tearDownAfterClass(): void
{
Expand Down
Loading