magento2
magento2 copied to clipboard
Fix Patch aliases usage (issue #31396)
Description (*)
Currently the aliases are useless and have no meaningful usage in codebase.
See documentation: https://developer.adobe.com/commerce/php/development/components/declarative-schema/patches/
public function getAliases() { /** * This internal method, that means that some patches with time can change their names, * but changing name should not affect installation process, that's why if we will change name of the patch * we will add alias here */ return [];
Related Pull Requests
- https://github.com/magento/magento2/pull/37682
Fixed Issues (if relevant)
- Fixes magento/magento2#31396
- Fixes magento/magento2#23031
Manual testing scenarios (*)
-
Add a patch with aliases
-
None of the aliases must exists in db
-
Run setup:upgrade
-
The patch and its aliases are added to patch_list table
-
Add a patch with aliases
-
Any of its aliases must exists in db
-
Run setup:upgrade
-
The patch is not ran because it's already applied previously by one of its aliases
Questions or comments
I did not edit the \Magento\Framework\Setup\Patch\PatchHistory::isApplied for BC purpose. However it would have been better to have this method updated to get a PatchInterface as an argument and check for its aliases there.
Contribution checklist (*)
- [x] Pull request has a meaningful description of its purpose
- [x] All commits are accompanied by meaningful commit messages
- [x] All new or changed code is covered with unit/integration tests (if applicable)
- [x] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
- [x] All automated tests passed successfully (all builds are green)
Hi @thomas-kl1. Thank you for your contribution! Here are some useful tips on 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
:exclamation: 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:
Database CompareFunctional Tests CEFunctional Tests EEFunctional Tests B2BIntegration TestsMagento Health IndexSample Data Tests CESample Data Tests EESample Data Tests B2BStatic TestsUnit TestsWebAPI TestsSemantic Version Checker
You can find more information about the builds here :information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.
For more details, review the Code Contributions documentation. Join Magento Community Engineering Slack and ask your questions in #github channel.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.
Functional tests failures are not related to the PR. Unit test must be updated accordingly.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.
@magento run all tests
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.
@magento run all tests
@magento run all tests
@magento run all tests
@engcom-Hotel I've updated this PR description and removed the reference.
@magento run all tests
@engcom-Hotel
Regarding static test failures, it's related to the copyright header change, I'll check, could you give the new copyright to apply please? https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/38239/079f4563d120ab5795fb65006c654d26/Statics/console-error-logs.html
Units tests failure are not related to this PR and seems related to RMA changes (not in scope of this PR): https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/38239/5da9f12d3970de433b743d636689530d/Unit/console-error-logs.html
Webapi tests, I dont see how it's related to this PR change 🤔
Functional tests, I dont see how it's related to this PR change 🤔
@magento run all tests
Hi @thomas-kl1,
Thank you for your contribution!
I have followed below steps in order to reproduce the test the PR.
:heavy_check_mark: QA Passed
Before PR :heavy_multiplication_x:
- Create a patch called 'ExampleDataPatch' with no aliases
class ExampleDataPatch implements DataPatchInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;
/**
* @var LoggerInterface
*/
private $logger;
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
LoggerInterface $logger
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->logger = $logger;
}
public function apply()
{
$this->moduleDataSetup->startSetup();
$this->logger->info('ExampleSchemaPatch: Apply method executed.');
$this->moduleDataSetup->endSetup();
}
public static function getDependencies()
{
return [];
}
public function getAliases()
{
return [];
}
}
- Run
bin/magento setup:upgrade, patch ExampleDataPatch gets applied and 'ExampleDataPatch' is added to the patch_list table - Rename patch ExampleDataPatch file and class name to 'ChangedExampleDataPatch'
- Add 'ExampleDataPatch' to the aliases
public function getAliases()
{
return [
ExampleDataPatch::Class
];
}
- Run
bin/magento setup:upgradeagain, patch ExampleDataPatch gets applied again verified it from log file and 'ChangedExampleDataPatch' is added to the patch_list table
After PR Changes :heavy_check_mark:
- Followed step 1-6 as above
- Run
bin/magento setup:upgradeagain, patch ExampleDataPatch didn't get applied again verified from log file andChangedExampleDataPatchis getting added to thepatch_listtable.
As the build is failing, moving this PR to Extended Testing.
@magento run all tests
@magento run Functional Tests B2B, Functional Tests EE
@engcom-Charlie the integration tests failures are not related to these changes.
@magento run all tests
@magento run Functional Tests B2B, Functional Tests CE, Unit Tests
The Functional B2B in recent 2 builds have one common failure and its a known issue. The rest are neither part of PR nor affected by PR changes.
Run 1: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/38239/965d2598a51e2d0368da7fff85e5e50e/Functional/allure-report-b2b/index.html#categories
Run 2: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/38239/b68be97fd9a9ffd4638e21cddcf4f033/Functional/allure-report-b2b/index.html#categories/2fc037f47773dd7551f2e766bbf34efa/9a053d1c29d42d2b/
Known Issue: ACQE-8287: StorefrontProductNoLongerVisibleInWishlistOnceUserUnassignedFromCompanyTest
The Functional CE failures are not consistent in recent 2 builds. The rest are neither part of PR nor affected by PR changes, seems to be flaky. Hence moving this PR to Merge in Progress.
Run 1: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/38239/800b0099885f5877ec1d695c6f0fb73f/Functional/allure-report-ce/index.html#categories/1a0b192d5a64d4dd09e28ae8fc5f85a9/f5feee72e4f291fc/
Run 2: https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/38239/3e81af210aa85ebe41370fa39b7dcdb7/Functional/allure-report-ce/index.html#categories