diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/DataObjectHandlerTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/DataObjectHandlerTest.php index 745789501..57cdb6a64 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/DataObjectHandlerTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/DataObjectHandlerTest.php @@ -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; @@ -22,9 +21,9 @@ class DataObjectHandlerTest extends MagentoTestCase { /** - * Setup method + * @inheritDoc */ - public function setUp(): void + protected function setUp(): void { TestLoggingUtil::getInstance()->setMockLoggingUtil(); } @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); @@ -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'] ); @@ -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'] ); @@ -288,7 +311,7 @@ public function testGetObjectWithDataExtendsItself() } /** - * clean up function runs after all tests + * @inheritDoc */ public static function tearDownAfterClass(): void { diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/OperationDefinitionObjectHandlerTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/OperationDefinitionObjectHandlerTest.php index 35b06a24a..6c8fc7c45 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/OperationDefinitionObjectHandlerTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/OperationDefinitionObjectHandlerTest.php @@ -3,16 +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\OperationDefinitionObjectHandler; use Magento\FunctionalTestingFramework\DataGenerator\Objects\OperationDefinitionObject; use Magento\FunctionalTestingFramework\DataGenerator\Objects\OperationElement; -use Magento\FunctionalTestingFramework\ObjectManager; -use Magento\FunctionalTestingFramework\ObjectManagerFactory; -use Magento\FunctionalTestingFramework\DataGenerator\Handlers\OperationDefinitionObjectHandler; -use Magento\FunctionalTestingFramework\DataGenerator\Parsers\OperationDefinitionParser; use tests\unit\Util\MagentoTestCase; use tests\unit\Util\ObjectHandlerUtil; use tests\unit\Util\TestLoggingUtil; @@ -23,19 +21,25 @@ class OperationDefinitionObjectHandlerTest extends MagentoTestCase { /** - * Setup method + * @inheritDoc */ - public function setUp(): void + protected function setUp(): void { TestLoggingUtil::getInstance()->setMockLoggingUtil(); } - public function testGetMultipleObjects() + /** + * Validate testGetMultipleObjects. + * + * @return void + * @throws Exception + */ + public function testGetMultipleObjects(): void { // Data Variables for Assertions - $dataType1 = "type1"; - $operationType1 = "create"; - $operationType2 = "update"; + $dataType1 = 'type1'; + $operationType1 = 'create'; + $operationType2 = 'update'; /** * Parser Output. Just two simple pieces of metadata with 1 field each @@ -48,31 +52,31 @@ public function testGetMultipleObjects() * key=id, value=integer */ $mockData = [OperationDefinitionObjectHandler::ENTITY_OPERATION_ROOT_TAG => [ - "testOperationName" => [ + 'testOperationName' => [ OperationDefinitionObjectHandler::ENTITY_OPERATION_DATA_TYPE => $dataType1, OperationDefinitionObjectHandler::ENTITY_OPERATION_TYPE => $operationType1, - OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH => "auth", - OperationDefinitionObjectHandler::ENTITY_OPERATION_URL => "V1/Type1", - OperationDefinitionObjectHandler::ENTITY_OPERATION_METHOD => "POST", + OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH => 'auth', + OperationDefinitionObjectHandler::ENTITY_OPERATION_URL => 'V1/Type1', + OperationDefinitionObjectHandler::ENTITY_OPERATION_METHOD => 'POST', OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY => [ 0 => [ - OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_KEY => "id", - OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_VALUE => "integer" + OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_KEY => 'id', + OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_VALUE => 'integer' ], - ] - ],[ + ] + ],[ OperationDefinitionObjectHandler::ENTITY_OPERATION_DATA_TYPE => $dataType1, OperationDefinitionObjectHandler::ENTITY_OPERATION_TYPE => $operationType2, - OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH => "auth", - OperationDefinitionObjectHandler::ENTITY_OPERATION_URL => "V1/Type1/{id}", - OperationDefinitionObjectHandler::ENTITY_OPERATION_METHOD => "PUT", + OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH => 'auth', + OperationDefinitionObjectHandler::ENTITY_OPERATION_URL => 'V1/Type1/{id}', + OperationDefinitionObjectHandler::ENTITY_OPERATION_METHOD => 'PUT', OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY => [ 0 => [ - OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_KEY => "id", - OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_VALUE => "integer" + OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_KEY => 'id', + OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_VALUE => 'integer' ], ] - ]]]; + ]]]; ObjectHandlerUtil::mockOperationHandlerWithData($mockData); //Perform Assertions @@ -82,11 +86,17 @@ public function testGetMultipleObjects() $this->assertArrayHasKey($operationType2 . $dataType1, $operations); } - public function testDeprecatedOperation() + /** + * Validate testDeprecatedOperation. + * + * @return void + * @throws Exception + */ + public function testDeprecatedOperation(): void { // Data Variables for Assertions - $dataType1 = "type1"; - $operationType1 = "create"; + $dataType1 = 'type1'; + $operationType1 = 'create'; /** * Parser Output. Just one metadata with 1 field @@ -96,16 +106,16 @@ public function testDeprecatedOperation() * key=id, value=integer */ $mockData = [OperationDefinitionObjectHandler::ENTITY_OPERATION_ROOT_TAG => [ - "testOperationName" => [ + 'testOperationName' => [ OperationDefinitionObjectHandler::ENTITY_OPERATION_DATA_TYPE => $dataType1, OperationDefinitionObjectHandler::ENTITY_OPERATION_TYPE => $operationType1, - OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH => "auth", - OperationDefinitionObjectHandler::ENTITY_OPERATION_URL => "V1/Type1", - OperationDefinitionObjectHandler::ENTITY_OPERATION_METHOD => "POST", + OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH => 'auth', + OperationDefinitionObjectHandler::ENTITY_OPERATION_URL => 'V1/Type1', + OperationDefinitionObjectHandler::ENTITY_OPERATION_METHOD => 'POST', OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY => [ 0 => [ - OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_KEY => "id", - OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_VALUE => "integer" + OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_KEY => 'id', + OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY_VALUE => 'integer' ], ], OperationDefinitionObjectHandler::OBJ_DEPRECATED => 'deprecation message' @@ -119,7 +129,7 @@ public function testDeprecatedOperation() $this->assertArrayHasKey($operationType1 . $dataType1, $operations); TestLoggingUtil::getInstance()->validateMockLogStatement( 'notice', - "NOTICE: 1 metadata operation name violations detected. See mftf.log for details.", + 'NOTICE: 1 metadata operation name violations detected. See mftf.log for details.', [] ); // test run time deprecation notice @@ -127,33 +137,39 @@ public function testDeprecatedOperation() $operation->logDeprecated(); TestLoggingUtil::getInstance()->validateMockLogStatement( 'warning', - "DEPRECATION: The operation testOperationName is deprecated.", + 'DEPRECATION: The operation testOperationName is deprecated.', ['operationType' => 'create', 'deprecatedMessage' => 'deprecation message'] ); } - public function testObjectCreation() + /** + * Validate testObjectCreation. + * + * @return void + * @throws Exception + */ + public function testObjectCreation(): void { // Data Variables for Assertions - $testDataTypeName1 = "type1"; - $testAuth = "auth"; - $testUrl = "V1/dataType"; - $testOperationType = "create"; - $testMethod = "POST"; - $testSuccessRegex = "/messages-message-success/"; - $testContentType = "application/json"; - $testHeaderParam = "testParameter"; - $testHeaderValue = "testHeader"; + $testDataTypeName1 = 'type1'; + $testAuth = 'auth'; + $testUrl = 'V1/dataType'; + $testOperationType = 'create'; + $testMethod = 'POST'; + $testSuccessRegex = '/messages-message-success/'; + $testContentType = 'application/json'; + $testHeaderParam = 'testParameter'; + $testHeaderValue = 'testHeader'; // Nested Object variables - $nestedObjectKey = "objectKey"; - $nestedObjectType = "objectType"; - $nestedEntryKey1 = "id"; - $nestedEntryValue1 = "integer"; - $nestedEntryKey2 = "name"; - $nestedEntryValue2 = "string"; - $nestedEntryRequired2 = "true"; - $nestedEntryKey3 = "active"; - $nestedEntryValue3 = "boolean"; + $nestedObjectKey = 'objectKey'; + $nestedObjectType = 'objectType'; + $nestedEntryKey1 = 'id'; + $nestedEntryValue1 = 'integer'; + $nestedEntryKey2 = 'name'; + $nestedEntryValue2 = 'string'; + $nestedEntryRequired2 = 'true'; + $nestedEntryKey3 = 'active'; + $nestedEntryValue3 = 'boolean'; /** * Complex Object @@ -172,7 +188,7 @@ public function testObjectCreation() * */ $mockData = [OperationDefinitionObjectHandler::ENTITY_OPERATION_ROOT_TAG => [ - "testOperationName" => [ + 'testOperationName' => [ OperationDefinitionObjectHandler::ENTITY_OPERATION_DATA_TYPE => $testDataTypeName1, OperationDefinitionObjectHandler::ENTITY_OPERATION_TYPE => $testOperationType, OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH => $testAuth, @@ -181,7 +197,7 @@ public function testObjectCreation() OperationDefinitionObjectHandler::ENTITY_OPERATION_SUCCESS_REGEX => $testSuccessRegex, OperationDefinitionObjectHandler::ENTITY_OPERATION_CONTENT_TYPE => [ 0 => [ - "value" => $testContentType + 'value' => $testContentType ] ], OperationDefinitionObjectHandler::ENTITY_OPERATION_HEADER => [ @@ -192,8 +208,8 @@ public function testObjectCreation() ], OperationDefinitionObjectHandler::ENTITY_OPERATION_URL_PARAM => [ 0 => [ - OperationDefinitionObjectHandler::ENTITY_OPERATION_URL_PARAM_KEY => "testUrlParamKey", - OperationDefinitionObjectHandler::ENTITY_OPERATION_URL_PARAM_VALUE => "testUrlParamValue" + OperationDefinitionObjectHandler::ENTITY_OPERATION_URL_PARAM_KEY => 'testUrlParamKey', + OperationDefinitionObjectHandler::ENTITY_OPERATION_URL_PARAM_VALUE => 'testUrlParamValue' ] ], OperationDefinitionObjectHandler::ENTITY_OPERATION_OBJECT => [ @@ -220,7 +236,14 @@ public function testObjectCreation() ]]]; // Prepare objects to compare against $field = OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY; - $expectedNestedField = new OperationElement($nestedEntryKey1, $nestedEntryValue1, $field, false, [], null); + $expectedNestedField = new OperationElement( + $nestedEntryKey1, + $nestedEntryValue1, + $field, + false, + [], + null + ); $expectedNestedField2 = new OperationElement( $nestedEntryKey2, $nestedEntryValue2, @@ -229,14 +252,25 @@ public function testObjectCreation() [], null ); - $expectedNestedField3 = new OperationElement($nestedEntryKey3, $nestedEntryValue3, $field, false, [], null); + $expectedNestedField3 = new OperationElement( + $nestedEntryKey3, + $nestedEntryValue3, + $field, + false, + [], + null + ); $expectedOperation = new OperationElement( $nestedObjectKey, $nestedObjectType, OperationDefinitionObjectHandler::ENTITY_OPERATION_OBJECT, false, [], - [0 => $expectedNestedField, 1 => $expectedNestedField2, 2 =>$expectedNestedField3] + [ + 0 => $expectedNestedField, + 1 => $expectedNestedField2, + 2 => $expectedNestedField3 + ] ); // Set up mocked data output @@ -264,16 +298,22 @@ public function testObjectCreation() $this->assertEquals($expectedOperation, $operation->getOperationMetadata()[0]); } - public function testObjectArrayCreation() + /** + * Validate testObjectArrayCreation. + * + * @return void + * @throws Exception + */ + public function testObjectArrayCreation(): void { // Data Variables for Assertions - $dataType1 = "type1"; - $operationType1 = "create"; - $objectArrayKey = "ObjectArray"; - $twiceNestedObjectKey = "nestedObjectKey"; - $twiceNestedObjectType = "nestedObjectType"; - $twiceNestedEntryKey = "nestedFieldKey"; - $twiceNestedEntryValue = "string"; + $dataType1 = 'type1'; + $operationType1 = 'create'; + $objectArrayKey = 'ObjectArray'; + $twiceNestedObjectKey = 'nestedObjectKey'; + $twiceNestedObjectType = 'nestedObjectType'; + $twiceNestedEntryKey = 'nestedFieldKey'; + $twiceNestedEntryValue = 'string'; // Parser Output /** * Metadata with nested array of objects, with a single field @@ -284,12 +324,12 @@ public function testObjectArrayCreation() * has field with key = nestedFieldKey, value = string */ $mockData = [OperationDefinitionObjectHandler::ENTITY_OPERATION_ROOT_TAG => [ - "testOperationName" => [ + 'testOperationName' => [ OperationDefinitionObjectHandler::ENTITY_OPERATION_DATA_TYPE => $dataType1, OperationDefinitionObjectHandler::ENTITY_OPERATION_TYPE => $operationType1, - OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH => "auth", - OperationDefinitionObjectHandler::ENTITY_OPERATION_URL => "V1/Type1", - OperationDefinitionObjectHandler::ENTITY_OPERATION_METHOD => "POST", + OperationDefinitionObjectHandler::ENTITY_OPERATION_AUTH => 'auth', + OperationDefinitionObjectHandler::ENTITY_OPERATION_URL => 'V1/Type1', + OperationDefinitionObjectHandler::ENTITY_OPERATION_METHOD => 'POST', OperationDefinitionObjectHandler::ENTITY_OPERATION_ARRAY => [ 0 => [ OperationDefinitionObjectHandler::ENTITY_OPERATION_OBJECT_KEY => $objectArrayKey, @@ -325,7 +365,9 @@ public function testObjectArrayCreation() OperationDefinitionObjectHandler::ENTITY_OPERATION_OBJECT, false, [], - [0 => $twoLevelNestedMetadata] + [ + 0 => $twoLevelNestedMetadata + ] ); $expectedOperation = new OperationElement( @@ -333,7 +375,9 @@ public function testObjectArrayCreation() $twiceNestedObjectType, $twiceNestedObjectKey, false, - [$twiceNestedObjectKey => $oneLevelNestedMetadata], + [ + $twiceNestedObjectKey => $oneLevelNestedMetadata + ], null ); @@ -348,15 +392,21 @@ public function testObjectArrayCreation() $this->assertEquals($expectedOperation, $operation->getOperationMetadata()[0]); } - public function testLooseJsonCreation() + /** + * Validate testLooseJsonCreation. + * + * @return void + * @throws Exception + */ + public function testLooseJsonCreation(): void { // Data Variables for Assertions - $dataType = "dataType"; - $operationType = "create"; - $entryKey = "id"; - $entryValue = "integer"; - $arrayKey = "arrayKey"; - $arrayValue = "string"; + $dataType = 'dataType'; + $operationType = 'create'; + $entryKey = 'id'; + $entryValue = 'integer'; + $arrayKey = 'arrayKey'; + $arrayValue = 'string'; /** * Operation with no objects, just an entry and an array of strings * testOperationName @@ -366,7 +416,7 @@ public function testLooseJsonCreation() * fields of value = string */ $mockData = [OperationDefinitionObjectHandler::ENTITY_OPERATION_ROOT_TAG => [ - "testOperationName" => [ + 'testOperationName' => [ OperationDefinitionObjectHandler::ENTITY_OPERATION_DATA_TYPE => $dataType, OperationDefinitionObjectHandler::ENTITY_OPERATION_TYPE => $operationType, OperationDefinitionObjectHandler::ENTITY_OPERATION_ENTRY => [ @@ -418,10 +468,12 @@ public function testLooseJsonCreation() } /** - * clean up function runs after all tests + * @inheritDoc */ public static function tearDownAfterClass(): void { + parent::tearDownAfterClass(); + TestLoggingUtil::getInstance()->clearMockLoggingUtil(); } } diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/PageObjectHandlerTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/PageObjectHandlerTest.php index eb305bc4d..bfa1fa8e0 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/PageObjectHandlerTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/PageObjectHandlerTest.php @@ -3,109 +3,125 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace tests\unit\Magento\FunctionalTestFramework\Page\Handlers; -use AspectMock\Test as AspectMock; -use Magento\FunctionalTestingFramework\ObjectManager; -use Magento\FunctionalTestingFramework\ObjectManagerFactory; +use Magento\FunctionalTestingFramework\Exceptions\XmlException; use Magento\FunctionalTestingFramework\Page\Handlers\PageObjectHandler; -use Magento\FunctionalTestingFramework\XmlParser\PageParser; use tests\unit\Util\MagentoTestCase; use tests\unit\Util\ObjectHandlerUtil; use tests\unit\Util\TestLoggingUtil; +/** + * Class PageObjectHandlerTest + */ class PageObjectHandlerTest extends MagentoTestCase { /** - * Setup method + * @inheritDoc */ - public function setUp(): void + protected function setUp(): void { TestLoggingUtil::getInstance()->setMockLoggingUtil(); } - public function testGetPageObject() + /** + * Validate testGetPageObject. + * + * @return void + * @throws XmlException + */ + public function testGetPageObject(): void { $mockData = [ - "testPage1" => [ - "url" => "testURL1", - "module" => "testModule1", - "section" => [ - "someSection1" => [], - "someSection2" => [] + 'testPage1' => [ + 'url' => 'testURL1', + 'module' => 'testModule1', + 'section' => [ + 'someSection1' => [], + 'someSection2' => [] ], - "area" => "test" + 'area' => 'test' ], - "testPage2" => [ - "url" => "testURL2", - "module" => "testModule2", - "parameterized" => true, - "section" => [ - "someSection1" => [] + 'testPage2' => [ + 'url' => 'testURL2', + 'module' => 'testModule2', + 'parameterized' => true, + 'section' => [ + 'someSection1' => [] ], - "area" => "test" + 'area' => 'test' ]]; - ObjectHandlerUtil::mockPageObjectHandlerWithData($mockData); - // get pages + ObjectHandlerUtil::mockPageObjectHandlerWithData($mockData); $pageHandler = PageObjectHandler::getInstance(); $pages = $pageHandler->getAllObjects(); - $page = $pageHandler->getObject('testPage1'); + $pageHandler->getObject('testPage1'); $invalidPage = $pageHandler->getObject('someInvalidPage'); // perform asserts $this->assertCount(2, $pages); - $this->assertArrayHasKey("testPage1", $pages); - $this->assertArrayHasKey("testPage2", $pages); + $this->assertArrayHasKey('testPage1', $pages); + $this->assertArrayHasKey('testPage2', $pages); $this->assertNull($invalidPage); } - public function testGetEmptyPage() + /** + * Validate testGetEmptyPage. + * + * @return void + * @throws XmlException + */ + public function testGetEmptyPage(): void { $mockData = [ - "testPage1" => [ - "url" => "testURL1", - "module" => "testModule1", - "section" => [ + 'testPage1' => [ + 'url' => 'testURL1', + 'module' => 'testModule1', + 'section' => [ ], - "area" => "test" + 'area' => 'test' ]]; - ObjectHandlerUtil::mockPageObjectHandlerWithData($mockData); - // get pages - $page = PageObjectHandler::getInstance()->getObject('testPage1'); + ObjectHandlerUtil::mockPageObjectHandlerWithData($mockData); + PageObjectHandler::getInstance()->getObject('testPage1'); // Empty page has been read in and gotten without an exception being thrown. $this->addToAssertionCount(1); } - public function testDeprecatedPage() + /** + * Validate testDeprecatedPage. + * + * @return void + * @throws XmlException + */ + public function testDeprecatedPage(): void { $mockData = [ - "testPage1" => [ - "url" => "testURL1", - "module" => "testModule1", - "section" => [ + 'testPage1' => [ + 'url' => 'testURL1', + 'module' => 'testModule1', + 'section' => [ ], - "area" => "test", - "deprecated" => "deprecation message", - "filename" => "filename.xml" + 'area' => 'test', + 'deprecated' => 'deprecation message', + 'filename' => 'filename.xml' ]]; - ObjectHandlerUtil::mockPageObjectHandlerWithData($mockData); - // get pages - $page = PageObjectHandler::getInstance()->getObject('testPage1'); + ObjectHandlerUtil::mockPageObjectHandlerWithData($mockData); + PageObjectHandler::getInstance()->getObject('testPage1'); TestLoggingUtil::getInstance()->validateMockLogStatement( 'notice', - "NOTICE: 1 Page name violations detected. See mftf.log for details.", + 'NOTICE: 1 Page name violations detected. See mftf.log for details.', [] ); } /** - * clean up function runs after all tests + * @inheritDoc */ public static function tearDownAfterClass(): void { diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/SectionObjectHandlerTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/SectionObjectHandlerTest.php index 69088944a..79ad32b4c 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/SectionObjectHandlerTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Page/Handlers/SectionObjectHandlerTest.php @@ -3,45 +3,52 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace tests\unit\Magento\FunctionalTestFramework\Page\Handlers; -use AspectMock\Test as AspectMock; -use Magento\FunctionalTestingFramework\ObjectManager; -use Magento\FunctionalTestingFramework\ObjectManagerFactory; +use Magento\FunctionalTestingFramework\Exceptions\XmlException; use Magento\FunctionalTestingFramework\Page\Handlers\SectionObjectHandler; -use Magento\FunctionalTestingFramework\XmlParser\SectionParser; use tests\unit\Util\MagentoTestCase; use tests\unit\Util\ObjectHandlerUtil; use tests\unit\Util\TestLoggingUtil; +/** + * Class SectionObjectHandlerTest + */ class SectionObjectHandlerTest extends MagentoTestCase { /** - * Setup method + * @inheritDoc */ - public function setUp(): void + protected function setUp(): void { TestLoggingUtil::getInstance()->setMockLoggingUtil(); } - public function testGetSectionObject() + /** + * Validate testGetSectionObject. + * + * @return void + * @throws XmlException + */ + public function testGetSectionObject(): void { $mockData = [ - "testSection1" => [ - "element" => [ - "testElement" => [ - "type" => "input", - "selector" => "#element" + 'testSection1' => [ + 'element' => [ + 'testElement' => [ + 'type' => 'input', + 'selector' => '#element' ] ] ], - "testSection2" => [ - "element" => [ - "testElement" => [ - "type" => "input", - "selector" => "#element" + 'testSection2' => [ + 'element' => [ + 'testElement' => [ + 'type' => 'input', + 'selector' => '#element' ] ] ] @@ -52,29 +59,35 @@ public function testGetSectionObject() // get sections $sectionHandler = SectionObjectHandler::getInstance(); $sections = $sectionHandler->getAllObjects(); - $section = $sectionHandler->getObject("testSection1"); - $invalidSection = $sectionHandler->getObject("InvalidSection"); + $sectionHandler->getObject('testSection1'); + $invalidSection = $sectionHandler->getObject('InvalidSection'); // perform asserts $this->assertCount(2, $sections); - $this->assertArrayHasKey("testSection1", $sections); - $this->assertArrayHasKey("testSection2", $sections); + $this->assertArrayHasKey('testSection1', $sections); + $this->assertArrayHasKey('testSection2', $sections); $this->assertNull($invalidSection); } - public function testDeprecatedSection() + /** + * Validate testDeprecatedSection. + * + * @return void + * @throws XmlException + */ + public function testDeprecatedSection(): void { $mockData = [ - "testSection1" => [ - "element" => [ - "testElement" => [ - "type" => "input", - "selector" => "#element", - "deprecated" => "element deprecation message" + 'testSection1' => [ + 'element' => [ + 'testElement' => [ + 'type' => 'input', + 'selector' => '#element', + 'deprecated' => 'element deprecation message' ] ], - "filename" => "filename.xml", - "deprecated" => "section deprecation message" + 'filename' => 'filename.xml', + 'deprecated' => 'section deprecation message' ] ]; @@ -82,18 +95,18 @@ public function testDeprecatedSection() // get sections $sectionHandler = SectionObjectHandler::getInstance(); - $section = $sectionHandler->getObject("testSection1"); + $sectionHandler->getObject('testSection1'); //validate deprecation warning TestLoggingUtil::getInstance()->validateMockLogStatement( 'notice', - "NOTICE: 1 Section name violations detected. See mftf.log for details.", + 'NOTICE: 1 Section name violations detected. See mftf.log for details.', [] ); } /** - * clean up function runs after all tests + * @inheritDoc */ public static function tearDownAfterClass(): void { diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Handlers/ActionGroupObjectHandlerTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Handlers/ActionGroupObjectHandlerTest.php index 71c1833ba..71da6d492 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Handlers/ActionGroupObjectHandlerTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Handlers/ActionGroupObjectHandlerTest.php @@ -3,28 +3,29 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace tests\unit\Magento\FunctionalTestFramework\Test\Handlers; -use AspectMock\Test as AspectMock; - -use Go\Aop\Aspect; -use Magento\FunctionalTestingFramework\ObjectManager; -use Magento\FunctionalTestingFramework\ObjectManagerFactory; +use Exception; +use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException; use Magento\FunctionalTestingFramework\Test\Handlers\ActionGroupObjectHandler; -use tests\unit\Util\MagentoTestCase; use tests\unit\Util\ActionGroupArrayBuilder; -use Magento\FunctionalTestingFramework\Test\Parsers\ActionGroupDataParser; +use tests\unit\Util\MagentoTestCase; use tests\unit\Util\ObjectHandlerUtil; +/** + * Class ActionGroupObjectHandlerTest + */ class ActionGroupObjectHandlerTest extends MagentoTestCase { /** - * getObject should throw exception if test extends from itself + * Validate getObject should throw exception if test extends from itself. * - * @throws \Exception + * @return void + * @throws Exception */ - public function testGetTestObjectWithInvalidExtends() + public function testGetTestObjectWithInvalidExtends(): void { // Set up action group data $nameOne = 'actionGroupOne'; @@ -39,15 +40,16 @@ public function testGetTestObjectWithInvalidExtends() $handler = ActionGroupObjectHandler::getInstance(); - $this->expectException(\Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException::class); - $this->expectExceptionMessage("Mftf Action Group can not extend from itself: " . $nameOne); + $this->expectException(TestFrameworkException::class); + $this->expectExceptionMessage('Mftf Action Group can not extend from itself: ' . $nameOne); $handler->getObject('actionGroupOne'); } /** - * getAllObjects should throw exception if test extends from itself + * Validate getAllObjects should throw exception if test extends from itself * - * @throws \Exception + * @return void + * @throws Exception */ public function testGetAllTestObjectsWithInvalidExtends() { @@ -80,8 +82,8 @@ public function testGetAllTestObjectsWithInvalidExtends() $handler = ActionGroupObjectHandler::getInstance(); - $this->expectException(\Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException::class); - $this->expectExceptionMessage("Mftf Action Group can not extend from itself: " . $nameOne); + $this->expectException(TestFrameworkException::class); + $this->expectExceptionMessage('Mftf Action Group can not extend from itself: ' . $nameOne); $handler->getAllObjects(); } } diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionGroupAnnotationExtractorTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionGroupAnnotationExtractorTest.php index a3d2cca86..23c97fd4a 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionGroupAnnotationExtractorTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/ActionGroupAnnotationExtractorTest.php @@ -3,50 +3,54 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace tests\unit\Magento\FunctionalTestFramework\Test\Util; -use AspectMock\Test as AspectMock; +use Exception; use Magento\FunctionalTestingFramework\Test\Util\ActionGroupAnnotationExtractor; use PHPUnit\Framework\TestCase; use tests\unit\Util\TestLoggingUtil; +/** + * Class ActionGroupAnnotationExtractorTest + */ class ActionGroupAnnotationExtractorTest extends TestCase { /** - * Before test functionality - * @return void + * @inheritDoc */ - public function setUp(): void + protected function setUp(): void { TestLoggingUtil::getInstance()->setMockLoggingUtil(); } /** - * Annotation extractor takes in raw array and condenses it to expected format + * Annotation extractor takes in raw array and condenses it to expected format. * - * @throws \Exception + * @return void + * @throws Exception */ - public function testActionGroupExtractAnnotations() + public function testActionGroupExtractAnnotations(): void { // Test Data $actionGroupAnnotations = [ - "nodeName" => "annotations", - "description" => [ - "nodeName" => "description", - "value" => "someDescription" + 'nodeName' => 'annotations', + 'description' => [ + 'nodeName' => 'description', + 'value' => 'someDescription' ] ]; // Perform Test $extractor = new ActionGroupAnnotationExtractor(); - $returnedAnnotations = $extractor->extractAnnotations($actionGroupAnnotations, "fileName"); + $returnedAnnotations = $extractor->extractAnnotations($actionGroupAnnotations, 'fileName'); // Asserts - $this->assertEquals("someDescription", $returnedAnnotations['description']); + $this->assertEquals('someDescription', $returnedAnnotations['description']); } /** - * After class functionality - * @return void + * @inheritDoc */ public static function tearDownAfterClass(): void { diff --git a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/AnnotationExtractorTest.php b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/AnnotationExtractorTest.php index 735c33492..44ec3a7aa 100644 --- a/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/AnnotationExtractorTest.php +++ b/dev/tests/unit/Magento/FunctionalTestFramework/Test/Util/AnnotationExtractorTest.php @@ -3,114 +3,119 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace tests\unit\Magento\FunctionalTestFramework\Test\Util; -use AspectMock\Proxy\Verifier; -use AspectMock\Test as AspectMock; +use Exception; +use Magento\FunctionalTestingFramework\Exceptions\TestFrameworkException; +use Magento\FunctionalTestingFramework\Exceptions\XmlException; use Magento\FunctionalTestingFramework\Test\Util\AnnotationExtractor; -use Monolog\Handler\TestHandler; -use Monolog\Logger; +use Magento\FunctionalTestingFramework\Util\GenerationErrorHandler; use PHPUnit\Framework\TestCase; use tests\unit\Util\TestLoggingUtil; -use Magento\FunctionalTestingFramework\Util\GenerationErrorHandler; +/** + * Class AnnotationExtractorTest + */ class AnnotationExtractorTest extends TestCase { /** - * Before test functionality - * @return void + * @inheritDoc */ - public function setUp(): void + protected function setUp(): void { TestLoggingUtil::getInstance()->setMockLoggingUtil(); } /** - * Annotation extractor takes in raw array and condenses it to expected format + * Annotation extractor takes in raw array and condenses it to expected format. * - * @throws \Exception + * @return void + * @throws Exception */ - public function testExtractAnnotations() + public function testExtractAnnotations(): void { // Test Data $testAnnotations = [ - "nodeName" => "annotations", - "features" => [ + 'nodeName' => 'annotations', + 'features' => [ [ - "nodeName" => "features", - "value" => "TestFeatures" + 'nodeName' => 'features', + 'value' => 'TestFeatures' ] ], - "stories" => [ + 'stories' => [ [ - "nodeName" => "stories", - "value" => "TestStories" + 'nodeName' => 'stories', + 'value' => 'TestStories' ] ], - "description" => [ + 'description' => [ [ - "nodeName" => "description", - "value" => "TestDescription" + 'nodeName' => 'description', + 'value' => 'TestDescription' ] ], - "severity" => [ + 'severity' => [ [ - "nodeName" => "severity", - "value" => "CRITICAL" + 'nodeName' => 'severity', + 'value' => 'CRITICAL' ] ], - "group" => [ + 'group' => [ [ - "nodeName" => "group", - "value" => "TestGroup" + 'nodeName' => 'group', + 'value' => 'TestGroup' ] ], ]; // Perform Test $extractor = new AnnotationExtractor(); - $returnedAnnotations = $extractor->extractAnnotations($testAnnotations, "testFileName"); + $returnedAnnotations = $extractor->extractAnnotations($testAnnotations, 'testFileName'); // Asserts - $this->assertEquals("TestFeatures", $returnedAnnotations['features'][0]); - $this->assertEquals("TestStories", $returnedAnnotations['stories'][0]); - $this->assertEquals("TestDescription", $returnedAnnotations['description'][0]); - $this->assertEquals("CRITICAL", $returnedAnnotations['severity'][0]); - $this->assertEquals("TestGroup", $returnedAnnotations['group'][0]); + $this->assertEquals('TestFeatures', $returnedAnnotations['features'][0]); + $this->assertEquals('TestStories', $returnedAnnotations['stories'][0]); + $this->assertEquals('TestDescription', $returnedAnnotations['description'][0]); + $this->assertEquals('CRITICAL', $returnedAnnotations['severity'][0]); + $this->assertEquals('TestGroup', $returnedAnnotations['group'][0]); } /** - * Annotation extractor should throw warning when required annotations are missing + * Annotation extractor should throw warning when required annotations are missing. * - * @throws \Exception + * @return void + * @throws Exception */ - public function testMissingAnnotations() + public function testMissingAnnotations(): void { // Test Data, missing title, description, and severity $testAnnotations = [ - "nodeName" => "annotations", - "features" => [ + 'nodeName' => 'annotations', + 'features' => [ [ - "nodeName" => "features", - "value" => "TestFeatures" + 'nodeName' => 'features', + 'value' => 'TestFeatures' ] ], - "stories" => [ + 'stories' => [ [ - "nodeName" => "stories", - "value" => "TestStories" + 'nodeName' => 'stories', + 'value' => 'TestStories' ] ], - "group" => [ + 'group' => [ [ - "nodeName" => "group", - "value" => "TestGroup" + 'nodeName' => 'group', + 'value' => 'TestGroup' ] ], ]; // Perform Test $extractor = new AnnotationExtractor(); - $returnedAnnotations = $extractor->extractAnnotations($testAnnotations, "testFileName"); + $extractor->extractAnnotations($testAnnotations, 'testFileName'); // Asserts TestLoggingUtil::getInstance()->validateMockLogStatement( @@ -118,61 +123,62 @@ public function testMissingAnnotations() 'DEPRECATION: Test testFileName is missing required annotations.', [ 'testName' => 'testFileName', - 'missingAnnotations' => "title, description, severity" + 'missingAnnotations' => 'title, description, severity' ] ); } /** - * Annotation extractor should throw warning when required annotations are empty + * Annotation extractor should throw warning when required annotations are empty. * - * @throws \Exception + * @return void + * @throws Exception */ - public function testEmptyRequiredAnnotations() + public function testEmptyRequiredAnnotations(): void { // Test Data, missing title, description, and severity $testAnnotations = [ - "nodeName" => "annotations", - "features" => [ + 'nodeName' => 'annotations', + 'features' => [ [ - "nodeName" => "features", - "value" => "" + 'nodeName' => 'features', + 'value' => '' ] ], - "stories" => [ + 'stories' => [ [ - "nodeName" => "stories", - "value" => "TestStories" + 'nodeName' => 'stories', + 'value' => 'TestStories' ] ], - "title" => [ + 'title' => [ [ - "nodeName" => "title", - "value" => " " + 'nodeName' => 'title', + 'value' => ' ' ] ], - "description" => [ + 'description' => [ [ - "nodeName" => "description", - "value" => "\t" + 'nodeName' => 'description', + 'value' => "\t" ] ], - "severity" => [ + 'severity' => [ [ - "nodeName" => "severity", - "value" => "" + 'nodeName' => 'severity', + 'value' => '' ] ], - "group" => [ + 'group' => [ [ - "nodeName" => "group", - "value" => "TestGroup" + 'nodeName' => 'group', + 'value' => 'TestGroup' ] ], ]; // Perform Test $extractor = new AnnotationExtractor(); - $returnedAnnotations = $extractor->extractAnnotations($testAnnotations, "testFileName"); + $returnedAnnotations = $extractor->extractAnnotations($testAnnotations, 'testFileName'); // Asserts TestLoggingUtil::getInstance()->validateMockLogStatement( @@ -180,90 +186,96 @@ public function testEmptyRequiredAnnotations() 'DEPRECATION: Test testFileName is missing required annotations.', [ 'testName' => 'testFileName', - 'missingAnnotations' => "title, description, severity" + 'missingAnnotations' => 'title, description, severity' ] ); } - public function testTestCaseIdUniqueness() + /** + * Validate testTestCaseIdUniqueness. + * + * @return void + * @throws TestFrameworkException|XmlException + */ + public function testTestCaseIdUniqueness(): void { // Test Data $firstTestAnnotation = [ - "nodeName" => "annotations", - "features" => [ + 'nodeName' => 'annotations', + 'features' => [ [ - "nodeName" => "features", - "value" => "TestFeatures" + 'nodeName' => 'features', + 'value' => 'TestFeatures' ] ], - "stories" => [ + 'stories' => [ [ - "nodeName" => "stories", - "value" => "TestStories" + 'nodeName' => 'stories', + 'value' => 'TestStories' ] ], - "title" => [ + 'title' => [ [ - "nodeName" => "title", - "value" => "TEST TITLE" + 'nodeName' => 'title', + 'value' => 'TEST TITLE' ] ], - "severity" => [ + 'severity' => [ [ - "nodeName" => "severity", - "value" => "CRITICAL" + 'nodeName' => 'severity', + 'value' => 'CRITICAL' ] ], - "testCaseId" => [ + 'testCaseId' => [ [ - "nodeName" => "testCaseId", - "value" => "MQE-0001" + 'nodeName' => 'testCaseId', + 'value' => 'MQE-0001' ] ], ]; $secondTestannotation = [ - "nodeName" => "annotations", - "features" => [ + 'nodeName' => 'annotations', + 'features' => [ [ - "nodeName" => "features", - "value" => "TestFeatures" + 'nodeName' => 'features', + 'value' => 'TestFeatures' ] ], - "stories" => [ + 'stories' => [ [ - "nodeName" => "stories", - "value" => "TestStories" + 'nodeName' => 'stories', + 'value' => 'TestStories' ] ], - "title" => [ + 'title' => [ [ - "nodeName" => "title", - "value" => "TEST TITLE" + 'nodeName' => 'title', + 'value' => 'TEST TITLE' ] ], - "severity" => [ + 'severity' => [ [ - "nodeName" => "severity", - "value" => "CRITICAL" + 'nodeName' => 'severity', + 'value' => 'CRITICAL' ] ], - "testCaseId" => [ + 'testCaseId' => [ [ - "nodeName" => "testCaseId", - "value" => "MQE-0001" + 'nodeName' => 'testCaseId', + 'value' => 'MQE-0001' ] ], ]; // Perform Test $extractor = new AnnotationExtractor(); - $extractor->extractAnnotations($firstTestAnnotation, "firstTest"); - $extractor->extractAnnotations($secondTestannotation, "secondTest"); + $extractor->extractAnnotations($firstTestAnnotation, 'firstTest'); + $extractor->extractAnnotations($secondTestannotation, 'secondTest'); $extractor->validateTestCaseIdTitleUniqueness(); // assert that no exception for validateTestCaseIdTitleUniqueness // and validation error is stored in GenerationErrorHandler $errorMessage = '/' - . preg_quote("TestCaseId and Title pairs is not unique in Tests 'firstTest', 'secondTest'") + . preg_quote('TestCaseId and Title pairs is not unique in Tests \'firstTest\', \'secondTest\'') . '/'; TestLoggingUtil::getInstance()->validateMockLogStatmentRegex('error', $errorMessage, []); $testErrors = GenerationErrorHandler::getInstance()->getErrorsByType('test'); @@ -271,14 +283,16 @@ public function testTestCaseIdUniqueness() $this->assertArrayHasKey('secondTest', $testErrors); } - public function tearDown(): void + /** + * @inheritDoc + */ + protected function tearDown(): void { GenerationErrorHandler::getInstance()->reset(); } /** - * After class functionality - * @return void + * @inheritDoc */ public static function tearDownAfterClass(): void {