diff --git a/dev/Docker/setup-magento-with-diff.sh b/dev/Docker/setup-magento-with-diff.sh index 70766f78..2eb5c109 100755 --- a/dev/Docker/setup-magento-with-diff.sh +++ b/dev/Docker/setup-magento-with-diff.sh @@ -96,10 +96,10 @@ else $COMPOSER_TO install --no-interaction --ignore-platform-reqs fi # Spoof some changes into our "third party" test module so they appear in the diff -echo "" >> vendor/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/theme/Magento_Customer/templates/account/dashboard/info.phtml -echo "" >> vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/form.phtml -echo "" >> vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/templates/checkout/something.phtml -echo "" >> vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/templates/cart/form.phtml # ensure that third party theme modifications show as expected +echo "" >> vendor/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/theme/Magento_Customer/templates/account/dashboard/info.phtml +echo "" >> vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/form.phtml +echo "" >> vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/templates/checkout/something.phtml +echo "" >> vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/templates/cart/form.phtml # ensure that third party theme modifications show as expected rm vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php rm vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php echo '//not-meaningful' >> vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndIgnore.php @@ -115,6 +115,10 @@ echo '$b=1;' >> vendor/ampersand/upgrade-patch-helper-test-module/src/module/Se cp vendor/ampersand/upgrade-patch-helper-test-module/src/module/etc/db_schema.after.xml vendor/ampersand/upgrade-patch-helper-test-module/src/module/etc/db_schema.xml rm vendor/ampersand/upgrade-patch-helper-test-module-to-be-removed/src/module/etc/db_schema.xml +if [[ "$MAGE_TO" == 2.3* ]]; then + echo "" >> vendor/magento/module-bundle/view/frontend/templates/js/components.phtml +fi + # Ensure all test cases that were in the 2.2 series tests are represented in others echo "//some change" >> vendor/magento/module-sales/Block/Adminhtml/Order/Create/Form.php echo "

some change

" >> vendor/magento/module-ui/view/base/web/templates/block-loader.html @@ -123,11 +127,13 @@ echo "

some change

" >> vendor/magento/module-ui/view/base/web/tem echo " " >> vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html echo " " >> vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html echo " " >> vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/redundant.js +echo " " >> vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml # Ignored change echo "" >> vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/ignore.html echo "" >> vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/ignore.html echo "/* some comment */" >> vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/ignore.js +echo "" >> vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/ignored.phtml echo "#" >> vendor/magento/module-customer/view/frontend/web/js/model/authentication-popup.js diff --git a/dev/TestHyvaExtendedTheme/theme/Magento_Checkout/templates/cart/ignored.phtml b/dev/TestHyvaExtendedTheme/theme/Magento_Checkout/templates/cart/ignored.phtml new file mode 100644 index 00000000..6b1e9983 --- /dev/null +++ b/dev/TestHyvaExtendedTheme/theme/Magento_Checkout/templates/cart/ignored.phtml @@ -0,0 +1 @@ +

ignored - some customisation

\ No newline at end of file diff --git a/dev/TestHyvaExtendedTheme/theme/Magento_Checkout/templates/cart/redundant.phtml b/dev/TestHyvaExtendedTheme/theme/Magento_Checkout/templates/cart/redundant.phtml new file mode 100644 index 00000000..4c64227a --- /dev/null +++ b/dev/TestHyvaExtendedTheme/theme/Magento_Checkout/templates/cart/redundant.phtml @@ -0,0 +1 @@ +

redundant

\ No newline at end of file diff --git a/dev/TestHyvaThemeStub/theme/Magento_Checkout/templates/cart/ignored.phtml b/dev/TestHyvaThemeStub/theme/Magento_Checkout/templates/cart/ignored.phtml new file mode 100644 index 00000000..e9e6e482 --- /dev/null +++ b/dev/TestHyvaThemeStub/theme/Magento_Checkout/templates/cart/ignored.phtml @@ -0,0 +1 @@ +

ignored - base

\ No newline at end of file diff --git a/dev/TestHyvaThemeStub/theme/Magento_Checkout/templates/cart/redundant.phtml b/dev/TestHyvaThemeStub/theme/Magento_Checkout/templates/cart/redundant.phtml new file mode 100644 index 00000000..4c64227a --- /dev/null +++ b/dev/TestHyvaThemeStub/theme/Magento_Checkout/templates/cart/redundant.phtml @@ -0,0 +1 @@ +

