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

Module catalog, Attribute Repository code validation regex #29015

Merged
merged 7 commits into from
Sep 25, 2020

Conversation

drc0
Copy link
Contributor

@drc0 drc0 commented Jul 6, 2020

Regex modified to accept the A-Z range and check for Magento\Eav\Model\Entity\Attribute::ATTRIBUTE_CODE_MAX_LENGTH instead of the old hardcoded value (30)

Description (*)

In the magento module catalog, in the method validateCode for product attribute attribute_code field, there were a check for the attribute length that do not respect the Magento\Eav\Model\Entity\Attribute::ATTRIBUTE_CODE_MAX_LENGTH constant, also I think it should accept chars of the A-Z range.

fixes #29017

Regex modified to accept the A-Z range and check for Magento\Eav\Model\Entity\Attribute::ATTRIBUTE_CODE_MAX_LENGTH instead of the old hardcoded value (30)
@m2-assistant
Copy link

m2-assistant bot commented Jul 6, 2020

Hi @drc0. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@drc0
Copy link
Contributor Author

drc0 commented Jul 6, 2020

@magento run all tests

@sidolov sidolov added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels Aug 18, 2020
@VladimirZaets
Copy link
Contributor

@magento run all tests

Copy link
Contributor

@gabrieldagama gabrieldagama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @drc0, thanks for the pull request, it looks good!

Please follow below some comments on it, can you fix the static tests failures?

We also need to cover the changes with some tests, we could create some integration tests to validate the changes proposed on this PR, let me know if you are able to create these tests!

Thank you!

@ghost ghost moved this from Pending Review to Changes Requested in Pull Requests Dashboard Aug 25, 2020
@ghost ghost assigned gabrieldagama Aug 25, 2020
@drc0
Copy link
Contributor Author

drc0 commented Aug 25, 2020

Hi @drc0, thanks for the pull request, it looks good!

Please follow below some comments on it, can you fix the static tests failures?

We also need to cover the changes with some tests, we could create some integration tests to validate the changes proposed on this PR, let me know if you are able to create these tests!

Thank you!

For now I'm unable to create a test for the proposed changes. should app/code/Magento/Catalog/Test/Unit/Model/Product/Attribute/RepositoryTest.php be modified to check for this validation on the length of the attribute code adding a new class method for the test case?

@gabrieldagama
Copy link
Contributor

Hi @drc0, yeah I guess we can update that unit test to validate the proposed changes. Thanks!

@engcom-Charlie engcom-Charlie self-assigned this Aug 27, 2020
@engcom-Charlie
Copy link
Contributor

Hi @drc0 can you please look at #29015 (comment) ?
Thank you.

@engcom-Charlie
Copy link
Contributor

Hi @drc0, I'll take care of test coverage.

@drc0
Copy link
Contributor Author

drc0 commented Aug 31, 2020

Hi @drc0, I'll take care of test coverage.

awesome, thank you.

@engcom-Charlie
Copy link
Contributor

Hi @drc0, can you please take a look at #29017 (comment)?
Thank you.

@engcom-Charlie
Copy link
Contributor

I close PR because the issue isn't produced anymore.

@m2-assistant
Copy link

m2-assistant bot commented Sep 3, 2020

Hi @drc0, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ghost ghost removed this from Changes Requested in Pull Requests Dashboard Sep 3, 2020
@ghost ghost moved this from Review in Progress to Ready for Testing in Pull Requests Dashboard Sep 17, 2020
@ghost ghost assigned gabrieldagama Sep 17, 2020
@magento-engcom-team
Copy link
Contributor

Hi @gabrieldagama, thank you for the review.
ENGCOM-8229 has been created to process this Pull Request
✳️ @gabrieldagama, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@magento-engcom-team
Copy link
Contributor

@drc0 thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@gabrieldagama gabrieldagama added the Auto-Tests: Covered All changes in Pull Request is covered by auto-tests label Sep 17, 2020
@engcom-Delta engcom-Delta self-assigned this Sep 23, 2020
@engcom-Delta engcom-Delta moved this from Ready for Testing to Testing in Progress in Pull Requests Dashboard Sep 23, 2020
@engcom-Delta
Copy link
Contributor

✔️ QA passed
Result:
Before:
❌ Attribute with code length more than 30 but less than 60 symbols cannot be created
#29017Main

After:
✔️ Attribute with code length more than 30 but less than 60 symbols is successfully created
#29017PRapi

@engcom-Delta
Copy link
Contributor

Note: Functional Tests B2B are failed

@engcom-Delta engcom-Delta moved this from Testing in Progress to Extended Testing (optional) in Pull Requests Dashboard Sep 24, 2020
@engcom-Charlie engcom-Charlie added the QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) label Sep 24, 2020
@engcom-Delta engcom-Delta added QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope and removed QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) labels Sep 24, 2020
@engcom-Charlie engcom-Charlie moved this from Extended Testing (optional) to Merge in Progress in Pull Requests Dashboard Sep 24, 2020
@magento-engcom-team magento-engcom-team merged commit 58b60ef into magento:2.4-develop Sep 25, 2020
@m2-assistant
Copy link

m2-assistant bot commented Sep 25, 2020

Hi @drc0, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@ghost ghost moved this from Merge in Progress to Recently Merged in Pull Requests Dashboard Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Component: Catalog Priority: P3 May be fixed according to the position in the backlog. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Risk: low Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Pull Requests Dashboard
  
Recently Merged
Development

Successfully merging this pull request may close these issues.

Product Attribute Repository do not respect attribute_code max length
7 participants