-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Open
Labels
Area: FrameworkComponent: Framework/TestFrameworkIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Description
Preconditions and environment
- Magento version: 2.4-develop
Steps to reproduce
- Open the integration test
dev/tests/integration/testsuite/Magento/Eav/Setup/EavSetupTest.php
- Append a new test at the end of the file, which should definitely succeed. For example this one:
public function testAddAttributeAfterInvalidAttributeCodesWereTriedToBeAdded(): void
{
$attributeData = $this->getAttributeData();
$this->eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'test_123', $attributeData);
}
- Now, execute all tests in the file (
cd dev/tests/integration && ../../../vendor/bin/phpunit --filter EavSetupTest
)
Expected result
All tests should be completed successfully.
Actual result
Our simple test fails, although it should not. The following message is outputted:
There was 1 error:
- Magento\Eav\Setup\EavSetupTest::testAddAttributeAfterInvalidAttributeCodesWereTriedToBeAdded
Magento\Framework\Exception\LocalizedException: An attribute code must not be less than 1 and more than 60 characters.\nAn attribute code must not be less than 1 and more than 60 characters.\nAn attribute code must not be less than 1 and more than 60 characters.\nAn attribute code must not be less than 1 and more than 60 characters.\nAttribute code "1first_character_is_not_letter" is invalid. Please use only letters (a-z or A-Z), numbers (0-9) or underscore () in this field, and the first character should be a letter.\nAttribute code "attribute.with.dots" is invalid. Please use only letters (a-z or A-Z), numbers (0-9) or underscore () in this field, and the first character should be a letter.
The reason is that during the previous tests, which tested to add attributes with invalid codes, the Magento\Eav\Model\Validator\Attribute\Code
added error messages to its internal array, which are never resetted. That's why subsequent tests, which try to add attributes, will fail.
Additional information
No response
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Area: FrameworkComponent: Framework/TestFrameworkIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.A defect with this priority could have functionality issues which are not to expectations.Reported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itIssue related to Developer Experience and needs help with Triage to Confirm or Reject it
Type
Projects
Status
Ready for Development