redundant

\ No newline at end of file diff --git a/dev/TestModule/app/design/frontend/Ampersand/theme/Magento_Bundle/templates/js/components.phtml b/dev/TestModule/app/design/frontend/Ampersand/theme/Magento_Bundle/templates/js/components.phtml index 4ea499f3..4b9fa166 100644 --- a/dev/TestModule/app/design/frontend/Ampersand/theme/Magento_Bundle/templates/js/components.phtml +++ b/dev/TestModule/app/design/frontend/Ampersand/theme/Magento_Bundle/templates/js/components.phtml @@ -5,4 +5,4 @@ */ ?> getChildHtml() ?> - +

We have overridden this file

diff --git a/dev/phpunit/functional/expected_output/auto-apply-patch.txt b/dev/phpunit/functional/expected_output/auto-apply-patch.txt index f6819001..2c5e7f2b 100644 --- a/dev/phpunit/functional/expected_output/auto-apply-patch.txt +++ b/dev/phpunit/functional/expected_output/auto-apply-patch.txt @@ -6,4 +6,4 @@ ?> getChildHtml() ?> - +

We have overridden this file

diff --git a/dev/phpunit/functional/expected_output/magentom23.out.txt b/dev/phpunit/functional/expected_output/magentom23.out.txt index 4b2a235c..644a8f95 100644 --- a/dev/phpunit/functional/expected_output/magentom23.out.txt +++ b/dev/phpunit/functional/expected_output/magentom23.out.txt @@ -63,11 +63,12 @@ | WARN | Preference | vendor/magento/module-authorizenet/Model/Directpost.php | Ampersand\Test\Model\WebApiSoap\Directpost | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete | +| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/redundant.phtml | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/redundant.js | app/design/frontend/Ampersand/theme/Magento_Checkout/web/js/redundant.js | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html | +-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+ -WARN count: 65 +WARN count: 66 INFO count: 309 (to view re-run this tool with --show-info) -IGNORE count: 5 (to view re-run this tool with --show-ignore) +IGNORE count: 6 (to view re-run this tool with --show-ignore) For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md \ No newline at end of file diff --git a/dev/phpunit/functional/expected_output/magentom23VendorNamespaces.out.txt b/dev/phpunit/functional/expected_output/magentom23VendorNamespaces.out.txt index 3b8c1dba..80c7fcbe 100644 --- a/dev/phpunit/functional/expected_output/magentom23VendorNamespaces.out.txt +++ b/dev/phpunit/functional/expected_output/magentom23VendorNamespaces.out.txt @@ -64,11 +64,12 @@ | WARN | Preference | vendor/magento/module-authorizenet/Model/Directpost.php | Ampersand\Test\Model\WebApiSoap\Directpost | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete | +| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/redundant.phtml | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/redundant.js | app/design/frontend/Ampersand/theme/Magento_Checkout/web/js/redundant.js | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html | +-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+ -WARN count: 66 +WARN count: 67 INFO count: 309 (to view re-run this tool with --show-info) -IGNORE count: 5 (to view re-run this tool with --show-ignore) +IGNORE count: 6 (to view re-run this tool with --show-ignore) For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md \ No newline at end of file diff --git a/dev/phpunit/functional/expected_output/magentom24-nodb.out.txt b/dev/phpunit/functional/expected_output/magentom24-nodb.out.txt index f2c0cb0f..2243bc11 100644 --- a/dev/phpunit/functional/expected_output/magentom24-nodb.out.txt +++ b/dev/phpunit/functional/expected_output/magentom24-nodb.out.txt @@ -56,13 +56,14 @@ | WARN | Preference | vendor/magento/module-weee/Model/Total/Quote/Weee.php | Ampersand\Test\Model\WebApiSoap\Total\Quote\Weee | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete | +| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/redundant.phtml | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/redundant.js | app/design/frontend/Ampersand/theme/Magento_Checkout/web/js/redundant.js | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html | | WARN | Redundant Override | vendor/magento/theme-frontend-blank/etc/view.xml | vendor/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/theme/etc/view.xml | | WARN | Redundant Override | vendor/paypal/module-braintree-core/view/base/web/js/form-builder.js | vendor/paypal/module-braintree-core/view/frontend/web/js/form-builder.js | +-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+ -WARN count: 60 +WARN count: 61 INFO count: 395 (to view re-run this tool with --show-info) -IGNORE count: 6 (to view re-run this tool with --show-ignore) +IGNORE count: 7 (to view re-run this tool with --show-ignore) For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md \ No newline at end of file diff --git a/dev/phpunit/functional/expected_output/magentom24-show-info.out.txt b/dev/phpunit/functional/expected_output/magentom24-show-info.out.txt index 78f48cbe..94db0e1f 100644 --- a/dev/phpunit/functional/expected_output/magentom24-show-info.out.txt +++ b/dev/phpunit/functional/expected_output/magentom24-show-info.out.txt @@ -56,6 +56,7 @@ | WARN | Preference | vendor/magento/module-weee/Model/Total/Quote/Weee.php | Ampersand\Test\Model\WebApiSoap\Total\Quote\Weee | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete | +| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/redundant.phtml | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/redundant.js | app/design/frontend/Ampersand/theme/Magento_Checkout/web/js/redundant.js | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html | @@ -456,6 +457,7 @@ | INFO | Setup Patch Data | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Setup/Patch/Data/SomeDataChanges.php | Ampersand\TestVendor\Setup\Patch\Data\SomeDataChanges | | INFO | Setup Patch Schema | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Setup/Patch/Schema/SomeSchemaChanges.php | Ampersand\TestVendor\Setup\Patch\Schema\SomeSchemaChanges | | INFO | Setup Script | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Setup/InstallSchema.php | Ampersand\TestVendor\Setup\InstallSchema | +| IGNR | Override (phtml/js/html) | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/ignored.phtml | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/ignored.phtml | | IGNR | Override (phtml/js/html) | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/ignore.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/ignore.html | | IGNR | Override (phtml/js/html) | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/ignore.js | app/design/frontend/Ampersand/theme/Magento_Checkout/web/js/ignore.js | | IGNR | Override (phtml/js/html) | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/ignore.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/ignore.html | @@ -463,7 +465,7 @@ | IGNR | Override (phtml/js/html) | vendor/magento/module-vault/view/frontend/web/js/view/payment/method-renderer/vault.js | app/design/frontend/Ampersand/theme/Magento_Vault/web/js/view/payment/method-renderer/vault.js | | IGNR | Preference | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndIgnore.php | Ampersand\Test\Model\ToPreferenceAndIgnore | +-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+ -WARN count: 60 +WARN count: 61 INFO count: 395 -IGNORE count: 6 +IGNORE count: 7 For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md \ No newline at end of file diff --git a/dev/phpunit/functional/expected_output/magentom24.out.txt b/dev/phpunit/functional/expected_output/magentom24.out.txt index 3d466042..244ea28d 100644 --- a/dev/phpunit/functional/expected_output/magentom24.out.txt +++ b/dev/phpunit/functional/expected_output/magentom24.out.txt @@ -54,13 +54,14 @@ | WARN | Preference | vendor/magento/module-weee/Model/Total/Quote/Weee.php | Ampersand\Test\Model\WebApiSoap\Total\Quote\Weee | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete | +| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/redundant.phtml | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/redundant.js | app/design/frontend/Ampersand/theme/Magento_Checkout/web/js/redundant.js | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html | | WARN | Redundant Override | vendor/magento/theme-frontend-blank/etc/view.xml | vendor/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/theme/etc/view.xml | | WARN | Redundant Override | vendor/paypal/module-braintree-core/view/base/web/js/form-builder.js | vendor/paypal/module-braintree-core/view/frontend/web/js/form-builder.js | +-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+ -WARN count: 58 +WARN count: 59 INFO count: 395 (to view re-run this tool with --show-info) -IGNORE count: 6 (to view re-run this tool with --show-ignore) +IGNORE count: 7 (to view re-run this tool with --show-ignore) For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md \ No newline at end of file diff --git a/dev/phpunit/functional/expected_output/magentom2451-nodb.out.txt b/dev/phpunit/functional/expected_output/magentom2451-nodb.out.txt index 7d5fa63c..58bb9c1a 100644 --- a/dev/phpunit/functional/expected_output/magentom2451-nodb.out.txt +++ b/dev/phpunit/functional/expected_output/magentom2451-nodb.out.txt @@ -57,12 +57,13 @@ | WARN | Preference | vendor/magento/module-weee/Model/Total/Quote/Weee.php | Ampersand\Test\Model\WebApiSoap\Total\Quote\Weee | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete | +| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/redundant.phtml | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/redundant.js | app/design/frontend/Ampersand/theme/Magento_Checkout/web/js/redundant.js | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html | | WARN | Redundant Override | vendor/paypal/module-braintree-core/view/base/web/js/form-builder.js | vendor/paypal/module-braintree-core/view/frontend/web/js/form-builder.js | +-------+--------------------------+------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+ -WARN count: 60 +WARN count: 61 INFO count: 384 (to view re-run this tool with --show-info) -IGNORE count: 6 (to view re-run this tool with --show-ignore) +IGNORE count: 7 (to view re-run this tool with --show-ignore) For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md \ No newline at end of file diff --git a/dev/phpunit/functional/expected_output/magentom24nodb-threeway-diff.out.txt b/dev/phpunit/functional/expected_output/magentom24nodb-threeway-diff.out.txt index ba467830..a2d62b8f 100644 --- a/dev/phpunit/functional/expected_output/magentom24nodb-threeway-diff.out.txt +++ b/dev/phpunit/functional/expected_output/magentom24nodb-threeway-diff.out.txt @@ -56,6 +56,7 @@ | WARN | Preference | vendor/magento/module-weee/Model/Total/Quote/Weee.php | Ampersand\Test\Model\WebApiSoap\Total\Quote\Weee | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php | Ampersand\Test\Model\ToPreferenceAndDelete | | WARN | Preference Removed | vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndExtendAndDelete.php | Ampersand\Test\Model\ToPreferenceAndExtendAndDelete | +| WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml | vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/redundant.phtml | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/module/view/frontend/email/redundant.html | app/design/frontend/Ampersand/theme/Ampersand_TestVendor/email/redundant.html | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Checkout/web/js/redundant.js | app/design/frontend/Ampersand/theme/Magento_Checkout/web/js/redundant.js | | WARN | Redundant Override | vendor/ampersand/upgrade-patch-helper-test-module/src/theme/Magento_Ui/web/templates/redundant.html | app/design/frontend/Ampersand/theme/Magento_Ui/web/templates/redundant.html | @@ -67,6 +68,7 @@ phpstorm diff vendor/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/the phpstorm diff vendor/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/theme/Magento_Customer/templates/account/dashboard/info.phtml vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Customer/templates/account/dashboard/info.phtml vendor_orig/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/theme/Magento_Customer/templates/account/dashboard/info.phtml phpstorm diff vendor/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/theme/Magento_Customer/templates/account/dashboard/info.phtml app/design/frontend/Ampersand/theme/Magento_Customer/templates/account/dashboard/info.phtml vendor_orig/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/theme/Magento_Customer/templates/account/dashboard/info.phtml phpstorm diff vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/form.phtml vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/form.phtml vendor_orig/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/form.phtml +phpstorm diff vendor/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml vendor/ampersand/upgrade-patch-helper-test-hyva-theme-extended/theme/Magento_Checkout/templates/cart/redundant.phtml vendor_orig/ampersand/upgrade-patch-helper-test-hyva-theme-stub/theme/Magento_Checkout/templates/cart/redundant.phtml phpstorm diff vendor/ampersand/upgrade-patch-helper-test-module/src/module/Api/ExampleInterface.php app/code/Ampersand/Test/Model/Example.php vendor_orig/ampersand/upgrade-patch-helper-test-module/src/module/Api/ExampleInterface.php phpstorm diff vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/SomeClass.php app/code/Ampersand/Test/Model/ThirdPartyClass.php vendor_orig/ampersand/upgrade-patch-helper-test-module/src/module/Model/SomeClass.php phpstorm diff vendor/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php app/code/Ampersand/Test/Model/ToPreferenceAndDelete.php vendor_orig/ampersand/upgrade-patch-helper-test-module/src/module/Model/ToPreferenceAndDelete.php @@ -108,7 +110,7 @@ phpstorm diff vendor/magento/theme-frontend-luma/Magento_Sales/email/order_new.h phpstorm diff vendor/magento/theme-frontend-luma/etc/view.xml vendor/ampersand/upgrade-patch-helper-test-hyva-fallback-theme/theme/etc/view.xml vendor_orig/magento/theme-frontend-luma/etc/view.xml phpstorm diff vendor/magento/theme-frontend-luma/etc/view.xml vendor/ampersand/upgrade-patch-helper-test-module/src/theme/etc/view.xml vendor_orig/magento/theme-frontend-luma/etc/view.xml phpstorm diff vendor/paypal/module-braintree-core/view/base/web/js/form-builder.js vendor/paypal/module-braintree-core/view/frontend/web/js/form-builder.js vendor_orig/paypal/module-braintree-core/view/base/web/js/form-builder.js -WARN count: 60 +WARN count: 61 INFO count: 395 (to view re-run this tool with --show-info) -IGNORE count: 6 (to view re-run this tool with --show-ignore) +IGNORE count: 7 (to view re-run this tool with --show-ignore) For docs on each check see https://github.com/AmpersandHQ/ampersand-magento2-upgrade-patch-helper/blob/master/docs/CHECKS_AVAILABLE.md \ No newline at end of file diff --git a/dev/phpunit/unit/Ampersand/PatchHelper/Patchfile/SanitiserTest.php b/dev/phpunit/unit/Ampersand/PatchHelper/Patchfile/SanitiserTest.php index f4bb06c1..0bb729b5 100644 --- a/dev/phpunit/unit/Ampersand/PatchHelper/Patchfile/SanitiserTest.php +++ b/dev/phpunit/unit/Ampersand/PatchHelper/Patchfile/SanitiserTest.php @@ -111,4 +111,59 @@ public function testStripCommentsFromPhp() file_get_contents(BASE_DIR . '/dev/phpunit/unit/resources/patchfile/sanitiser/php/FooBarBazExpected.php') ); } + + /** + * @dataProvider sanitisePhtmlCasesDataProvider + */ + public function testSanitisePhtmlCases($input, $expected) + { + $contents = Sanitiser::sanitisePhtml($input); + $this->assertEquals($expected, $contents); + } + + public function sanitisePhtmlCasesDataProvider() + { + return [ + [ + "", + "" + ], + [ + '', + '', + ], + [ + 'foo() ; ?>', + 'foo() ?>', + ], + [ + 'foo(); ?>', + 'foo() ?>', + ], + [ + "
", + "
", + ], + [ + 'getPagerHtml(); ?>', + 'getPagerHtml() ?>' + ], + [ + '', + '' + ], + ]; + } + + public function testSanitisePhtmlFile() + { + $contents = file_get_contents(BASE_DIR . '/dev/phpunit/unit/resources/patchfile/sanitiser/phtml/foobar.phtml'); + + $contents = Sanitiser::sanitisePhtml($contents); + + $this->assertEquals( + $contents, + file_get_contents(BASE_DIR . '/dev/phpunit/unit/resources/patchfile/sanitiser/phtml/foobar.expected.phtml') + ); + } } diff --git a/dev/phpunit/unit/resources/checks/FrontendFilePhtml/app/design/frontend/Ampersand/theme/Magento_Checkout/templates/cart/form.phtml b/dev/phpunit/unit/resources/checks/FrontendFilePhtml/app/design/frontend/Ampersand/theme/Magento_Checkout/templates/cart/form.phtml index e69de29b..2bfa3f17 100644 --- a/dev/phpunit/unit/resources/checks/FrontendFilePhtml/app/design/frontend/Ampersand/theme/Magento_Checkout/templates/cart/form.phtml +++ b/dev/phpunit/unit/resources/checks/FrontendFilePhtml/app/design/frontend/Ampersand/theme/Magento_Checkout/templates/cart/form.phtml @@ -0,0 +1 @@ +

this is some different form info

\ No newline at end of file diff --git a/dev/phpunit/unit/resources/checks/FrontendFilePhtml/vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml b/dev/phpunit/unit/resources/checks/FrontendFilePhtml/vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml index 952c7543..2b7d1f26 100644 --- a/dev/phpunit/unit/resources/checks/FrontendFilePhtml/vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml +++ b/dev/phpunit/unit/resources/checks/FrontendFilePhtml/vendor/magento/module-checkout/view/frontend/templates/cart/form.phtml @@ -1 +1 @@ - \ No newline at end of file +

this is some form info

\ No newline at end of file diff --git a/dev/phpunit/unit/resources/patchfile/sanitiser/phtml/foobar.expected.phtml b/dev/phpunit/unit/resources/patchfile/sanitiser/phtml/foobar.expected.phtml new file mode 100644 index 00000000..c577ac46 --- /dev/null +++ b/dev/phpunit/unit/resources/patchfile/sanitiser/phtml/foobar.expected.phtml @@ -0,0 +1,16 @@ + +getCollection()->getSize()): ?> +
isExpanded()): ?> +getTemplateFile('Magento_Catalog::product/list/toolbar/viewmode.phtml')) ?> + +getTemplateFile('Magento_Catalog::product/list/toolbar/amount.phtml')) ?> +getPagerHtml() ?>getPagerHtml() ?>getPagerHtml() ?> +getPagerHtml() ?>getPagerHtml() ?>getPagerHtml() ?> + + + +getTemplateFile('Magento_Catalog::product/list/toolbar/limiter.phtml')) ?> +isExpanded()): ?> +getTemplateFile('Magento_Catalog::product/list/toolbar/sorter.phtml')) ?> + +
\ No newline at end of file diff --git a/dev/phpunit/unit/resources/patchfile/sanitiser/phtml/foobar.phtml b/dev/phpunit/unit/resources/patchfile/sanitiser/phtml/foobar.phtml new file mode 100644 index 00000000..8a256992 --- /dev/null +++ b/dev/phpunit/unit/resources/patchfile/sanitiser/phtml/foobar.phtml @@ -0,0 +1,42 @@ + + + +getCollection()->getSize()): ?> +
+ isExpanded()): ?> + getTemplateFile('Magento_Catalog::product/list/toolbar/viewmode.phtml')) ?> + + + getTemplateFile('Magento_Catalog::product/list/toolbar/amount.phtml')) ?> + + getPagerHtml(); ?>getPagerHtml(); ?>getPagerHtml(); ?> + getPagerHtml(); ?>getPagerHtml(); ?>getPagerHtml(); ?> + + + + + + getTemplateFile('Magento_Catalog::product/list/toolbar/limiter.phtml')) ?> + + isExpanded()): ; ?> + getTemplateFile('Magento_Catalog::product/list/toolbar/sorter.phtml')) ?> + +
+ \ No newline at end of file diff --git a/src/Ampersand/PatchHelper/Patchfile/Entry.php b/src/Ampersand/PatchHelper/Patchfile/Entry.php index cc7c7363..8289b12e 100644 --- a/src/Ampersand/PatchHelper/Patchfile/Entry.php +++ b/src/Ampersand/PatchHelper/Patchfile/Entry.php @@ -596,7 +596,8 @@ private function getSanitisedFileContents($file) $contents = Sanitiser::stripCommentsFromPhp($contents); break; case 'phtml': - break; // todo not implemented + $contents = Sanitiser::sanitisePhtml($contents); + break; case 'js': $contents = Sanitiser::stripCommentsFromJavascript($contents); break; diff --git a/src/Ampersand/PatchHelper/Patchfile/Sanitiser.php b/src/Ampersand/PatchHelper/Patchfile/Sanitiser.php index e7b36c3b..cc607a77 100644 --- a/src/Ampersand/PatchHelper/Patchfile/Sanitiser.php +++ b/src/Ampersand/PatchHelper/Patchfile/Sanitiser.php @@ -116,6 +116,60 @@ public static function stripCommentsFromPhp($contents) return implode('', $phpCode); } + /** + * @param string $contents + * @return string + */ + public static function sanitisePhtml($contents) + { + $contents = self::stripWhitespaceAndNewlines($contents); + + $tokens = array_filter(token_get_all($contents)); + + $code = []; + foreach ($tokens as $token) { + if (!isset($token[1])) { + /** @var string $token */ + $code[] = $token; + continue; + } + if (in_array($token[0], [T_COMMENT, T_DOC_COMMENT], true)) { + continue; + } + /** @var string $codePiece */ + $codePiece = $token[1]; + + if ($token[0] === T_INLINE_HTML) { + // inline code handling + $codePiece = self::stripCommentsFromHtml($codePiece); + $codePiece = self::stripCommentsFromJavascript($codePiece); + $codePiece = self::stripWhitespaceAndNewlines($codePiece); + } + $code[] = $codePiece; + } + + $result = self::stripWhitespaceAndNewlines(implode('', $code)); + + // remove multiple concurrent spaces + $result = preg_replace('/[ ]{2,}/', ' ', $result); + + // Convert long echos to short + $result = str_replace('/', '', $result); + + // remove multiple concurrent spaces (may have been introduced by above removals + $result = preg_replace('/[ ]{2,}/', ' ', $result); + + // Strip out any empty php tags, can be from comments etc + $result = str_replace("\n", '', $result); + $result = str_replace("", '', $result); + + return $result; + } + + /** * @param string $contents * @return string