From 159b377cd29be55c8d3af75f0cd5ba731a21b3c3 Mon Sep 17 00:00:00 2001 From: Harald Deiser Date: Mon, 18 May 2020 20:48:36 +0200 Subject: [PATCH 01/17] MC-14884: MySQL-8 and MariaDB-10.4 support --- .../Magento/AdminAnalytics/etc/db_schema.xml | 2 +- .../AdminNotification/etc/db_schema.xml | 10 +- .../Magento/AdvancedSearch/etc/db_schema.xml | 6 +- .../AsynchronousOperations/etc/db_schema.xml | 14 +- .../Magento/Authorization/etc/db_schema.xml | 14 +- app/code/Magento/Bundle/etc/db_schema.xml | 120 ++-- app/code/Magento/Captcha/etc/db_schema.xml | 2 +- app/code/Magento/Catalog/etc/db_schema.xml | 522 +++++++++--------- .../Model/Import/Product/Type/VirtualTest.php | 2 - .../row_data_ambiguity_different_type.php | 2 - .../row_data_ambiguity_several_db_rows.php | 2 - .../Type/_files/row_data_main_empty_title.php | 2 - .../_files/row_data_main_incorrect_type.php | 2 - .../row_data_main_invalid_max_characters.php | 2 - .../_files/row_data_main_invalid_price.php | 2 - .../row_data_main_invalid_sort_order.php | 2 - .../_files/row_data_main_invalid_store.php | 2 - ...row_data_main_max_characters_less_zero.php | 2 - .../Type/_files/row_data_main_no_title.php | 2 - .../row_data_main_sort_order_less_zero.php | 2 - .../Type/_files/row_data_main_valid.php | 2 - .../Type/_files/row_data_no_custom_option.php | 2 - .../row_data_secondary_incorrect_price.php | 2 - .../row_data_secondary_incorrect_row_sort.php | 2 - .../row_data_secondary_invalid_store.php | 2 - .../row_data_secondary_row_sort_less_zero.php | 2 - .../Type/_files/row_data_secondary_valid.php | 2 - .../Import/Product/Validator/MediaTest.php | 2 - .../Import/Product/Validator/QuantityTest.php | 2 - .../Validator/SuperProductsSkuTest.php | 2 - .../Product/Validator/TierPriceTest.php | 2 - .../Model/Import/Product/ValidatorTest.php | 2 - .../Product/Flat/Plugin/ImportTest.php | 2 - .../Model/Indexer/Stock/Plugin/ImportTest.php | 2 - .../CatalogInventory/etc/db_schema.xml | 74 +-- .../Magento/CatalogRule/etc/db_schema.xml | 80 +-- .../CatalogUrlRewrite/etc/db_schema.xml | 6 +- .../CheckoutAgreements/etc/db_schema.xml | 12 +- app/code/Magento/Cms/etc/db_schema.xml | 18 +- app/code/Magento/Config/etc/db_schema.xml | 4 +- .../ConfigurableProduct/etc/db_schema.xml | 22 +- app/code/Magento/Cron/etc/db_schema.xml | 2 +- app/code/Magento/Customer/etc/db_schema.xml | 138 ++--- app/code/Magento/Directory/etc/db_schema.xml | 6 +- .../Magento/Downloadable/etc/db_schema.xml | 70 +-- app/code/Magento/Eav/etc/db_schema.xml | 164 +++--- app/code/Magento/Email/etc/db_schema.xml | 4 +- .../Magento/GiftMessage/etc/db_schema.xml | 18 +- .../Magento/GoogleOptimizer/etc/db_schema.xml | 6 +- .../Magento/ImportExport/etc/db_schema.xml | 6 +- app/code/Magento/Indexer/etc/db_schema.xml | 6 +- .../Magento/Integration/etc/db_schema.xml | 34 +- .../LoginAsCustomerLog/etc/db_schema.xml | 6 +- .../Magento/MediaContent/etc/db_schema.xml | 2 +- .../Magento/MediaGallery/etc/db_schema.xml | 14 +- .../Magento/MessageQueue/etc/db_schema.xml | 2 +- app/code/Magento/MysqlMq/etc/db_schema.xml | 14 +- .../NewRelicReporting/etc/db_schema.xml | 16 +- app/code/Magento/Newsletter/etc/db_schema.xml | 40 +- .../Magento/OfflineShipping/etc/db_schema.xml | 16 +- app/code/Magento/Paypal/etc/db_schema.xml | 24 +- app/code/Magento/Persistent/etc/db_schema.xml | 8 +- .../Magento/ProductAlert/etc/db_schema.xml | 28 +- .../Magento/ProductVideo/etc/db_schema.xml | 4 +- app/code/Magento/Quote/etc/db_schema.xml | 108 ++-- .../ReleaseNotification/etc/db_schema.xml | 4 +- app/code/Magento/Reports/etc/db_schema.xml | 66 +-- app/code/Magento/Review/etc/db_schema.xml | 96 ++-- app/code/Magento/Sales/etc/db_schema.xml | 352 ++++++------ app/code/Magento/SalesRule/etc/db_schema.xml | 94 ++-- .../Magento/SalesSequence/etc/db_schema.xml | 16 +- app/code/Magento/Search/etc/db_schema.xml | 20 +- .../Model/ResourceModel/AdminSessionInfo.php | 6 +- app/code/Magento/Security/etc/db_schema.xml | 12 +- .../Model/ResourceModel/SendFriend.php | 4 +- app/code/Magento/SendFriend/etc/db_schema.xml | 8 +- app/code/Magento/Sitemap/etc/db_schema.xml | 4 +- app/code/Magento/Store/etc/db_schema.xml | 26 +- app/code/Magento/Swatches/etc/db_schema.xml | 8 +- app/code/Magento/Tax/etc/db_schema.xml | 48 +- app/code/Magento/Theme/etc/db_schema.xml | 16 +- .../Magento/Translation/etc/db_schema.xml | 6 +- app/code/Magento/Ui/etc/db_schema.xml | 6 +- app/code/Magento/UrlRewrite/etc/db_schema.xml | 10 +- app/code/Magento/User/etc/db_schema.xml | 18 +- app/code/Magento/Variable/etc/db_schema.xml | 8 +- app/code/Magento/Vault/etc/db_schema.xml | 8 +- app/code/Magento/Weee/etc/db_schema.xml | 10 +- app/code/Magento/Widget/etc/db_schema.xml | 28 +- app/code/Magento/Wishlist/etc/db_schema.xml | 20 +- app/etc/di.xml | 9 + composer.json | 9 +- composer.lock | 37 +- .../Api/CategoryAttributeRepositoryTest.php | 1 - .../Magento/TestFramework/Db/Mysql.php | 73 ++- .../Product/Helper/Form/WeightTest.php | 2 +- .../ListProduct/CheckProductPriceTest.php | 2 +- .../AbstractRenderCustomOptionsTest.php | 2 +- .../ConditionsToCollectionApplierTest.php | 3 + .../Magento/Framework/Backup/DbTest.php | 10 +- .../Framework/DB/Adapter/Pdo/MysqlTest.php | 6 +- .../View/LayoutTestWithExceptions.php | 2 +- .../Adminhtml/Import/ValidateTest.php | 2 +- .../Review/_files/different_reviews.php | 12 + .../Translation/Controller/AjaxTest.php | 3 +- .../constraint_modification.mariadb10.php | 60 ++ .../constraint_modification.mysql8.php | 57 ++ .../constraint_modification.php | 33 +- .../declarative_installer/rollback.mysql8.php | 27 + .../declarative_installer/rollback.php | 4 +- .../table_removal.mariadb10.php | 12 + .../table_removal.mysql8.php | 12 + .../declarative_installer/table_removal.php | 4 +- .../fixture/dry_run_log.mysql8.php | 56 ++ .../fixture/dry_run_log.php | 26 +- .../fixture/dry_run_log_on_upgrade.mysql8.php | 13 + .../fixture/dry_run_log_on_upgrade.php | 4 +- .../disabling_tables.mariadb10.php | 14 + .../disabling_tables.mysql8.php | 14 + .../disabling_tables.php | 4 +- .../Annotation/DataProviderFromFile.php | 80 ++- .../TestFramework/TestCase/SetupTestCase.php | 70 ++- .../Setup/DeclarativeInstallerTest.php | 2 +- .../Magento/Setup/DiffOldSchemaTest.php | 19 +- .../Magento/Setup/ValidationRulesTest.php | 7 +- .../Magento/Test/Legacy/ClassesTest.php | 2 +- .../Magento/Test/Legacy/EmailTemplateTest.php | 4 +- .../Test/Legacy/Magento/Widget/XmlTest.php | 2 +- .../Framework/DB/Adapter/Pdo/Mysql.php | 69 ++- .../DB/Adapter/SqlVersionProvider.php | 123 +++++ .../Schema/Db/DefinitionAggregator.php | 48 +- .../Schema/Db/MySQL/DbSchemaReader.php | 1 + .../Schema/Db/MySQL/DbSchemaWriter.php | 60 +- .../Db/MySQL/Definition/Columns/Boolean.php | 12 +- .../Db/MySQL/Definition/Columns/Integer.php | 34 +- .../Db/MySQL/Definition/Columns/OnUpdate.php | 4 +- .../MySQL/Definition/Columns/StringBinary.php | 54 +- .../Declaration/Schema/Db/SchemaBuilder.php | 23 +- .../Schema/Declaration/SchemaBuilder.php | 56 +- .../Schema/Dto/Columns/Integer.php | 5 +- .../Schema/Dto/Factories/Integer.php | 24 +- .../Schema/etc/types/integers/integer.xsd | 4 +- .../Definition/Columns/StringBinaryTest.php | 18 + .../Schema/Db/SchemaBuilderTest.php | 27 +- .../Schema/Declaration/SchemaBuilderTest.php | 21 +- .../DB/Adapter/SqlVersionProviderTest.php | 159 ++++++ .../TestFramework/Unit/Block/Adminhtml.php | 2 +- lib/internal/Magento/Framework/composer.json | 10 +- .../Fixtures/WebsiteCategoryProvider.php | 18 +- 149 files changed, 2502 insertions(+), 1557 deletions(-) create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mariadb10.php create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mysql8.php create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.mysql8.php create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mariadb10.php create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mysql8.php create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mysql8.php create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log_on_upgrade.mysql8.php create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.mariadb10.php create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.mysql8.php create mode 100644 lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php create mode 100644 lib/internal/Magento/Framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php diff --git a/app/code/Magento/AdminAnalytics/etc/db_schema.xml b/app/code/Magento/AdminAnalytics/etc/db_schema.xml index ef1a657dc8243..4d7fdff25c02c 100644 --- a/app/code/Magento/AdminAnalytics/etc/db_schema.xml +++ b/app/code/Magento/AdminAnalytics/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd"> - diff --git a/app/code/Magento/AdminNotification/etc/db_schema.xml b/app/code/Magento/AdminNotification/etc/db_schema.xml index 8849687611193..d7bad83aa590b 100644 --- a/app/code/Magento/AdminNotification/etc/db_schema.xml +++ b/app/code/Magento/AdminNotification/etc/db_schema.xml @@ -8,18 +8,18 @@
- - - - @@ -36,7 +36,7 @@
- diff --git a/app/code/Magento/AdvancedSearch/etc/db_schema.xml b/app/code/Magento/AdvancedSearch/etc/db_schema.xml index bf85a23782095..20ab3973dd8d2 100644 --- a/app/code/Magento/AdvancedSearch/etc/db_schema.xml +++ b/app/code/Magento/AdvancedSearch/etc/db_schema.xml @@ -9,10 +9,10 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
- - + - diff --git a/app/code/Magento/AsynchronousOperations/etc/db_schema.xml b/app/code/Magento/AsynchronousOperations/etc/db_schema.xml index 5cd55408838fe..f287a368c72fb 100644 --- a/app/code/Magento/AsynchronousOperations/etc/db_schema.xml +++ b/app/code/Magento/AsynchronousOperations/etc/db_schema.xml @@ -9,15 +9,15 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
- - - @@ -32,7 +32,7 @@
- - - @@ -59,7 +59,7 @@
- diff --git a/app/code/Magento/Authorization/etc/db_schema.xml b/app/code/Magento/Authorization/etc/db_schema.xml index a38828eb6efca..de0dd69ee29c2 100644 --- a/app/code/Magento/Authorization/etc/db_schema.xml +++ b/app/code/Magento/Authorization/etc/db_schema.xml @@ -8,16 +8,16 @@
- - - - - @@ -33,9 +33,9 @@
- - diff --git a/app/code/Magento/Bundle/etc/db_schema.xml b/app/code/Magento/Bundle/etc/db_schema.xml index dba9732439065..867e937d6bc83 100644 --- a/app/code/Magento/Bundle/etc/db_schema.xml +++ b/app/code/Magento/Bundle/etc/db_schema.xml @@ -9,13 +9,13 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
- - - - @@ -30,14 +30,14 @@
- - - - @@ -53,25 +53,25 @@
- - - - - - - - @@ -91,15 +91,15 @@
- - - - @@ -119,11 +119,11 @@
- - - @@ -152,15 +152,15 @@
- - - - - @@ -171,15 +171,15 @@
- - - - - @@ -205,15 +205,15 @@
- - - - - @@ -239,19 +239,19 @@
- - - - - - - @@ -267,19 +267,19 @@
- - - - - - - @@ -295,13 +295,13 @@
- - - - @@ -322,13 +322,13 @@
- - - - diff --git a/app/code/Magento/Captcha/etc/db_schema.xml b/app/code/Magento/Captcha/etc/db_schema.xml index 158e2f43b9f5d..38e0af72d2756 100644 --- a/app/code/Magento/Captcha/etc/db_schema.xml +++ b/app/code/Magento/Captcha/etc/db_schema.xml @@ -10,7 +10,7 @@
- diff --git a/app/code/Magento/Catalog/etc/db_schema.xml b/app/code/Magento/Catalog/etc/db_schema.xml index d5b318f671726..1c97c920266df 100644 --- a/app/code/Magento/Catalog/etc/db_schema.xml +++ b/app/code/Magento/Catalog/etc/db_schema.xml @@ -8,15 +8,15 @@
- - - - @@ -34,13 +34,13 @@
- - - - @@ -69,13 +69,13 @@
- - - - @@ -105,15 +105,15 @@
- - - - - @@ -141,13 +141,13 @@
- - - - @@ -176,13 +176,13 @@
- - - - @@ -211,15 +211,15 @@
- - - - - @@ -250,22 +250,22 @@
- - - - - - @@ -279,13 +279,13 @@
- - - - @@ -317,13 +317,13 @@
- - - - @@ -356,15 +356,15 @@
- - - - - @@ -395,13 +395,13 @@
- - - - @@ -433,13 +433,13 @@
- - - - @@ -471,13 +471,13 @@
- - - - @@ -500,17 +500,17 @@
- - - - - - @@ -532,15 +532,15 @@
- - - - - @@ -570,9 +570,9 @@
- - @@ -590,7 +590,7 @@
- @@ -599,13 +599,13 @@
- - - - @@ -633,9 +633,9 @@
- - @@ -652,11 +652,11 @@
- - - @@ -680,13 +680,13 @@
- - - - @@ -708,11 +708,11 @@
- - - @@ -735,19 +735,19 @@
- - - - - @@ -779,14 +779,14 @@
- - - @@ -800,18 +800,18 @@
- - - - - - @@ -842,22 +842,22 @@
- - - - - - - @@ -871,11 +871,11 @@
- - - @@ -899,11 +899,11 @@
- - - @@ -925,12 +925,12 @@
- - - @@ -944,11 +944,11 @@
- - - @@ -973,11 +973,11 @@
- - - @@ -999,48 +999,48 @@
- - - - - - - - - - - - - - - - - - - - @@ -1056,9 +1056,9 @@
- - @@ -1076,15 +1076,15 @@
- - - - - @@ -1105,15 +1105,15 @@
- - - - @@ -1134,13 +1134,13 @@
- - - - @@ -1171,11 +1171,11 @@
- - - @@ -1202,9 +1202,9 @@
- - @@ -1219,13 +1219,13 @@
- - - - @@ -1240,13 +1240,13 @@
- - - - @@ -1261,11 +1261,11 @@
- - - @@ -1281,11 +1281,11 @@
- - - @@ -1301,13 +1301,13 @@
- - - - @@ -1329,13 +1329,13 @@
- - - - @@ -1357,11 +1357,11 @@
- - - @@ -1377,11 +1377,11 @@
- - - @@ -1397,13 +1397,13 @@
- - - - @@ -1420,13 +1420,13 @@
- - - - @@ -1443,15 +1443,15 @@
- - - - - @@ -1472,15 +1472,15 @@
- - - - - @@ -1501,15 +1501,15 @@
- - - - @@ -1530,15 +1530,15 @@
- - - - @@ -1559,13 +1559,13 @@
- - - - @@ -1594,13 +1594,13 @@
- - - - @@ -1629,17 +1629,17 @@
- - - - - - @@ -1654,9 +1654,9 @@
- -
- - - - - @@ -1701,15 +1701,15 @@
- - - - @@ -1730,13 +1730,13 @@
- - - - @@ -1767,17 +1767,17 @@
- - - - - - @@ -1800,16 +1800,16 @@
- - - - - diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/VirtualTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/VirtualTest.php index 172c2ee8ea2a0..cc17ce12d129d 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/VirtualTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/VirtualTest.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - namespace Magento\CatalogImportExport\Test\Unit\Model\Import\Product\Type; use Magento\CatalogImportExport\Model\Import\Product\Type\Virtual; diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_ambiguity_different_type.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_ambiguity_different_type.php index d109d8ffaa525..bf8587ce9719e 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_ambiguity_different_type.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_ambiguity_different_type.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'simple', '_custom_option_type' => 'date_time', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_ambiguity_several_db_rows.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_ambiguity_several_db_rows.php index 97738cd93c4ca..e81fa96ae679e 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_ambiguity_several_db_rows.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_ambiguity_several_db_rows.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'simple', '_custom_option_type' => 'field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_empty_title.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_empty_title.php index d354e765312e4..c9d73aa651f68 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_empty_title.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_empty_title.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_type' => 'field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_incorrect_type.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_incorrect_type.php index f91f98619eed0..5c24870a2f154 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_incorrect_type.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_incorrect_type.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_type' => 'incorrect_field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_max_characters.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_max_characters.php index 5d8c00dd41d7e..8eb299b6c2671 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_max_characters.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_max_characters.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_type' => 'field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_price.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_price.php index c5f965b15f93b..57c7a6c8ad8b6 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_price.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_price.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_type' => 'field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_sort_order.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_sort_order.php index c9c4df511c27c..4277222635867 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_sort_order.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_sort_order.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_type' => 'field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_store.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_store.php index b3630a44e6df0..5e1e6843bdfcc 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_store.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_invalid_store.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_store' => 'incorrect_store', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_max_characters_less_zero.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_max_characters_less_zero.php index 6056d7cb69116..71a2141c0f5a8 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_max_characters_less_zero.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_max_characters_less_zero.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_type' => 'field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_no_title.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_no_title.php index 99a1f86cc58e5..023f445156ff7 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_no_title.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_no_title.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_type' => 'field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_sort_order_less_zero.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_sort_order_less_zero.php index 4e2cf6f3ad379..b56aa8691beb1 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_sort_order_less_zero.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_sort_order_less_zero.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_type' => 'field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_valid.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_valid.php index 4804c9f983889..42365c9dc71c2 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_valid.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_main_valid.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_type' => 'field', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_no_custom_option.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_no_custom_option.php index 6bf5c83e2854d..82ac811875f56 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_no_custom_option.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_no_custom_option.php @@ -5,6 +5,4 @@ */ declare(strict_types=1); -declare(strict_types=1); - return ['sku' => 'product-sku']; diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_incorrect_price.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_incorrect_price.php index d0f6656bfe93e..fe9691e963933 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_incorrect_price.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_incorrect_price.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_row_title' => 'test row title', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_incorrect_row_sort.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_incorrect_row_sort.php index a3cedbc3eec97..a26e399ecedd5 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_incorrect_row_sort.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_incorrect_row_sort.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_row_title' => 'test row title', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_invalid_store.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_invalid_store.php index ddb4871575e7f..dc931e4418b97 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_invalid_store.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_invalid_store.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_store' => 'incorrect_store', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_row_sort_less_zero.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_row_sort_less_zero.php index dc7f23c180fda..897acf53caa21 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_row_sort_less_zero.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_row_sort_less_zero.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_row_title' => 'test row title', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_valid.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_valid.php index 25c623bb6709f..1da8e2c58be5a 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_valid.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/_files/row_data_secondary_valid.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - return [ 'sku' => 'product-sku', '_custom_option_row_title' => 'test row title', diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/MediaTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/MediaTest.php index 5ecaf6e4ca513..824d39ded391f 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/MediaTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/MediaTest.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - namespace Magento\CatalogImportExport\Test\Unit\Model\Import\Product\Validator; use Magento\CatalogImportExport\Model\Import\Product; diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/QuantityTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/QuantityTest.php index 7c30d32a6ed68..f54fcd40250e2 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/QuantityTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/QuantityTest.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - namespace Magento\CatalogImportExport\Test\Unit\Model\Import\Product\Validator; use Magento\CatalogImportExport\Model\Import\Product; diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/SuperProductsSkuTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/SuperProductsSkuTest.php index 975f7e1dc3bb3..5d4555747f0b6 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/SuperProductsSkuTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/SuperProductsSkuTest.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - namespace Magento\CatalogImportExport\Test\Unit\Model\Import\Product\Validator; use Magento\CatalogImportExport\Model\Import\Product\SkuProcessor; diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/TierPriceTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/TierPriceTest.php index 8f611a03f5edc..80975dcb7d3e7 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/TierPriceTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/TierPriceTest.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - namespace Magento\CatalogImportExport\Test\Unit\Model\Import\Product\Validator; use Magento\CatalogImportExport\Model\Import\Product\StoreResolver; diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php index 89675de7bf6bf..6c2efb6197db0 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - namespace Magento\CatalogImportExport\Test\Unit\Model\Import\Product; use Magento\CatalogImportExport\Model\Import\Product; diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Product/Flat/Plugin/ImportTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Product/Flat/Plugin/ImportTest.php index 77f894563550c..71348360fdb55 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Product/Flat/Plugin/ImportTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Product/Flat/Plugin/ImportTest.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - namespace Magento\CatalogImportExport\Test\Unit\Model\Indexer\Product\Flat\Plugin; use Magento\Catalog\Model\Indexer\Product\Flat\Processor; diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Stock/Plugin/ImportTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Stock/Plugin/ImportTest.php index 02e7466434949..3659cde191b54 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Stock/Plugin/ImportTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Indexer/Stock/Plugin/ImportTest.php @@ -5,8 +5,6 @@ */ declare(strict_types=1); -declare(strict_types=1); - namespace Magento\CatalogImportExport\Test\Unit\Model\Indexer\Stock\Plugin; use Magento\CatalogInventory\Model\Indexer\Stock\Processor; diff --git a/app/code/Magento/CatalogInventory/etc/db_schema.xml b/app/code/Magento/CatalogInventory/etc/db_schema.xml index 3747f3f89633f..bc7ed3c529441 100644 --- a/app/code/Magento/CatalogInventory/etc/db_schema.xml +++ b/app/code/Magento/CatalogInventory/etc/db_schema.xml @@ -8,9 +8,9 @@
- - @@ -21,55 +21,55 @@
- - - - - - - - - - - - - - - - - - - @@ -97,15 +97,15 @@
- - - - @@ -124,15 +124,15 @@
- - - - @@ -148,15 +148,15 @@
- - - - @@ -172,15 +172,15 @@
- - - - diff --git a/app/code/Magento/CatalogRule/etc/db_schema.xml b/app/code/Magento/CatalogRule/etc/db_schema.xml index b3692f280fec5..a2bb4dca4e422 100644 --- a/app/code/Magento/CatalogRule/etc/db_schema.xml +++ b/app/code/Magento/CatalogRule/etc/db_schema.xml @@ -8,19 +8,19 @@
- - - -
- - - - - - + - - - @@ -86,15 +86,15 @@
- - - + - @@ -118,11 +118,11 @@
- - - @@ -137,9 +137,9 @@
- - @@ -157,9 +157,9 @@
- - @@ -176,26 +176,26 @@
- - - - - - + - - - @@ -227,15 +227,15 @@
- - - + - @@ -260,11 +260,11 @@
- - - diff --git a/app/code/Magento/CatalogUrlRewrite/etc/db_schema.xml b/app/code/Magento/CatalogUrlRewrite/etc/db_schema.xml index c8da5b59cf5f5..aaf86e7d4418e 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/db_schema.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/db_schema.xml @@ -9,11 +9,11 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
- - -
- - - -
- - diff --git a/app/code/Magento/Cms/etc/db_schema.xml b/app/code/Magento/Cms/etc/db_schema.xml index 9ff3153098482..ac49421d31e8e 100644 --- a/app/code/Magento/Cms/etc/db_schema.xml +++ b/app/code/Magento/Cms/etc/db_schema.xml @@ -8,7 +8,7 @@
- @@ -17,7 +17,7 @@ comment="Block Creation Time"/> - @@ -29,8 +29,8 @@
- - + @@ -45,7 +45,7 @@
- @@ -58,9 +58,9 @@ comment="Page Creation Time"/> - - @@ -88,9 +88,9 @@
- - diff --git a/app/code/Magento/Config/etc/db_schema.xml b/app/code/Magento/Config/etc/db_schema.xml index 54680c0be7b06..10338b9f7ef1f 100644 --- a/app/code/Magento/Config/etc/db_schema.xml +++ b/app/code/Magento/Config/etc/db_schema.xml @@ -8,10 +8,10 @@
- - diff --git a/app/code/Magento/ConfigurableProduct/etc/db_schema.xml b/app/code/Magento/ConfigurableProduct/etc/db_schema.xml index d6917e8c1845a..2faaba565e9f8 100644 --- a/app/code/Magento/ConfigurableProduct/etc/db_schema.xml +++ b/app/code/Magento/ConfigurableProduct/etc/db_schema.xml @@ -9,13 +9,13 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
- - - - @@ -30,13 +30,13 @@
- - - - @@ -59,11 +59,11 @@
- - - diff --git a/app/code/Magento/Cron/etc/db_schema.xml b/app/code/Magento/Cron/etc/db_schema.xml index 206b8f64f3ae7..f26b6feea3b3b 100644 --- a/app/code/Magento/Cron/etc/db_schema.xml +++ b/app/code/Magento/Cron/etc/db_schema.xml @@ -8,7 +8,7 @@
- diff --git a/app/code/Magento/Customer/etc/db_schema.xml b/app/code/Magento/Customer/etc/db_schema.xml index 9f6d75f8ff64f..63ac8d9c1e46b 100644 --- a/app/code/Magento/Customer/etc/db_schema.xml +++ b/app/code/Magento/Customer/etc/db_schema.xml @@ -8,23 +8,23 @@
- - - - - - @@ -37,15 +37,15 @@ - - - -
- - - @@ -97,19 +97,19 @@ - - - @@ -123,11 +123,11 @@
- - - @@ -154,11 +154,11 @@
- - - @@ -185,13 +185,13 @@
- - - - @@ -217,11 +217,11 @@
- - - @@ -243,11 +243,11 @@
- - - @@ -273,11 +273,11 @@
- - - @@ -303,11 +303,11 @@
- - - @@ -334,13 +334,13 @@
- - - - @@ -365,11 +365,11 @@
- - - @@ -390,11 +390,11 @@
- - - @@ -420,36 +420,36 @@
- + -
- - - - - - - - - @@ -463,7 +463,7 @@
- @@ -478,16 +478,16 @@
- - - - - @@ -504,9 +504,9 @@
- -
- -
- @@ -30,7 +30,7 @@
- @@ -46,7 +46,7 @@
- diff --git a/app/code/Magento/Downloadable/etc/db_schema.xml b/app/code/Magento/Downloadable/etc/db_schema.xml index ee7b3c5683ea1..6fc1a48130e03 100644 --- a/app/code/Magento/Downloadable/etc/db_schema.xml +++ b/app/code/Magento/Downloadable/etc/db_schema.xml @@ -8,15 +8,15 @@
- - - - - @@ -36,11 +36,11 @@
- - - @@ -62,18 +62,18 @@
- - - - @@ -99,23 +99,23 @@
- - - - - - - - @@ -145,11 +145,11 @@
- - - @@ -170,14 +170,14 @@
- - - @@ -191,11 +191,11 @@
- - - @@ -217,11 +217,11 @@
- - - @@ -235,11 +235,11 @@
- - - diff --git a/app/code/Magento/Eav/etc/db_schema.xml b/app/code/Magento/Eav/etc/db_schema.xml index 0e0b599290ca2..f1f5d19dd2c74 100644 --- a/app/code/Magento/Eav/etc/db_schema.xml +++ b/app/code/Magento/Eav/etc/db_schema.xml @@ -8,7 +8,7 @@
- @@ -16,16 +16,16 @@ - - - - @@ -41,22 +41,22 @@
- - - - - - @@ -74,15 +74,15 @@
- - - - - @@ -114,15 +114,15 @@
- - - - - @@ -155,17 +155,17 @@
- - - - - - @@ -195,15 +195,15 @@
- - - - - @@ -232,15 +232,15 @@
- - - - - @@ -272,9 +272,9 @@
- - @@ -287,12 +287,12 @@ - - - @@ -312,11 +312,11 @@
- - - @@ -336,12 +336,12 @@
- - - @@ -359,15 +359,15 @@
- - - - @@ -392,17 +392,17 @@
- - - - - - @@ -430,11 +430,11 @@
- - - @@ -447,11 +447,11 @@
- - - @@ -471,11 +471,11 @@
- - - @@ -499,14 +499,14 @@
- - - @@ -523,9 +523,9 @@
- - @@ -542,12 +542,12 @@
- - - @@ -560,9 +560,9 @@
- - @@ -580,15 +580,15 @@
- - - - - diff --git a/app/code/Magento/Email/etc/db_schema.xml b/app/code/Magento/Email/etc/db_schema.xml index 82c5f18ddb9e9..d065c32b44486 100644 --- a/app/code/Magento/Email/etc/db_schema.xml +++ b/app/code/Magento/Email/etc/db_schema.xml @@ -8,12 +8,12 @@
- -
- - @@ -20,29 +20,29 @@
-
-
-
-
-
- -
diff --git a/app/code/Magento/GoogleOptimizer/etc/db_schema.xml b/app/code/Magento/GoogleOptimizer/etc/db_schema.xml index ed3dfcecb90f3..61286646a8fb7 100644 --- a/app/code/Magento/GoogleOptimizer/etc/db_schema.xml +++ b/app/code/Magento/GoogleOptimizer/etc/db_schema.xml @@ -8,12 +8,12 @@ - - - diff --git a/app/code/Magento/ImportExport/etc/db_schema.xml b/app/code/Magento/ImportExport/etc/db_schema.xml index 404999cb9e07a..12242364fbf18 100644 --- a/app/code/Magento/ImportExport/etc/db_schema.xml +++ b/app/code/Magento/ImportExport/etc/db_schema.xml @@ -8,7 +8,7 @@
- + @@ -17,11 +17,11 @@
- - diff --git a/app/code/Magento/Indexer/etc/db_schema.xml b/app/code/Magento/Indexer/etc/db_schema.xml index c9c8e665b3755..e316e50f79e9a 100644 --- a/app/code/Magento/Indexer/etc/db_schema.xml +++ b/app/code/Magento/Indexer/etc/db_schema.xml @@ -8,7 +8,7 @@
-
- - diff --git a/app/code/Magento/Integration/etc/db_schema.xml b/app/code/Magento/Integration/etc/db_schema.xml index de0cec2e4e20d..91af330e8ef27 100644 --- a/app/code/Magento/Integration/etc/db_schema.xml +++ b/app/code/Magento/Integration/etc/db_schema.xml @@ -8,7 +8,7 @@
- @@ -36,24 +36,24 @@
- - - - - - - @@ -77,9 +77,9 @@
- -
- @@ -101,15 +101,15 @@ comment="Email address of the contact person"/> - - - @@ -128,13 +128,13 @@
- - - diff --git a/app/code/Magento/LoginAsCustomerLog/etc/db_schema.xml b/app/code/Magento/LoginAsCustomerLog/etc/db_schema.xml index a1f40b4e5bbf5..c808e7a1d6b1d 100644 --- a/app/code/Magento/LoginAsCustomerLog/etc/db_schema.xml +++ b/app/code/Magento/LoginAsCustomerLog/etc/db_schema.xml @@ -7,11 +7,11 @@ -->
- + - + - + diff --git a/app/code/Magento/MediaContent/etc/db_schema.xml b/app/code/Magento/MediaContent/etc/db_schema.xml index 7e45e29cbb434..c2b83b341d0e6 100644 --- a/app/code/Magento/MediaContent/etc/db_schema.xml +++ b/app/code/Magento/MediaContent/etc/db_schema.xml @@ -7,7 +7,7 @@ -->
- + diff --git a/app/code/Magento/MediaGallery/etc/db_schema.xml b/app/code/Magento/MediaGallery/etc/db_schema.xml index 13e619dd9e74a..31a764ef00c4d 100644 --- a/app/code/Magento/MediaGallery/etc/db_schema.xml +++ b/app/code/Magento/MediaGallery/etc/db_schema.xml @@ -7,14 +7,14 @@ -->
- + - - - + + + @@ -31,7 +31,7 @@
- + @@ -44,8 +44,8 @@
- - + + diff --git a/app/code/Magento/MessageQueue/etc/db_schema.xml b/app/code/Magento/MessageQueue/etc/db_schema.xml index 4403384e9311a..98d550a91e21f 100644 --- a/app/code/Magento/MessageQueue/etc/db_schema.xml +++ b/app/code/Magento/MessageQueue/etc/db_schema.xml @@ -9,7 +9,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
-
- @@ -19,7 +19,7 @@
- @@ -29,17 +29,17 @@
- - - - - diff --git a/app/code/Magento/NewRelicReporting/etc/db_schema.xml b/app/code/Magento/NewRelicReporting/etc/db_schema.xml index e18d7c8077bb9..9388623f737ea 100644 --- a/app/code/Magento/NewRelicReporting/etc/db_schema.xml +++ b/app/code/Magento/NewRelicReporting/etc/db_schema.xml @@ -9,10 +9,10 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
- - @@ -21,7 +21,7 @@
- @@ -34,13 +34,13 @@
- - - @@ -49,7 +49,7 @@
- @@ -60,7 +60,7 @@
- diff --git a/app/code/Magento/Newsletter/etc/db_schema.xml b/app/code/Magento/Newsletter/etc/db_schema.xml index c038b02404875..3a8a537e8fcc3 100644 --- a/app/code/Magento/Newsletter/etc/db_schema.xml +++ b/app/code/Magento/Newsletter/etc/db_schema.xml @@ -8,16 +8,16 @@
- - - - @@ -38,19 +38,19 @@
- - - @@ -70,11 +70,11 @@
- - - @@ -83,7 +83,7 @@ comment="Newsletter Sender Name"/> -
- - - @@ -124,9 +124,9 @@
- - @@ -143,13 +143,13 @@
- - - - diff --git a/app/code/Magento/OfflineShipping/etc/db_schema.xml b/app/code/Magento/OfflineShipping/etc/db_schema.xml index 6bda6597e2f61..35df088f708a1 100644 --- a/app/code/Magento/OfflineShipping/etc/db_schema.xml +++ b/app/code/Magento/OfflineShipping/etc/db_schema.xml @@ -8,13 +8,13 @@
- - - @@ -38,23 +38,23 @@
-
-
-
-
-
diff --git a/app/code/Magento/Paypal/etc/db_schema.xml b/app/code/Magento/Paypal/etc/db_schema.xml index 3300f3754e656..2f02f63b7516d 100644 --- a/app/code/Magento/Paypal/etc/db_schema.xml +++ b/app/code/Magento/Paypal/etc/db_schema.xml @@ -8,9 +8,9 @@ - - @@ -18,7 +18,7 @@ - @@ -39,9 +39,9 @@
- - @@ -58,7 +58,7 @@
- @@ -74,9 +74,9 @@
- - @@ -116,9 +116,9 @@
- - @@ -133,7 +133,7 @@
- @@ -153,7 +153,7 @@ comment="Paypal Correlation ID"/>
-
diff --git a/app/code/Magento/Persistent/etc/db_schema.xml b/app/code/Magento/Persistent/etc/db_schema.xml index e14dedba0ed56..085c2613efa50 100644 --- a/app/code/Magento/Persistent/etc/db_schema.xml +++ b/app/code/Magento/Persistent/etc/db_schema.xml @@ -8,12 +8,12 @@ - - -
-
diff --git a/app/code/Magento/ProductAlert/etc/db_schema.xml b/app/code/Magento/ProductAlert/etc/db_schema.xml index 17cc76246e5c6..e12d0523d01aa 100644 --- a/app/code/Magento/ProductAlert/etc/db_schema.xml +++ b/app/code/Magento/ProductAlert/etc/db_schema.xml @@ -8,25 +8,25 @@ - - - - - - - @@ -57,23 +57,23 @@
- - - - - - - diff --git a/app/code/Magento/ProductVideo/etc/db_schema.xml b/app/code/Magento/ProductVideo/etc/db_schema.xml index bfe087d9a5769..aa3dff4a27989 100644 --- a/app/code/Magento/ProductVideo/etc/db_schema.xml +++ b/app/code/Magento/ProductVideo/etc/db_schema.xml @@ -9,9 +9,9 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
- - diff --git a/app/code/Magento/Quote/etc/db_schema.xml b/app/code/Magento/Quote/etc/db_schema.xml index 44a5f275b4d9f..ff183e3150894 100644 --- a/app/code/Magento/Quote/etc/db_schema.xml +++ b/app/code/Magento/Quote/etc/db_schema.xml @@ -8,25 +8,25 @@
- - - - - - - @@ -42,11 +42,11 @@ - - - @@ -57,9 +57,9 @@ - - @@ -82,9 +82,9 @@ nullable="true" comment="Subtotal With Discount"/> - - @@ -102,19 +102,19 @@
- - - - - @@ -128,15 +128,15 @@ comment="Street"/> - - - - - @@ -214,30 +214,30 @@
- - - - - - - - @@ -314,13 +314,13 @@
- - - - @@ -348,25 +348,25 @@ default="0" comment="Base Tax Amount"/> - - - - - - @@ -412,11 +412,11 @@
- - - @@ -430,9 +430,9 @@
- - @@ -445,12 +445,12 @@ - - - @@ -466,9 +466,9 @@
- - @@ -494,9 +494,9 @@
- - diff --git a/app/code/Magento/ReleaseNotification/etc/db_schema.xml b/app/code/Magento/ReleaseNotification/etc/db_schema.xml index 6f3aa481f73d4..3bee4b6e1afe9 100644 --- a/app/code/Magento/ReleaseNotification/etc/db_schema.xml +++ b/app/code/Magento/ReleaseNotification/etc/db_schema.xml @@ -9,9 +9,9 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
- - diff --git a/app/code/Magento/Reports/etc/db_schema.xml b/app/code/Magento/Reports/etc/db_schema.xml index 30accf36a053e..719c5de61fe4e 100644 --- a/app/code/Magento/Reports/etc/db_schema.xml +++ b/app/code/Magento/Reports/etc/db_schema.xml @@ -9,15 +9,15 @@ xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
- - - - - @@ -53,15 +53,15 @@
- - - - - @@ -96,29 +96,29 @@
- -
- - - - - - @@ -146,18 +146,18 @@
- + - - - - @@ -182,18 +182,18 @@
- + - - - - @@ -218,18 +218,18 @@
- + - - - - diff --git a/app/code/Magento/Review/etc/db_schema.xml b/app/code/Magento/Review/etc/db_schema.xml index 7a451dbbbcf98..5afa6e9d7a3e8 100644 --- a/app/code/Magento/Review/etc/db_schema.xml +++ b/app/code/Magento/Review/etc/db_schema.xml @@ -8,7 +8,7 @@
- @@ -16,7 +16,7 @@
- @@ -24,15 +24,15 @@
- - - - @@ -52,16 +52,16 @@
- - - - @@ -84,17 +84,17 @@
- - - - - - @@ -107,9 +107,9 @@
- - @@ -124,7 +124,7 @@
- @@ -135,14 +135,14 @@
- - - - @@ -157,14 +157,14 @@
- - - - @@ -176,24 +176,24 @@
- - - - - - - - - @@ -208,21 +208,21 @@
- - - - - - - - @@ -241,9 +241,9 @@
- - @@ -258,9 +258,9 @@
- - diff --git a/app/code/Magento/Sales/etc/db_schema.xml b/app/code/Magento/Sales/etc/db_schema.xml index ea7c768b0a786..9ede9a79f7f8b 100644 --- a/app/code/Magento/Sales/etc/db_schema.xml +++ b/app/code/Magento/Sales/etc/db_schema.xml @@ -8,7 +8,7 @@
- @@ -16,11 +16,11 @@ - - - @@ -136,32 +136,32 @@ comment="Total Qty Ordered"/> - - - - - - - + - - - - - - - @@ -226,9 +226,9 @@ comment="Created At"/> - - @@ -296,13 +296,13 @@
- - - @@ -385,17 +385,17 @@
- - - - - - @@ -413,11 +413,11 @@ - - @@ -430,13 +430,13 @@
- - - - @@ -458,36 +458,36 @@
- - - - - - - - - @@ -550,9 +550,9 @@ - - @@ -601,9 +601,9 @@
- - @@ -641,7 +641,7 @@ comment="Amount Ordered"/> - @@ -695,27 +695,27 @@
- - - - - - - - - - @@ -761,20 +761,20 @@
- - - - @@ -782,7 +782,7 @@ - + @@ -836,9 +836,9 @@
- - @@ -847,9 +847,9 @@ - - @@ -866,14 +866,14 @@
- - - @@ -900,13 +900,13 @@
- - - -
- - @@ -967,21 +967,21 @@ comment="Base Subtotal"/> - - - - - - - - @@ -1011,7 +1011,7 @@ - @@ -1050,22 +1050,22 @@
- - - - - + @@ -1135,9 +1135,9 @@
- - @@ -1166,9 +1166,9 @@ nullable="true" comment="Base Row Total Incl Tax"/> - - @@ -1191,13 +1191,13 @@
- - - -
- - @@ -1268,21 +1268,21 @@ comment="Shipping Tax Amount"/> - - - - - - - - @@ -1310,7 +1310,7 @@ - @@ -1349,29 +1349,29 @@
- - - - -
- - @@ -1468,9 +1468,9 @@ nullable="true" comment="Base Row Total Incl Tax"/> - - @@ -1493,13 +1493,13 @@
- - - -
- + - - @@ -1550,12 +1550,12 @@
- + - - @@ -1582,12 +1582,12 @@
- + - - @@ -1636,12 +1636,12 @@
- + - - @@ -1689,18 +1689,18 @@
- - - - -
- + - - @@ -1760,12 +1760,12 @@
- + - - @@ -1789,14 +1789,14 @@
- + - - @@ -1820,14 +1820,14 @@
- + - - @@ -1851,18 +1851,18 @@
- + - - - @@ -1884,18 +1884,18 @@
- + - - - @@ -1917,18 +1917,18 @@
- + - - - @@ -1949,9 +1949,9 @@
- - @@ -1959,13 +1959,13 @@ comment="Percent"/> - - - @@ -1979,11 +1979,11 @@
- - - @@ -1995,7 +1995,7 @@ comment="Real tax amount for the item and tax rate"/> - @@ -2029,9 +2029,9 @@
- - @@ -2043,7 +2043,7 @@
- diff --git a/app/code/Magento/SalesRule/etc/db_schema.xml b/app/code/Magento/SalesRule/etc/db_schema.xml index e100121bea345..3912ba3642ba1 100644 --- a/app/code/Magento/SalesRule/etc/db_schema.xml +++ b/app/code/Magento/SalesRule/etc/db_schema.xml @@ -8,43 +8,43 @@
- - - - - - - - - - - - - @@ -57,24 +57,24 @@
- - - - - - - @@ -93,11 +93,11 @@
- - - @@ -114,13 +114,13 @@
- - - - @@ -140,11 +140,11 @@
- - - @@ -163,13 +163,13 @@
- - - - @@ -200,13 +200,13 @@
- + - - @@ -242,13 +242,13 @@
- + - - @@ -284,13 +284,13 @@
- + - - @@ -319,9 +319,9 @@
- - @@ -338,9 +338,9 @@
- - diff --git a/app/code/Magento/SalesSequence/etc/db_schema.xml b/app/code/Magento/SalesSequence/etc/db_schema.xml index 5ae72319c5a69..5026ea34cb5a2 100644 --- a/app/code/Magento/SalesSequence/etc/db_schema.xml +++ b/app/code/Magento/SalesSequence/etc/db_schema.xml @@ -8,19 +8,19 @@
- - - - - - @@ -36,10 +36,10 @@
- - diff --git a/app/code/Magento/Search/etc/db_schema.xml b/app/code/Magento/Search/etc/db_schema.xml index 1a01ffa42401c..c5ad1aae1d60e 100644 --- a/app/code/Magento/Search/etc/db_schema.xml +++ b/app/code/Magento/Search/etc/db_schema.xml @@ -8,21 +8,21 @@
- - - - - - - @@ -52,12 +52,12 @@
- - - diff --git a/app/code/Magento/Security/Model/ResourceModel/AdminSessionInfo.php b/app/code/Magento/Security/Model/ResourceModel/AdminSessionInfo.php index 334449d74d195..5f81a0d121f25 100644 --- a/app/code/Magento/Security/Model/ResourceModel/AdminSessionInfo.php +++ b/app/code/Magento/Security/Model/ResourceModel/AdminSessionInfo.php @@ -23,7 +23,7 @@ class AdminSessionInfo extends \Magento\Framework\Model\ResourceModel\Db\Abstrac /** * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param null $connectionName + * @param null|string $connectionName */ public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, @@ -83,9 +83,11 @@ public function updateStatusByUserId( $updateOlderThen = null ) { $whereStatement = [ - 'updated_at > ?' => $this->dateTime->formatDate($updateOlderThen), 'user_id = ?' => (int) $userId, ]; + if ($updateOlderThen) { + $whereStatement['updated_at > ?'] = $this->dateTime->formatDate($updateOlderThen); + } if (!empty($excludedSessionIds)) { $whereStatement['session_id NOT IN (?)'] = $excludedSessionIds; } diff --git a/app/code/Magento/Security/etc/db_schema.xml b/app/code/Magento/Security/etc/db_schema.xml index 34bb497954a7e..0775c08b46244 100644 --- a/app/code/Magento/Security/etc/db_schema.xml +++ b/app/code/Magento/Security/etc/db_schema.xml @@ -8,12 +8,12 @@
- - - @@ -35,9 +35,9 @@
- - @@ -56,7 +56,7 @@
- diff --git a/app/code/Magento/SendFriend/Model/ResourceModel/SendFriend.php b/app/code/Magento/SendFriend/Model/ResourceModel/SendFriend.php index dd8f7b05c058c..618d941f7047e 100644 --- a/app/code/Magento/SendFriend/Model/ResourceModel/SendFriend.php +++ b/app/code/Magento/SendFriend/Model/ResourceModel/SendFriend.php @@ -46,7 +46,7 @@ public function getSendCount($object, $ip, $startTime, $websiteId = null) AND time>=:time AND website_id=:website_id' ); - $bind = ['ip' => $ip, 'time' => $startTime, 'website_id' => (int)$websiteId]; + $bind = ['ip' => ip2long($ip), 'time' => $startTime, 'website_id' => (int)$websiteId]; $row = $connection->fetchRow($select, $bind); return $row['count']; @@ -64,7 +64,7 @@ public function addSendItem($ip, $startTime, $websiteId) { $this->getConnection()->insert( $this->getMainTable(), - ['ip' => $ip, 'time' => $startTime, 'website_id' => $websiteId] + ['ip' => ip2long($ip), 'time' => $startTime, 'website_id' => $websiteId] ); return $this; } diff --git a/app/code/Magento/SendFriend/etc/db_schema.xml b/app/code/Magento/SendFriend/etc/db_schema.xml index b9551749dfc6d..ace6b8359403d 100644 --- a/app/code/Magento/SendFriend/etc/db_schema.xml +++ b/app/code/Magento/SendFriend/etc/db_schema.xml @@ -8,13 +8,13 @@
- - - - diff --git a/app/code/Magento/Sitemap/etc/db_schema.xml b/app/code/Magento/Sitemap/etc/db_schema.xml index adf1f11124f52..c06cd24d30e0d 100644 --- a/app/code/Magento/Sitemap/etc/db_schema.xml +++ b/app/code/Magento/Sitemap/etc/db_schema.xml @@ -8,13 +8,13 @@
- - diff --git a/app/code/Magento/Store/etc/db_schema.xml b/app/code/Magento/Store/etc/db_schema.xml index 5b2e178ff24b8..9f9efce81440b 100644 --- a/app/code/Magento/Store/etc/db_schema.xml +++ b/app/code/Magento/Store/etc/db_schema.xml @@ -8,15 +8,15 @@
- - - - @@ -32,14 +32,14 @@
- - - - @@ -58,17 +58,17 @@
- - - - - diff --git a/app/code/Magento/Swatches/etc/db_schema.xml b/app/code/Magento/Swatches/etc/db_schema.xml index 3dafbc3876494..ce1092daf9d28 100644 --- a/app/code/Magento/Swatches/etc/db_schema.xml +++ b/app/code/Magento/Swatches/etc/db_schema.xml @@ -11,13 +11,13 @@
- - - - diff --git a/app/code/Magento/Tax/etc/db_schema.xml b/app/code/Magento/Tax/etc/db_schema.xml index 1fe1a1fe33d8a..b38cfa2f6a70a 100644 --- a/app/code/Magento/Tax/etc/db_schema.xml +++ b/app/code/Magento/Tax/etc/db_schema.xml @@ -8,7 +8,7 @@
-
- - - - @@ -39,20 +39,20 @@
- - - - - @@ -74,15 +74,15 @@
- - - - - @@ -115,11 +115,11 @@
- - - @@ -140,14 +140,14 @@
- + - - @@ -170,14 +170,14 @@
- + - - diff --git a/app/code/Magento/Theme/etc/db_schema.xml b/app/code/Magento/Theme/etc/db_schema.xml index 84b7654e69160..de4cf53410ab9 100644 --- a/app/code/Magento/Theme/etc/db_schema.xml +++ b/app/code/Magento/Theme/etc/db_schema.xml @@ -8,16 +8,16 @@
- - - @@ -25,14 +25,14 @@
- - - @@ -42,9 +42,9 @@ referenceTable="theme" referenceColumn="theme_id" onDelete="CASCADE"/>
- - diff --git a/app/code/Magento/Translation/etc/db_schema.xml b/app/code/Magento/Translation/etc/db_schema.xml index a8ce30a0b4fd9..063ee33b5916b 100644 --- a/app/code/Magento/Translation/etc/db_schema.xml +++ b/app/code/Magento/Translation/etc/db_schema.xml @@ -8,15 +8,15 @@
- - - diff --git a/app/code/Magento/Ui/etc/db_schema.xml b/app/code/Magento/Ui/etc/db_schema.xml index 552bd267e707a..44c630ed144fc 100644 --- a/app/code/Magento/Ui/etc/db_schema.xml +++ b/app/code/Magento/Ui/etc/db_schema.xml @@ -8,13 +8,13 @@
- - - diff --git a/app/code/Magento/UrlRewrite/etc/db_schema.xml b/app/code/Magento/UrlRewrite/etc/db_schema.xml index 93e84d8e02a0f..2812efac0bfb9 100644 --- a/app/code/Magento/UrlRewrite/etc/db_schema.xml +++ b/app/code/Magento/UrlRewrite/etc/db_schema.xml @@ -8,19 +8,19 @@
- - - - - diff --git a/app/code/Magento/User/etc/db_schema.xml b/app/code/Magento/User/etc/db_schema.xml index e175b50108bd9..40b5fc16848b8 100644 --- a/app/code/Magento/User/etc/db_schema.xml +++ b/app/code/Magento/User/etc/db_schema.xml @@ -8,7 +8,7 @@
- @@ -20,11 +20,11 @@ - - - @@ -32,7 +32,7 @@ comment="Reset Password Link Token Creation Date"/> -
- - - - diff --git a/app/code/Magento/Variable/etc/db_schema.xml b/app/code/Magento/Variable/etc/db_schema.xml index cd6d7d105a08a..ff3274f979a4d 100644 --- a/app/code/Magento/Variable/etc/db_schema.xml +++ b/app/code/Magento/Variable/etc/db_schema.xml @@ -8,7 +8,7 @@
- @@ -20,11 +20,11 @@
- - - diff --git a/app/code/Magento/Vault/etc/db_schema.xml b/app/code/Magento/Vault/etc/db_schema.xml index 7110978710048..e46a91daddde2 100644 --- a/app/code/Magento/Vault/etc/db_schema.xml +++ b/app/code/Magento/Vault/etc/db_schema.xml @@ -8,9 +8,9 @@
- - @@ -41,9 +41,9 @@
- - diff --git a/app/code/Magento/Weee/etc/db_schema.xml b/app/code/Magento/Weee/etc/db_schema.xml index aed8318993acf..b161c6b07a821 100644 --- a/app/code/Magento/Weee/etc/db_schema.xml +++ b/app/code/Magento/Weee/etc/db_schema.xml @@ -8,18 +8,18 @@
- - - - - diff --git a/app/code/Magento/Widget/etc/db_schema.xml b/app/code/Magento/Widget/etc/db_schema.xml index 6146761f6f251..565866bcded06 100644 --- a/app/code/Magento/Widget/etc/db_schema.xml +++ b/app/code/Magento/Widget/etc/db_schema.xml @@ -8,7 +8,7 @@
- @@ -22,15 +22,15 @@
- - - @@ -39,9 +39,9 @@ column="theme_id" referenceTable="theme" referenceColumn="theme_id" onDelete="CASCADE"/>
- - @@ -60,9 +60,9 @@
- -
- - @@ -95,13 +95,13 @@
- - - - diff --git a/app/code/Magento/Wishlist/etc/db_schema.xml b/app/code/Magento/Wishlist/etc/db_schema.xml index e3f3024df45fd..8038f04521516 100644 --- a/app/code/Magento/Wishlist/etc/db_schema.xml +++ b/app/code/Magento/Wishlist/etc/db_schema.xml @@ -8,11 +8,11 @@
- - - @@ -30,13 +30,13 @@
- - - - @@ -63,11 +63,11 @@
- - - diff --git a/app/etc/di.xml b/app/etc/di.xml index a94adaae5cf06..93ec69dfe1586 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -1815,4 +1815,13 @@ configured_block_cache + + + + ^8\.0\. + ^5\.7\. + ^10\.[2-4]\. + + + diff --git a/composer.json b/composer.json index bb70029021765..72a6e40e9af5f 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "OSL-3.0", "AFL-3.0" ], + "minimum-stability": "dev", "config": { "preferred-install": "dist", "sort-packages": true @@ -67,7 +68,7 @@ "laminas/laminas-view": "~2.11.2", "magento/composer": "1.6.x-dev", "magento/magento-composer-installer": ">=0.1.11", - "magento/zendframework1": "~1.14.2", + "magento/zendframework1": "MC-14884-Discribe-Table-doesnt-return-column-type-width-dev", "monolog/monolog": "^1.17", "paragonie/sodium_compat": "^1.6", "pelago/emogrifier": "^3.1.0", @@ -356,5 +357,11 @@ "Magento\\PhpStan\\": "dev/tests/static/framework/Magento/PhpStan/" } }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/magento-techdivision/zf1.git" + } + ], "prefer-stable": true } diff --git a/composer.lock b/composer.lock index 350a2f9c5a2ed..4aa375eb7d46f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "087f8432a6f317056b40a0b8a160a2cf", + "content-hash": "39f3780d89bff51360c667aa4d52ac1d", "packages": [ { "name": "braintree/braintree_php", @@ -3420,18 +3420,25 @@ }, { "name": "magento/zendframework1", - "version": "1.14.3", + "version": "dev-MC-14884-Discribe-Table-doesnt-return-column-type-width", "source": { "type": "git", - "url": "https://github.com/magento/zf1.git", - "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5" + "url": "https://github.com/magento-techdivision/zf1.git", + "reference": "92c628e96cc3e3242d55be12a0f8535c413a8fa3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/zf1/zipball/726855dfb080089dc7bc7b016624129f8e7bc4e5", - "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5", + "url": "https://api.github.com/repos/magento-techdivision/zf1/zipball/92c628e96cc3e3242d55be12a0f8535c413a8fa3", + "reference": "92c628e96cc3e3242d55be12a0f8535c413a8fa3", "shasum": "" }, + "archive": { + "exclude": [ + "/demos", + "/documentation", + "/tests" + ] + }, "require": { "php": ">=5.2.11" }, @@ -3440,17 +3447,11 @@ "phpunit/phpunit": "3.7.*" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.12.x-dev" - } - }, "autoload": { "psr-0": { "Zend_": "library/" } }, - "notification-url": "https://packagist.org/downloads/", "include-path": [ "library/" ], @@ -3460,10 +3461,13 @@ "description": "Magento Zend Framework 1", "homepage": "http://framework.zend.com/", "keywords": [ - "ZF1", - "framework" + "framework", + "zf1" ], - "time": "2019-11-26T15:09:40+00:00" + "support": { + "source": "https://github.com/magento-techdivision/zf1/tree/MC-14884-Discribe-Table-doesnt-return-column-type-width" + }, + "time": "2020-04-20T12:19:33+00:00" }, { "name": "monolog/monolog", @@ -10110,9 +10114,10 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "dev", "stability-flags": { "magento/composer": 20, + "magento/zendframework1": 20, "magento/magento2-functional-testing-framework": 20 }, "prefer-stable": true, diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeRepositoryTest.php index f14fe207bfe6b..f5334c505e5c9 100644 --- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeRepositoryTest.php @@ -69,7 +69,6 @@ public function testGetList() $this->assertTrue($response['total_count'] > 0); $this->assertTrue(count($response['items']) > 0); - $this->assertNotNull($response['items'][0]['default_frontend_label']); $this->assertNotNull($response['items'][0]['attribute_id']); } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php index 6900f89a55f9d..7627d78df12dc 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php @@ -9,15 +9,17 @@ */ namespace Magento\TestFramework\Db; +use Magento\Framework\Exception\LocalizedException; + class Mysql extends \Magento\TestFramework\Db\AbstractDb { /** - * Default port + * Mysql default Port. */ const DEFAULT_PORT = 3306; /** - * Defaults extra file name + * Name of configuration file. */ const DEFAULTS_EXTRA_FILE_NAME = 'defaults_extra.cnf'; @@ -42,8 +44,20 @@ class Mysql extends \Magento\TestFramework\Db\AbstractDb */ private $_port; + /** + * @var bool + */ + private $mysqlDumpVersionIs8; + /** * {@inheritdoc} + * + * @param string $host + * @param string $user + * @param string $password + * @param string $schema + * @param string $varPath + * @param \Magento\Framework\Shell $shell */ public function __construct($host, $user, $password, $schema, $varPath, \Magento\Framework\Shell $shell) { @@ -102,15 +116,35 @@ public function isDbDumpExists() public function storeDbDump() { $this->ensureDefaultsExtraFile(); + $additionalArguments = ''; + + if ($this->isMysqlDumpVersion8()) { + $additionalArguments = '--column-statistics=0'; + } + + $format = sprintf( + '%s %s %s', + 'mysqldump --defaults-file=%s --host=%s --port=%s', + $additionalArguments, + '%s > %s' + ); + $this->_shell->execute( - 'mysqldump --defaults-file=%s --host=%s --port=%s %s > %s', - [$this->_defaultsExtraFile, $this->_host, $this->_port, $this->_schema, $this->getSetupDbDumpFilename()] + $format, + [ + $this->_defaultsExtraFile, + $this->_host, + $this->_port, + $this->_schema, + $this->getSetupDbDumpFilename() + ] ); } /** - * {@inheritdoc} - * @throws \LogicException + * @inheritdoc + * + * @throws LocalizedException */ public function restoreFromDbDump() { @@ -125,7 +159,7 @@ public function restoreFromDbDump() } /** - * {@inheritdoc} + * @inheritdoc */ public function getVendorName() { @@ -141,9 +175,32 @@ private function ensureDefaultsExtraFile() { if (!file_exists($this->_defaultsExtraFile)) { $this->assertVarPathWritable(); - $extraConfig = ['[client]', 'user=' . $this->_user, 'password="' . $this->_password . '"']; + $extraConfig = [ + '[client]', + 'user=' . $this->_user, + 'password="' . $this->_password . '"' + ]; file_put_contents($this->_defaultsExtraFile, implode(PHP_EOL, $extraConfig)); chmod($this->_defaultsExtraFile, 0640); } } + + /** + * Check if mysql dump is version 8. + * + * @return bool + * @throws LocalizedException + */ + private function isMysqlDumpVersion8(): bool + { + if (!$this->mysqlDumpVersionIs8) { + $version = $this->_shell->execute( + 'mysqldump --version' + ); + + $this->mysqlDumpVersionIs8 = (bool) preg_match('/8\.0\./', $version); + } + + return $this->mysqlDumpVersionIs8; + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php index 7c57440fdb29d..1ab700ed58948 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/WeightTest.php @@ -71,7 +71,7 @@ public function testProductHasWeight($type) $form = $this->_formFactory->create(); $form->setDataObject($currentProduct); $block->setForm($form); - $this->assertNotRegExp( + $this->assertDoesNotMatchRegularExpression( '/value="0".*checked="checked"/', $block->getElementHtml(), '"Does this have a weight" is set to "No" for physical products' diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php index d3287ae492d37..4526a83bb0bce 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/CheckProductPriceTest.php @@ -140,7 +140,7 @@ public function testCheckFixedTierPriceForLoggedUser(): void { $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); $this->assertFinalPrice($priceHtml, 205.00); - $this->assertNotRegExp('/\$10/', $priceHtml); + $this->assertDoesNotMatchRegularExpression('/\$10/', $priceHtml); $this->customerSession->setCustomerId(1); try { $priceHtml = $this->getProductPriceHtml('simple-product-tax-none'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/AbstractRenderCustomOptionsTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/AbstractRenderCustomOptionsTest.php index 5e5834304f107..eb34696c70dbf 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/AbstractRenderCustomOptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/View/Options/AbstractRenderCustomOptionsTest.php @@ -160,7 +160,7 @@ protected function assertSelectOptionRenderingOnProduct( if (isset($checkArray['not_contain_arr'])) { foreach ($checkArray['not_contain_arr'] as $notContainPattern) { - $this->assertNotRegExp($notContainPattern, $optionHtml); + $this->assertDoesNotMatchRegularExpression($notContainPattern, $optionHtml); } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/ResourceModel/Product/ConditionsToCollectionApplierTest.php b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/ResourceModel/Product/ConditionsToCollectionApplierTest.php index 1b2485e20fc9d..2f833d5f25776 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogRule/Model/ResourceModel/Product/ConditionsToCollectionApplierTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogRule/Model/ResourceModel/Product/ConditionsToCollectionApplierTest.php @@ -78,6 +78,9 @@ function (Product $product) { asort($expectedSkuList); asort($resultSkuList); + $expectedSkuList = array_values($expectedSkuList); + $resultSkuList = array_values($resultSkuList); + $this->assertEquals($expectedSkuList, $resultSkuList, sprintf('%s failed', $variationName)); } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/Backup/DbTest.php b/dev/tests/integration/testsuite/Magento/Framework/Backup/DbTest.php index 4cdec5b8ea720..f25880e10c811 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Backup/DbTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Backup/DbTest.php @@ -57,18 +57,10 @@ public function testBackupIncludesCustomTriggers() $tableName = Bootstrap::getObjectManager()->get(Setup::class) ->getTable('test_table_with_custom_trigger'); $this->assertMatchesRegularExpression( - '/CREATE TRIGGER test_custom_trigger AFTER INSERT ON '. $tableName . ' FOR EACH ROW/', + '/CREATE TRIGGER `?test_custom_trigger`? AFTER INSERT ON `?'. $tableName . '`? FOR EACH ROW/', $content ); //Clean up. $write->delete('/backups/' . $time . '_db_testbackup.sql'); } - - /** - * teardown - */ - protected function tearDown(): void - { - parent::tearDown(); - } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php index ce3141ffc571a..345302a374081 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php @@ -187,7 +187,11 @@ public function testCreateTableColumnWithExpressionAsColumnDefaultValue() //Test default value with expression $this->assertEquals('created_at', $dateColumn['COLUMN_NAME'], 'Incorrect column name'); $this->assertEquals(Table::TYPE_DATETIME, $dateColumn['DATA_TYPE'], 'Incorrect column type'); - $this->assertEquals('CURRENT_TIMESTAMP', $dateColumn['DEFAULT'], 'Incorrect column default expression value'); + $this->assertMatchesRegularExpression( + '/(CURRENT_TIMESTAMP|current_timestamp\(\))/', + $dateColumn['DEFAULT'], + 'Incorrect column default expression value' + ); //Test default value with integer value $this->assertEquals('integer_column', $intColumn['COLUMN_NAME'], 'Incorrect column name'); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php index 7bb71a3d8b6b3..40f7853535068 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php @@ -14,7 +14,7 @@ class LayoutTestWithExceptions extends \PHPUnit\Framework\TestCase */ protected $layout; - protected function setUp() + protected function setUp(): void { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $layoutFactory = $objectManager->get(\Magento\Framework\View\LayoutFactory::class); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/ValidateTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/ValidateTest.php index 3f8c2852203a3..8675e2005535b 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/ValidateTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Controller/Adminhtml/Import/ValidateTest.php @@ -72,7 +72,7 @@ public function testValidationReturn(string $fileName, string $mimeType, string $this->assertStringContainsString($message, $this->getResponse()->getBody()); $this->assertStringNotContainsString('The file was not uploaded.', $this->getResponse()->getBody()); - $this->assertNotRegExp( + $this->assertDoesNotMatchRegularExpression( '/clear[^\[]*\[[^\]]*(import_file|import_image_archive)[^\]]*\]/m', $this->getResponse()->getBody() ); diff --git a/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php b/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php index ad1c0707e7896..503a258717457 100644 --- a/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php +++ b/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php @@ -29,6 +29,12 @@ ] )->save(); +/* + * Added a sleep because otherwise it could be that the three reviews have the same created at timestamp. + * In this case some tests would (randomly) fail because the sort order depends on mysql and not on order by. + */ +sleep(1); + $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Review\Model\Review::class, ['data' => ['nickname' => 'Nickname', 'title' => '2 filter first review', 'detail' => 'Review text']] @@ -51,6 +57,12 @@ ] )->save(); +/* + * Added a sleep because otherwise it could be that the three reviews have the same created at timestamp. + * In this case some tests could (randomly) fail because the sort order depends on mysql and not on order by. + */ +sleep(1); + $review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Review\Model\Review::class, ['data' => ['nickname' => 'Nickname', 'title' => '1 filter second review', 'detail' => 'Review text']] diff --git a/dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php b/dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php index 5b3608fe8daf3..8c434e7e10cf7 100644 --- a/dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php @@ -27,7 +27,8 @@ public function testIndexAction(array $postData, string $expected): void { $this->getRequest()->setPostValue('translate', $postData); $this->dispatch('translation/ajax/index'); - $this->assertEquals($expected, $this->getResponse()->getBody()); + $result = $this->getResponse()->getBody(); + $this->assertEquals($expected, $result); } /** diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mariadb10.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mariadb10.php new file mode 100644 index 0000000000000..42741b80efac7 --- /dev/null +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mariadb10.php @@ -0,0 +1,60 @@ + 'CREATE TABLE `auto_increment_test` ( + `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(6) unsigned DEFAULT 0, + UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8', + 'reference_table' => 'CREATE TABLE `reference_table` ( + `tinyint_ref` tinyint(2) NOT NULL AUTO_INCREMENT, + `tinyint_without_padding` tinyint(2) NOT NULL DEFAULT 0, + `bigint_without_padding` bigint(20) NOT NULL DEFAULT 0, + `smallint_without_padding` smallint(6) NOT NULL DEFAULT 0, + `integer_without_padding` int(11) NOT NULL DEFAULT 0, + `smallint_with_big_padding` smallint(6) NOT NULL DEFAULT 0, + `smallint_without_default` smallint(6) DEFAULT NULL, + `int_without_unsigned` int(11) DEFAULT NULL, + `int_unsigned` int(11) unsigned DEFAULT NULL, + `bigint_default_nullable` bigint(20) unsigned DEFAULT 1, + `bigint_not_default_not_nullable` bigint(20) unsigned NOT NULL, + `smallint_ref` smallint(6) NOT NULL DEFAULT 0, + PRIMARY KEY (`tinyint_ref`,`smallint_ref`), + UNIQUE KEY `REFERENCE_TABLE_SMALLINT_REF` (`smallint_ref`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8', + 'test_table' => 'CREATE TABLE `test_table` ( + `smallint` smallint(6) DEFAULT NULL, + `tinyint` tinyint(2) DEFAULT NULL, + `bigint` bigint(20) DEFAULT 0, + `float` float(12,10) DEFAULT 0.0000000000, + `double` double(245,10) DEFAULT 11111111.1111110000, + `decimal` decimal(15,4) DEFAULT 0.0000, + `date` date DEFAULT NULL, + `timestamp` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `datetime` datetime DEFAULT \'0000-00-00 00:00:00\', + `longtext` longtext DEFAULT NULL, + `mediumtext` mediumtext DEFAULT NULL, + `varchar` varchar(254) DEFAULT NULL, + `char` char(255) DEFAULT NULL, + `mediumblob` mediumblob DEFAULT NULL, + `blob` blob DEFAULT NULL, + `boolean` tinyint(1) DEFAULT NULL, + `integer_main` int(11) unsigned DEFAULT NULL, + `smallint_main` smallint(6) NOT NULL DEFAULT 0, + UNIQUE KEY `TEST_TABLE_SMALLINT_FLOAT` (`smallint`,`float`), + UNIQUE KEY `TEST_TABLE_DOUBLE` (`double`), + KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`), + KEY `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` (`smallint_main`), + KEY `FK_FB77604C299EB8612D01E4AF8D9931F2` (`integer_main`), + CONSTRAINT `FK_FB77604C299EB8612D01E4AF8D9931F2` FOREIGN KEY (`integer_main`) +REFERENCES `auto_increment_test` (`int_auto_increment_with_nullable`) ON DELETE CASCADE, + CONSTRAINT `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` FOREIGN KEY (`smallint_main`) +REFERENCES `reference_table` (`smallint_ref`) ON DELETE CASCADE, + CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) +REFERENCES `reference_table` (`tinyint_ref`) ON DELETE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8', +]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mysql8.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mysql8.php new file mode 100644 index 0000000000000..6f0ed86f942bc --- /dev/null +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mysql8.php @@ -0,0 +1,57 @@ + 'CREATE TABLE `auto_increment_test` ( + `int_auto_increment_with_nullable` int unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint unsigned DEFAULT \'0\', + UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8', + 'reference_table' => 'CREATE TABLE `reference_table` ( + `tinyint_ref` tinyint NOT NULL AUTO_INCREMENT, + `tinyint_without_padding` tinyint NOT NULL DEFAULT \'0\', + `bigint_without_padding` bigint NOT NULL DEFAULT \'0\', + `smallint_without_padding` smallint NOT NULL DEFAULT \'0\', + `integer_without_padding` int NOT NULL DEFAULT \'0\', + `smallint_with_big_padding` smallint NOT NULL DEFAULT \'0\', + `smallint_without_default` smallint DEFAULT NULL, + `int_without_unsigned` int DEFAULT NULL, + `int_unsigned` int unsigned DEFAULT NULL, + `bigint_default_nullable` bigint unsigned DEFAULT \'1\', + `bigint_not_default_not_nullable` bigint unsigned NOT NULL, + `smallint_ref` smallint NOT NULL DEFAULT \'0\', + PRIMARY KEY (`tinyint_ref`,`smallint_ref`), + UNIQUE KEY `REFERENCE_TABLE_SMALLINT_REF` (`smallint_ref`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8', + 'test_table' => 'CREATE TABLE `test_table` ( + `smallint` smallint DEFAULT NULL, + `tinyint` tinyint DEFAULT NULL, + `bigint` bigint DEFAULT \'0\', + `float` float(12,10) DEFAULT \'0.0000000000\', + `double` double(245,10) DEFAULT \'11111111.1111110000\', + `decimal` decimal(15,4) DEFAULT \'0.0000\', + `date` date DEFAULT NULL, + `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `datetime` datetime DEFAULT \'0000-00-00 00:00:00\', + `longtext` longtext, + `mediumtext` mediumtext, + `varchar` varchar(254) DEFAULT NULL, + `char` char(255) DEFAULT NULL, + `mediumblob` mediumblob, + `blob` blob, + `boolean` tinyint(1) DEFAULT NULL, + `integer_main` int unsigned DEFAULT NULL, + `smallint_main` smallint NOT NULL DEFAULT \'0\', + UNIQUE KEY `TEST_TABLE_SMALLINT_FLOAT` (`smallint`,`float`), + UNIQUE KEY `TEST_TABLE_DOUBLE` (`double`), + KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`), + KEY `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` (`smallint_main`), + KEY `FK_FB77604C299EB8612D01E4AF8D9931F2` (`integer_main`), + CONSTRAINT `FK_FB77604C299EB8612D01E4AF8D9931F2` FOREIGN KEY (`integer_main`) REFERENCES `auto_increment_test` (`int_auto_increment_with_nullable`) ON DELETE CASCADE, + CONSTRAINT `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` FOREIGN KEY (`smallint_main`) REFERENCES `reference_table` (`smallint_ref`) ON DELETE CASCADE, + CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8', +]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php index 0b1ec6245478b..231566daf14af 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php @@ -3,32 +3,33 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(12) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(12) unsigned DEFAULT \'0\', + `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(6) unsigned DEFAULT \'0\', UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'reference_table' => 'CREATE TABLE `reference_table` ( - `tinyint_ref` tinyint(7) NOT NULL AUTO_INCREMENT, + `tinyint_ref` tinyint(2) NOT NULL AUTO_INCREMENT, `tinyint_without_padding` tinyint(2) NOT NULL DEFAULT \'0\', `bigint_without_padding` bigint(20) NOT NULL DEFAULT \'0\', - `smallint_without_padding` smallint(5) NOT NULL DEFAULT \'0\', + `smallint_without_padding` smallint(6) NOT NULL DEFAULT \'0\', `integer_without_padding` int(11) NOT NULL DEFAULT \'0\', - `smallint_with_big_padding` smallint(254) NOT NULL DEFAULT \'0\', - `smallint_without_default` smallint(2) DEFAULT NULL, - `int_without_unsigned` int(2) DEFAULT NULL, - `int_unsigned` int(2) unsigned DEFAULT NULL, - `bigint_default_nullable` bigint(2) unsigned DEFAULT \'1\', - `bigint_not_default_not_nullable` bigint(2) unsigned NOT NULL, - `smallint_ref` smallint(254) NOT NULL DEFAULT \'0\', + `smallint_with_big_padding` smallint(6) NOT NULL DEFAULT \'0\', + `smallint_without_default` smallint(6) DEFAULT NULL, + `int_without_unsigned` int(11) DEFAULT NULL, + `int_unsigned` int(11) unsigned DEFAULT NULL, + `bigint_default_nullable` bigint(20) unsigned DEFAULT \'1\', + `bigint_not_default_not_nullable` bigint(20) unsigned NOT NULL, + `smallint_ref` smallint(6) NOT NULL DEFAULT \'0\', PRIMARY KEY (`tinyint_ref`,`smallint_ref`), UNIQUE KEY `REFERENCE_TABLE_SMALLINT_REF` (`smallint_ref`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'test_table' => 'CREATE TABLE `test_table` ( - `smallint` smallint(3) DEFAULT NULL, - `tinyint` tinyint(7) DEFAULT NULL, - `bigint` bigint(13) DEFAULT \'0\', + `smallint` smallint(6) DEFAULT NULL, + `tinyint` tinyint(2) DEFAULT NULL, + `bigint` bigint(20) DEFAULT \'0\', `float` float(12,10) DEFAULT \'0.0000000000\', `double` double(245,10) DEFAULT \'11111111.1111110000\', `decimal` decimal(15,4) DEFAULT \'0.0000\', @@ -42,8 +43,8 @@ `mediumblob` mediumblob, `blob` blob, `boolean` tinyint(1) DEFAULT NULL, - `integer_main` int(12) unsigned DEFAULT NULL, - `smallint_main` smallint(254) NOT NULL DEFAULT \'0\', + `integer_main` int(11) unsigned DEFAULT NULL, + `smallint_main` smallint(6) NOT NULL DEFAULT \'0\', UNIQUE KEY `TEST_TABLE_SMALLINT_FLOAT` (`smallint`,`float`), UNIQUE KEY `TEST_TABLE_DOUBLE` (`double`), KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`), diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.mysql8.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.mysql8.php new file mode 100644 index 0000000000000..fca11331318d6 --- /dev/null +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.mysql8.php @@ -0,0 +1,27 @@ + [ + 'store' => 'CREATE TABLE `store` ( + `store_owner_id` smallint DEFAULT NULL COMMENT \'Store Owner Reference\', + KEY `STORE_STORE_OWNER_ID_STORE_OWNER_OWNER_ID` (`store_owner_id`), + CONSTRAINT `STORE_STORE_OWNER_ID_STORE_OWNER_OWNER_ID` FOREIGN KEY (`store_owner_id`) REFERENCES `store_owner` (`owner_id`) ON DELETE SET NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8', + 'store_owner' => 'CREATE TABLE `store_owner` ( + `owner_id` smallint NOT NULL AUTO_INCREMENT, + `store_owner_name` varchar(255) DEFAULT NULL COMMENT \'Store Owner Name\', + PRIMARY KEY (`owner_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'Store owner information\'' + ], + 'after' => [ + 'store' => 'CREATE TABLE `store` ( + `store_owner` varchar(255) DEFAULT NULL COMMENT \'Store Owner Name\' +) ENGINE=InnoDB DEFAULT CHARSET=utf8' + ] +]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.php index f5b98ce8a2735..61f4c5cd7fc61 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/rollback.php @@ -9,13 +9,13 @@ return [ 'before' => [ 'store' => 'CREATE TABLE `store` ( - `store_owner_id` smallint(5) DEFAULT NULL COMMENT \'Store Owner Reference\', + `store_owner_id` smallint(6) DEFAULT NULL COMMENT \'Store Owner Reference\', KEY `STORE_STORE_OWNER_ID_STORE_OWNER_OWNER_ID` (`store_owner_id`), CONSTRAINT `STORE_STORE_OWNER_ID_STORE_OWNER_OWNER_ID` FOREIGN KEY (`store_owner_id`) REFERENCES `store_owner` (`owner_id`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'store_owner' => 'CREATE TABLE `store_owner` ( - `owner_id` smallint(5) NOT NULL AUTO_INCREMENT, + `owner_id` smallint(6) NOT NULL AUTO_INCREMENT, `store_owner_name` varchar(255) DEFAULT NULL COMMENT \'Store Owner Name\', PRIMARY KEY (`owner_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=\'Store owner information\'' diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mariadb10.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mariadb10.php new file mode 100644 index 0000000000000..1f5a600ea8464 --- /dev/null +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mariadb10.php @@ -0,0 +1,12 @@ + 'CREATE TABLE `auto_increment_test` ( + `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(6) unsigned DEFAULT 0, + UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8' +]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mysql8.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mysql8.php new file mode 100644 index 0000000000000..6eef0bbc1603a --- /dev/null +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mysql8.php @@ -0,0 +1,12 @@ + 'CREATE TABLE `auto_increment_test` ( + `int_auto_increment_with_nullable` int unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint unsigned DEFAULT \'0\', + UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8' +]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.php index 7bd0213c6590d..b54533906f1af 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.php @@ -5,8 +5,8 @@ */ return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(12) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(12) unsigned DEFAULT \'0\', + `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(6) unsigned DEFAULT \'0\', UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8' ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mysql8.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mysql8.php new file mode 100644 index 0000000000000..91406e57728b3 --- /dev/null +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mysql8.php @@ -0,0 +1,56 @@ + 'CREATE TABLE `auto_increment_test` ( + `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(6) unsigned DEFAULT 0, + UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8' +]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.mysql8.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.mysql8.php new file mode 100644 index 0000000000000..bd1f8a215297c --- /dev/null +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.mysql8.php @@ -0,0 +1,14 @@ + 'CREATE TABLE `auto_increment_test` ( + `int_auto_increment_with_nullable` int unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint unsigned DEFAULT \'0\', + UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8' +]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.php index 633185390ae84..57763a671c9a1 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.php @@ -7,8 +7,8 @@ return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(12) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(12) unsigned DEFAULT \'0\', + `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(6) unsigned DEFAULT \'0\', UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8' ]; diff --git a/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/DataProviderFromFile.php b/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/DataProviderFromFile.php index 6bc513b659074..691e3b6f66678 100644 --- a/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/DataProviderFromFile.php +++ b/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/DataProviderFromFile.php @@ -6,6 +6,7 @@ namespace Magento\TestFramework\Annotation; +use Magento\Framework\DB\Adapter\SqlVersionProvider; use Magento\TestFramework\Deploy\CliCommand; use Magento\TestFramework\Deploy\TestModuleManager; use Magento\TestFramework\TestCase\MutableDataInterface; @@ -15,6 +16,19 @@ */ class DataProviderFromFile { + /** + * @var string + */ + const FALLBACK_VALUE = 'default'; + + /** + * @var array + */ + const POSSIBLE_SUFFIXES = [ + SqlVersionProvider::MYSQL_8_VERSION => 'mysql8', + SqlVersionProvider::MARIA_DB_10_VERSION => 'mariadb10', + ]; + /** * @var TestModuleManager */ @@ -45,9 +59,10 @@ public function startTest(\PHPUnit\Framework\TestCase $test) $annotations = $test->getAnnotations(); //This annotation can be declared only on method level if (isset($annotations['method']['dataProviderFromFile']) && $test instanceof MutableDataInterface) { - $data = include TESTS_MODULES_PATH . "/" . $annotations['method']['dataProviderFromFile'][0]; - $test->setData($data); - } else if (!$test instanceof MutableDataInterface) { + $test->setData( + $this->loadAllFiles(TESTS_MODULES_PATH . "/" . $annotations['method']['dataProviderFromFile'][0]) + ); + } elseif (!$test instanceof MutableDataInterface) { throw new \Exception("Test type do not supports @dataProviderFromFile annotation"); } } @@ -64,4 +79,63 @@ public function endTest(\PHPUnit\Framework\TestCase $test) $test->flushData(); } } + + /** + * Load different db version files for different databases. + * + * @param string $path The path of the inital file. + * + * @return array + */ + private function loadAllFiles(string $path): array + { + $result = []; + $pathWithoutExtension = $this->removeFileExtension($path); + + foreach (glob($pathWithoutExtension . '.*') as $file) { + /* Search database string in file name like mysql8 with + possibility to use version until patch level. */ + preg_match('/\.([\D]*[\d]*(?:\.[\d]+){0,2})/', $file, $splitedParts); + $dbKey = self::FALLBACK_VALUE; + + if (count($splitedParts) > 1) { + $database = array_pop($splitedParts); + + if ($this->isValidDatabaseSuffix($database)) { + $dbKey = $database; + } + } + + $result[$dbKey] = include $file; + } + + return $result; + } + + /** + * Remove the file extension from path. + * + * @param string $path The file path. + * + * @return string + */ + private function removeFileExtension(string $path) + { + $result = explode('.', $path); + array_pop($result); + + return implode('.', $result); + } + + /** + * Check if database suffix is valid. + * + * @param string $databaseSuffix The suffix of the database from the file + * + * @return bool + */ + private function isValidDatabaseSuffix(string $databaseSuffix): bool + { + return in_array($databaseSuffix, self::POSSIBLE_SUFFIXES); + } } diff --git a/dev/tests/setup-integration/framework/Magento/TestFramework/TestCase/SetupTestCase.php b/dev/tests/setup-integration/framework/Magento/TestFramework/TestCase/SetupTestCase.php index e1efe5738910a..95f7e5b463160 100644 --- a/dev/tests/setup-integration/framework/Magento/TestFramework/TestCase/SetupTestCase.php +++ b/dev/tests/setup-integration/framework/Magento/TestFramework/TestCase/SetupTestCase.php @@ -3,10 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\TestFramework\TestCase; -use Magento\Framework\App\DesignInterface; -use Magento\Framework\View\DesignExceptions; +use Magento\Framework\DB\Adapter\ConnectionException; +use Magento\Framework\DB\Adapter\SqlVersionProvider; +use Magento\TestFramework\Annotation\DataProviderFromFile; +use Magento\TestFramework\Helper\Bootstrap; /** * Instance of Setup test case. Used in order to tweak dataProviders functionality. @@ -18,6 +22,29 @@ class SetupTestCase extends \PHPUnit\Framework\TestCase implements MutableDataIn */ private $data = []; + /** + * @var string + */ + private $dbKey; + + /** + * @var SqlVersionProvider + */ + private $sqlVersionProvider; + + /** + * @inheritDoc + */ + public function __construct( + $name = null, + array $data = [], + $dataName = '' + ) { + parent::__construct($name, $data, $dataName); + + $this->sqlVersionProvider = Bootstrap::getObjectManager()->get(SqlVersionProvider::class); + } + /** * @inheritdoc */ @@ -39,6 +66,43 @@ public function flushData() */ public function getData() { - return $this->data; + if (array_key_exists($this->getDbKey(), $this->data)) { + return $this->data[$this->getDbKey()]; + } + + return $this->data[DataProviderFromFile::FALLBACK_VALUE]; + } + + /** + * Get database version. + * + * @return string + * @throws ConnectionException + */ + protected function getDatabaseVersion(): string + { + return $this->sqlVersionProvider->getSqlVersion(); + } + + /** + * Get db key to decide which file to use. + * + * @return string + */ + private function getDbKey(): string + { + if ($this->dbKey) { + return $this->dbKey; + } + + $this->dbKey = DataProviderFromFile::FALLBACK_VALUE; + foreach (DataProviderFromFile::POSSIBLE_SUFFIXES as $possibleVersion => $suffix) { + if (strpos($this->getDatabaseVersion(), (string)$possibleVersion) !== false) { + $this->dbKey = $suffix; + break; + } + } + + return $this->dbKey; } } diff --git a/dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php b/dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php index 3082ca01899c6..e88d47a02c0d8 100644 --- a/dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php +++ b/dev/tests/setup-integration/testsuite/Magento/Setup/DeclarativeInstallerTest.php @@ -423,7 +423,7 @@ public function testDisableIndexByExternalModule() $this->cliCommand->upgrade(); $tableStatements = $this->describeTable->describeShard('default'); $tableSql = $tableStatements['test_table']; - $this->assertNotRegExp( + $this->assertDoesNotMatchRegularExpression( '/KEY\s+`TEST_TABLE_VARCHAR`\s+\(`varchar`\)/', $tableSql, 'Index is not being disabled by external module' diff --git a/dev/tests/setup-integration/testsuite/Magento/Setup/DiffOldSchemaTest.php b/dev/tests/setup-integration/testsuite/Magento/Setup/DiffOldSchemaTest.php index 3a4eb3216bd88..28b28eed1f9c4 100644 --- a/dev/tests/setup-integration/testsuite/Magento/Setup/DiffOldSchemaTest.php +++ b/dev/tests/setup-integration/testsuite/Magento/Setup/DiffOldSchemaTest.php @@ -6,6 +6,7 @@ namespace Magento\Setup; +use Magento\Framework\DB\Adapter\SqlVersionProvider; use Magento\Framework\Setup\Declaration\Schema\Diff\DiffFactory; use Magento\Framework\Setup\Declaration\Schema\Diff\SchemaDiff; use Magento\Framework\Setup\Declaration\Schema\SchemaConfigInterface; @@ -156,7 +157,7 @@ private function getBigIntKeyDbSensitiveData() return [ 'type' => 'bigint', 'nullable' => true, - 'padding' => 20, + 'padding' => $this->getPaddingValue(), 'unsigned' => false, 'identity' => false, 'default' => 0, @@ -172,11 +173,25 @@ private function getBigIntKeyXmlSensitiveData() return [ 'type' => 'bigint', 'nullable' => true, - 'padding' => 20, + 'padding' => $this->getPaddingValue(), 'unsigned' => false, 'identity' => false, 'default' => 1, 'comment' => 'Bigint', ]; } + + /** + * Get padding regarding the database. + * + * @return int|null + */ + private function getPaddingValue() + { + if (strpos($this->getDatabaseVersion(), SqlVersionProvider::MYSQL_8_VERSION) !== false) { + return null; + } + + return 20; + } } diff --git a/dev/tests/setup-integration/testsuite/Magento/Setup/ValidationRulesTest.php b/dev/tests/setup-integration/testsuite/Magento/Setup/ValidationRulesTest.php index d21925ab74439..1d7d006869583 100644 --- a/dev/tests/setup-integration/testsuite/Magento/Setup/ValidationRulesTest.php +++ b/dev/tests/setup-integration/testsuite/Magento/Setup/ValidationRulesTest.php @@ -6,6 +6,7 @@ namespace Magento\Setup; +use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Setup\Declaration\Schema\SchemaConfig; use Magento\TestFramework\Deploy\CliCommand; use Magento\TestFramework\Deploy\TestModuleManager; @@ -45,7 +46,7 @@ protected function setUp(): void */ public function testFailOnInvalidPrimaryKey() { - $this->expectException(\Magento\Framework\Setup\Exception::class); + $this->expectException(LocalizedException::class); $this->expectExceptionMessageMatches( '/Primary key can`t be applied on table "test_table". All columns should be not nullable/' ); @@ -68,7 +69,7 @@ public function testFailOnInvalidPrimaryKey() */ public function testFailOnIncosistentReferenceDefinition() { - $this->expectException(\Magento\Framework\Setup\Exception::class); + $this->expectException(LocalizedException::class); $this->expectExceptionMessageMatches( '/Column definition "page_id_on" and reference column definition "page_id"' . ' are different in tables "dependent" and "test_table"/' @@ -91,7 +92,7 @@ public function testFailOnIncosistentReferenceDefinition() */ public function testFailOnInvalidAutoIncrementField() { - $this->expectException(\Magento\Framework\Setup\Exception::class); + $this->expectException(LocalizedException::class); $this->expectExceptionMessageMatches('/Auto Increment column do not have index. Column - "page_id"/'); $this->cliCommad->install( diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php index 271aa26ee56f0..0081c4081bbb8 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ClassesTest.php @@ -106,7 +106,7 @@ protected function _assertNonFactoryName($names, $file, $softComparison = false, foreach ($names as $name) { try { if ($softComparison) { - $this->assertNotRegExp('/\//', $name); + $this->assertDoesNotMatchRegularExpression('/\//', $name); } elseif ($moduleBlock) { $this->assertFalse(false === strpos($name, '_')); $this->assertMatchesRegularExpression('/^([A-Z][A-Za-z\d_]+)+$/', $name); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php index b02820bae901b..9775cdc2b9e20 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/EmailTemplateTest.php @@ -19,13 +19,13 @@ public function testObsoleteDirectives() * @param string $file */ function ($file) { - $this->assertNotRegExp( + $this->assertDoesNotMatchRegularExpression( '/\{\{htmlescape.*?\}\}/i', file_get_contents($file), 'Directive {{htmlescape}} is obsolete. Use {{var}} instead.' ); - $this->assertNotRegExp( + $this->assertDoesNotMatchRegularExpression( '/\{\{escapehtml.*?\}\}/i', file_get_contents($file), 'Directive {{escapehtml}} is obsolete. Use {{var}} instead.' diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php index b57f2b5bb2e5c..cabe4f91a0ef4 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/Magento/Widget/XmlTest.php @@ -26,7 +26,7 @@ function ($file) { /** @var \SimpleXMLElement $node */ foreach ($nodes as $node) { $type = (string)$node['type']; - $this->assertNotRegExp('/\//', $type, "Factory name detected: {$type}."); + $this->assertDoesNotMatchRegularExpression('/\//', $type, "Factory name detected: {$type}."); } }, \Magento\Framework\App\Utility\Files::init()->getConfigFiles('widget.xml') diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index 80d8808ab1768..f68540a98113e 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -25,9 +25,11 @@ use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Phrase; use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Setup\SchemaListener; use Magento\Framework\Stdlib\DateTime; use Magento\Framework\Stdlib\StringUtils; -use Magento\Framework\Setup\SchemaListener; +use Zend_Db_Adapter_Exception; +use Zend_Db_Statement_Exception; // @codingStandardsIgnoreStart @@ -132,6 +134,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface */ protected $_isDdlCacheAllowed = true; + /** + * MySQL version(MySQL-8, MySQL-5.7, MariaDB) + * + * @var string + */ + private $dbVersion; + /** * MySQL column - Table DDL type pairs * @@ -206,7 +215,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface /** * Map that links database error code to corresponding Magento exception * - * @var \Zend_Db_Adapter_Exception[] + * @var Zend_Db_Adapter_Exception[] */ private $exceptionMap; @@ -264,7 +273,7 @@ public function __construct( ]; try { parent::__construct($config); - } catch (\Zend_Db_Adapter_Exception $e) { + } catch (Zend_Db_Adapter_Exception $e) { throw new \InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } } @@ -375,8 +384,8 @@ public function convertDateTime($datetime) * @SuppressWarnings(PHPMD.NPathComplexity) * * @return void - * @throws \Zend_Db_Adapter_Exception - * @throws \Zend_Db_Statement_Exception + * @throws Zend_Db_Adapter_Exception + * @throws Zend_Db_Statement_Exception */ protected function _connect() { @@ -385,15 +394,15 @@ protected function _connect() } if (!extension_loaded('pdo_mysql')) { - throw new \Zend_Db_Adapter_Exception('pdo_mysql extension is not installed'); + throw new Zend_Db_Adapter_Exception('pdo_mysql extension is not installed'); } if (!isset($this->_config['host'])) { - throw new \Zend_Db_Adapter_Exception('No host configured to connect'); + throw new Zend_Db_Adapter_Exception('No host configured to connect'); } if (isset($this->_config['port'])) { - throw new \Zend_Db_Adapter_Exception('Port must be configured within host parameter (like localhost:3306'); + throw new Zend_Db_Adapter_Exception('Port must be configured within host parameter (like localhost:3306'); } unset($this->_config['port']); @@ -464,7 +473,7 @@ public function rawQuery($sql) { try { $result = $this->query($sql); - } catch (\Zend_Db_Statement_Exception $e) { + } catch (Zend_Db_Statement_Exception $e) { // Convert to \PDOException to maintain backwards compatibility with usage of MySQL adapter $e = $e->getPrevious(); if (!($e instanceof \PDOException)) { @@ -507,7 +516,7 @@ public function rawFetchRow($sql, $field = null) * * @param string|\Magento\Framework\DB\Select $sql * @return void - * @throws \Zend_Db_Adapter_Exception + * @throws Zend_Db_Adapter_Exception */ protected function _checkDdlTransaction($sql) { @@ -529,8 +538,8 @@ protected function _checkDdlTransaction($sql) * @param string|\Magento\Framework\DB\Select $sql The SQL statement with placeholders. * @param mixed $bind An array of data or data itself to bind to the placeholders. * @return \Zend_Db_Statement_Pdo|void - * @throws \Zend_Db_Adapter_Exception To re-throw \PDOException. - * @throws \Zend_Db_Statement_Exception + * @throws Zend_Db_Adapter_Exception To re-throw \PDOException. + * @throws Zend_Db_Statement_Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ protected function _query($sql, $bind = []) @@ -561,7 +570,7 @@ protected function _query($sql, $bind = []) $pdoException = null; if ($e instanceof \PDOException) { $pdoException = $e; - } elseif (($e instanceof \Zend_Db_Statement_Exception) + } elseif (($e instanceof Zend_Db_Statement_Exception) && ($e->getPrevious() instanceof \PDOException) ) { $pdoException = $e->getPrevious(); @@ -584,7 +593,7 @@ protected function _query($sql, $bind = []) // rethrow custom exception if needed if ($pdoException && isset($this->exceptionMap[$pdoException->errorInfo[1]])) { $customExceptionClass = $this->exceptionMap[$pdoException->errorInfo[1]]; - /** @var \Zend_Db_Adapter_Exception $customException */ + /** @var Zend_Db_Adapter_Exception $customException */ $customException = new $customExceptionClass($e->getMessage(), $pdoException->errorInfo[1], $e); throw $customException; } @@ -602,7 +611,7 @@ protected function _query($sql, $bind = []) * @param string|\Magento\Framework\DB\Select $sql The SQL statement with placeholders. * @param mixed $bind An array of data or data itself to bind to the placeholders. * @return \Zend_Db_Statement_Pdo|void - * @throws \Zend_Db_Adapter_Exception To re-throw \PDOException. + * @throws Zend_Db_Adapter_Exception To re-throw \PDOException. * @throws LocalizedException In case multiple queries are attempted at once, to protect from SQL injection * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ @@ -627,7 +636,7 @@ public function query($sql, $bind = []) * @param string|\Magento\Framework\DB\Select $sql The SQL statement with placeholders. * @param mixed $bind An array of data or data itself to bind to the placeholders. * @return \Zend_Db_Statement_Pdo|void - * @throws \Zend_Db_Adapter_Exception To re-throw \PDOException. + * @throws Zend_Db_Adapter_Exception To re-throw \PDOException. * @throws LocalizedException In case multiple queries are attempted at once, to protect from SQL injection * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @deprecated 100.2.0 @@ -1175,6 +1184,9 @@ public function modifyColumn($tableName, $columnName, $definition, $flushData = * @param string $tableName * @param string $schemaName * @return mixed + * @throws LocalizedException + * @throws Zend_Db_Adapter_Exception + * @throws Zend_Db_Statement_Exception */ public function showTableStatus($tableName, $schemaName = null) { @@ -1183,8 +1195,31 @@ public function showTableStatus($tableName, $schemaName = null) $fromDbName = ' FROM ' . $this->quoteIdentifier($schemaName); } $query = sprintf('SHOW TABLE STATUS%s LIKE %s', $fromDbName, $this->quote($tableName)); + //checks which slq engine used + if (!preg_match('/^(8\.)/', $this->isMysql8EngineUsed())) { + //if it's not MySQl-8 we just fetch results + return $this->rawFetchRow($query); + } + // Run show table status query in different connection because DDL queries do it in transaction, + // and we don't have actual table statistic in this case + $connection = $this->_transactionLevel ? $this->createConnection() : $this; + $connection->query(sprintf('ANALYZE TABLE %s', $this->quoteIdentifier($tableName))); + + return $connection->query($query)->fetch(\PDO::FETCH_ASSOC); + } + + /** + * Get database version. + * + * @return string + */ + private function isMysql8EngineUsed(): string + { + if (!$this->dbVersion) { + $this->dbVersion = $this->fetchPairs("SHOW variables LIKE 'version'")['version']; + } - return $this->rawFetchRow($query); + return $this->dbVersion; } /** diff --git a/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php b/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php new file mode 100644 index 0000000000000..f81e25c620950 --- /dev/null +++ b/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php @@ -0,0 +1,123 @@ +resourceConnection = $resourceConnection; + $this->supportedVersionPatterns = $supportedVersionPatterns; + } + + /** + * Provides SQL engine version (MariaDB, MySQL-8, MySQL-5.7) + * + * @param string $resource + * + * @return string + * @throws ConnectionException + */ + public function getSqlVersion(string $resource = ResourceConnection::DEFAULT_CONNECTION): string + { + if (!$this->version) { + $this->version = $this->getVersionString($resource); + } + + return $this->version; + } + + /** + * Provides Sql Engine Version string + * + * @param string $resource + * + * @return string + * @throws ConnectionException + */ + private function getVersionString(string $resource): string + { + $pattern = sprintf('/(%s)/', implode('|', $this->supportedVersionPatterns)); + $sqlVersionOutput = $this->fetchSqlVersion($resource); + preg_match($pattern, $sqlVersionOutput, $match); + if (empty($match)) { + throw new ConnectionException( + sprintf( + "Current version of RDBMS is not supported. Used Version: %s. Supported versions: %s", + $sqlVersionOutput, + implode(', ', array_keys($this->supportedVersionPatterns)) + ) + ); + } + + return reset($match); + } + + /** + * Fetch version from sql engine + * + * @param string $resource + * + * @return string + */ + private function fetchSqlVersion(string $resource): string + { + $versionOutput = $this->resourceConnection->getConnection($resource) + ->fetchPairs(sprintf('SHOW variables LIKE "%s"', self::VERSION_VAR_NAME)); + + return $versionOutput[self::VERSION_VAR_NAME]; + } +} diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/DefinitionAggregator.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/DefinitionAggregator.php index c1d3f9ebee751..57f49d62028d0 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/DefinitionAggregator.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/DefinitionAggregator.php @@ -3,10 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\Setup\Declaration\Schema\Db; -use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\SqlVersionProvider; use Magento\Framework\Setup\Declaration\Schema\Dto\ElementInterface; /** @@ -20,27 +21,22 @@ class DefinitionAggregator implements DbDefinitionProcessorInterface private $definitionProcessors; /** - * @var ResourceConnection + * @var SqlVersionProvider */ - private $resourceConnection; - - /** - * @var string - */ - private $dbVersion; + private $sqlVersionProvider; /** * Constructor. * - * @param ResourceConnection $resourceConnection + * @param SqlVersionProvider $sqlVersionProvider * @param DbDefinitionProcessorInterface[] $definitionProcessors */ public function __construct( - ResourceConnection $resourceConnection, + SqlVersionProvider $sqlVersionProvider, array $definitionProcessors ) { $this->definitionProcessors = $definitionProcessors; - $this->resourceConnection = $resourceConnection; + $this->sqlVersionProvider = $sqlVersionProvider; } /** @@ -79,21 +75,6 @@ public function fromDefinition(array $data) return $definitionProcessor->fromDefinition($data); } - /** - * Get DB version - * - * @return string - */ - private function getDatabaseVersion(): string - { - if (!$this->dbVersion) { - $this->dbVersion = $this->resourceConnection->getConnection('default') - ->fetchPairs("SHOW variables LIKE 'version'")['version']; - } - - return $this->dbVersion; - } - /** * Processes `$value` to be compatible with MySQL. * @@ -109,7 +90,7 @@ protected function processDefaultValue(array $data) if ($defaultValue === "'NULL'") { return "NULL"; } - if ($defaultValue === "NULL" && strpos($this->getDatabaseVersion(), 'MariaDB') !== false) { + if ($defaultValue === "NULL" && $this->isMariaDbSqlConnection()) { return null; } /* @@ -129,4 +110,17 @@ protected function processDefaultValue(array $data) return $defaultValue; } + + /** + * Checks if MariaDB used as SQL engine + * + * @return bool + */ + private function isMariaDbSqlConnection(): bool + { + return strpos( + $this->sqlVersionProvider->getSqlVersion(), + SqlVersionProvider::MARIA_DB_10_VERSION + ) === 0; + } } diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaReader.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaReader.php index a95b1812e68f9..d8c85ea9e206d 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaReader.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaReader.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\Setup\Declaration\Schema\Db\MySQL; diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaWriter.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaWriter.php index 65998e7541111..94e8e5642cad0 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaWriter.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/DbSchemaWriter.php @@ -61,9 +61,9 @@ class DbSchemaWriter implements DbSchemaWriterInterface /** * @param ResourceConnection $resourceConnection - * @param StatementFactory $statementFactory - * @param DryRunLogger $dryRunLogger - * @param array $tableOptions + * @param StatementFactory $statementFactory + * @param DryRunLogger $dryRunLogger + * @param array $tableOptions */ public function __construct( ResourceConnection $resourceConnection, @@ -101,8 +101,6 @@ public function createTable($tableName, $resource, array $definition, array $opt } /** - * Drop table from MySQL database. - * * @inheritdoc */ public function dropTable($tableName, $resource) @@ -127,24 +125,34 @@ public function dropTable($tableName, $resource) */ private function getDropElementSQL($type, $name) { + $result = sprintf('DROP COLUMN %s', $name); switch ($type) { case Constraint::PRIMARY_TYPE: - return 'DROP PRIMARY KEY'; + $result = 'DROP PRIMARY KEY'; + break; case Constraint::UNIQUE_TYPE: - return sprintf('DROP KEY %s', $name); + $result = sprintf('DROP KEY %s', $name); + break; case \Magento\Framework\Setup\Declaration\Schema\Dto\Index::TYPE: - return sprintf('DROP INDEX %s', $name); + $result = sprintf('DROP INDEX %s', $name); + break; case Reference::TYPE: - return sprintf('DROP FOREIGN KEY %s', $name); - default: - return sprintf('DROP COLUMN %s', $name); + $result = sprintf('DROP FOREIGN KEY %s', $name); + break; } + + return $result; } /** - * Add element to existing table: column, constraint or index. - * * @inheritdoc + * + * @param string $elementName + * @param string $resource + * @param string $tableName + * @param string $elementDefinition , for example: like CHAR(200) NOT NULL + * @param string $elementType + * @return Statement */ public function addElement($elementName, $resource, $tableName, $elementDefinition, $elementType) { @@ -165,6 +173,12 @@ public function addElement($elementName, $resource, $tableName, $elementDefiniti /** * @inheritdoc + * + * @param string $tableName + * @param string $resource + * @param string $optionName + * @param string $optionValue + * @return Statement */ public function modifyTableOption($tableName, $resource, $optionName, $optionValue) { @@ -178,9 +192,13 @@ public function modifyTableOption($tableName, $resource, $optionName, $optionVal } /** - * Modify column and change its definition. - * * @inheritdoc + * + * @param string $columnName + * @param string $resource + * @param string $tableName + * @param string $columnDefinition + * @return Statement */ public function modifyColumn($columnName, $resource, $tableName, $columnDefinition) { @@ -199,6 +217,12 @@ public function modifyColumn($columnName, $resource, $tableName, $columnDefiniti /** * @inheritdoc + * + * @param string $resource + * @param string $elementName + * @param string $tableName + * @param string $type + * @return Statement */ public function dropElement($resource, $elementName, $tableName, $type) { @@ -243,7 +267,11 @@ public function compile(StatementAggregator $statementAggregator, $dryRun) { foreach ($statementAggregator->getStatementsBank() as $statementBank) { $statementsSql = []; - /** @var Statement $statement */ + $statement = null; + + /** + * @var Statement $statement + */ foreach ($statementBank as $statement) { $statementsSql[] = $statement->getStatement(); } diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Boolean.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Boolean.php index 5b8c5e2d4a60b..c80b8ddba8032 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Boolean.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Boolean.php @@ -66,6 +66,8 @@ public function __construct( } /** + * Get definition for given column. + * * @param \Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Boolean $column * @inheritdoc */ @@ -85,11 +87,17 @@ public function toDefinition(ElementInterface $column) /** * Boolean is presented as tinyint(1). * - * @inheritdoc + * @param array $data + * @return array */ public function fromDefinition(array $data) { - if ($data['type'] === self::INTEGER_TYPE && $data['padding'] === self::INTEGER_PADDING) { + if ($data['type'] === self::INTEGER_TYPE && + ( + array_key_exists('padding', $data) && + $data['padding'] === self::INTEGER_PADDING + ) + ) { $data['type'] = strtolower(self::TYPE); if (isset($data['default'])) { $data['default'] = $data['default'] === null ? null : (bool) $data['default']; diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php index 1d08c5bea4eb0..c1c4446cf4ded 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php @@ -81,11 +81,22 @@ public function __construct( */ public function toDefinition(ElementInterface $column) { - return sprintf( - '%s %s(%s) %s %s %s %s %s', + $definition = sprintf( + '%s %s', $this->resourceConnection->getConnection()->quoteIdentifier($column->getName()), - $column->getType(), - $column->getPadding(), + $column->getType() + ); + + if ($column->getPadding() !== null) { + $definition .= sprintf( + '(%s)', + $column->getPadding() + ); + } + + return sprintf( + '%s %s %s %s %s %s', + $definition, $this->unsigned->toDefinition($column), $this->nullable->toDefinition($column), $column->getDefault() !== null ? @@ -101,13 +112,20 @@ public function toDefinition(ElementInterface $column) public function fromDefinition(array $data) { $matches = []; - if (preg_match('/^(big|small|tiny|medium)?int\((\d+)\)/', $data['definition'], $matches)) { + if (preg_match( + '/^(?big|small|tiny|medium)?int(\((?\d+)\))*/', + $data['definition'], + $matches + )) { /** * match[1] - prefix - * match[2] - padding, like 5 or 11 + * match[2] - padding with beaked, like (5) or (11) + * match[3] - padding, like 5 or 11 */ - //Use shortcut for mediuminteger - $data['padding'] = $matches[2]; + if (count($matches) >= 4) { + //Use shortcut for mediuminteger + $data['padding'] = $matches['padding']; + } $data = $this->unsigned->fromDefinition($data); $data = $this->nullable->fromDefinition($data); $data = $this->identity->fromDefinition($data); diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/OnUpdate.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/OnUpdate.php index 187f710b40edf..3be8704b378d9 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/OnUpdate.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/OnUpdate.php @@ -17,6 +17,8 @@ class OnUpdate implements DbDefinitionProcessorInterface { /** + * Get definition for given column. + * * @param \Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Timestamp $column * @inheritdoc */ @@ -36,7 +38,7 @@ public function toDefinition(ElementInterface $column) public function fromDefinition(array $data) { $matches = []; - if (preg_match('/^(?:on update)\s([\_\-\s\w\d]+)/', $data['extra'], $matches)) { + if (preg_match('/(?:on update)\s([\_\-\s\w\d]+)/', $data['extra'], $matches)) { $data['on_update'] = true; } diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/StringBinary.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/StringBinary.php index c2fd270a8f949..ace3f81e0f453 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/StringBinary.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/StringBinary.php @@ -16,6 +16,16 @@ */ class StringBinary implements DbDefinitionProcessorInterface { + /** + * Constant to define the binary data types. + */ + private const BINARY_TYPES = ['binary', 'varbinary']; + + /** + * Constant to define the char data types. + */ + private const CHAR_TYPES = ['char', 'varchar']; + /** * @var Nullable */ @@ -44,6 +54,8 @@ public function __construct(Nullable $nullable, ResourceConnection $resourceConn } /** + * Get definition for given column. + * * @param \Magento\Framework\Setup\Declaration\Schema\Dto\Columns\StringBinary $column * @inheritdoc */ @@ -71,11 +83,47 @@ public function toDefinition(ElementInterface $column) */ public function fromDefinition(array $data) { - $matches = []; - if (preg_match('/^(char|binary|varchar|varbinary)\s*\((\d+)\)/', $data['definition'], $matches)) { - $data['length'] = $matches[2]; + preg_match($this->getStringBinaryPattern(), $data['definition'], $matches); + + if (array_key_exists('padding', $matches) && !empty($matches['padding'])) { + $data['length'] = $matches['padding']; + } + + if (!isset($data['default'])) { + return $data; + } + + $isHex = preg_match('`^0x([a-f0-9]+)$`i', $data['default'], $hexMatches); + + if ($this->isBinaryHex($matches['type'], (bool)$isHex)) { + $data['default'] = hex2bin($hexMatches[1]); } return $data; } + + /** + * Get the pattern to identify binary and char types. + * + * @return string + */ + private function getStringBinaryPattern(): string + { + return sprintf( + '/^(?%s)\s*\(?(?\d*)\)?/', + implode('|', array_merge(self::CHAR_TYPES, self::BINARY_TYPES)) + ); + } + + /** + * Check if the type is binary and the value is a hex value. + * + * @param string $type + * @param bool $isHex + * @return bool + */ + private function isBinaryHex($type, bool $isHex): bool + { + return in_array($type, self::BINARY_TYPES) && $isHex; + } } diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php index f7a2a0d91396d..1e60ab407d61a 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/SchemaBuilder.php @@ -3,16 +3,17 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\Setup\Declaration\Schema\Db; +use Magento\Framework\Exception\NotFoundException; use Magento\Framework\Phrase; use Magento\Framework\Setup\Declaration\Schema\Dto\Column; use Magento\Framework\Setup\Declaration\Schema\Dto\ElementFactory; use Magento\Framework\Setup\Declaration\Schema\Dto\Schema; use Magento\Framework\Setup\Declaration\Schema\Dto\Table; use Magento\Framework\Setup\Declaration\Schema\Sharding; -use Magento\Framework\Setup\Exception; /** * This type of builder is responsible for converting ENTIRE data, that comes from db @@ -50,9 +51,9 @@ class SchemaBuilder /** * Constructor. * - * @param ElementFactory $elementFactory + * @param ElementFactory $elementFactory * @param DbSchemaReaderInterface $dbSchemaReader - * @param Sharding $sharding + * @param Sharding $sharding */ public function __construct( ElementFactory $elementFactory, @@ -131,8 +132,8 @@ public function build(Schema $schema) /** * Process references for all tables. Schema validation required. * - * @param Table[] $tables - * @param Schema $schema + * @param Table[] $tables + * @param Schema $schema */ private function processReferenceKeys(array $tables, Schema $schema) { @@ -170,15 +171,15 @@ private function processReferenceKeys(array $tables, Schema $schema) /** * Retrieve column objects from names. * - * @param Column[] $columns - * @param array $data - * @return Column[] - * @throws Exception + * @param Column[] $columns + * @param array $data + * @return Column[] + * @throws NotFoundException */ private function resolveInternalRelations(array $columns, array $data) { if (!is_array($data['column'])) { - throw new Exception( + throw new NotFoundException( new Phrase("Cannot find columns for internal index") ); } @@ -188,7 +189,7 @@ private function resolveInternalRelations(array $columns, array $data) if (!isset($columns[$columnName])) { $tableName = isset($data['table']) ? $data['table']->getName() : ''; trigger_error( - new Phrase( + (string)new Phrase( 'Column %1 does not exist for index/constraint %2 in table %3.', [ $columnName, diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php index 4c65d8a70bed5..d423e47c50c13 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Declaration/SchemaBuilder.php @@ -7,10 +7,9 @@ namespace Magento\Framework\Setup\Declaration\Schema\Declaration; +use Magento\Framework\App\ResourceConnection; use Magento\Framework\Phrase; use Magento\Framework\Setup\Declaration\Schema\Declaration\TableElement\ElementNameResolver; -use Magento\Framework\Stdlib\BooleanUtils; -use Magento\Framework\Setup\Exception; use Magento\Framework\Setup\Declaration\Schema\Dto\Column; use Magento\Framework\Setup\Declaration\Schema\Dto\Constraint; use Magento\Framework\Setup\Declaration\Schema\Dto\ElementFactory; @@ -18,6 +17,9 @@ use Magento\Framework\Setup\Declaration\Schema\Dto\Schema; use Magento\Framework\Setup\Declaration\Schema\Dto\Table; use Magento\Framework\Setup\Declaration\Schema\Sharding; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Stdlib\BooleanUtils; +use Magento\Framework\Validation\ValidationException; /** * This type of builder is responsible for converting ENTIRE data, that comes from XML into DTO`s format. @@ -64,7 +66,7 @@ class SchemaBuilder private $validationComposite; /** - * @var \Magento\Framework\App\ResourceConnection + * @var ResourceConnection */ private $resourceConnection; @@ -76,11 +78,11 @@ class SchemaBuilder /** * SchemaBuilder constructor. * - * @param ElementFactory $elementFactory - * @param BooleanUtils $booleanUtils - * @param Sharding $sharding - * @param ValidationComposite $validationComposite - * @param \Magento\Framework\App\ResourceConnection $resourceConnection + * @param ElementFactory $elementFactory + * @param BooleanUtils $booleanUtils + * @param Sharding $sharding + * @param ValidationComposite $validationComposite + * @param ResourceConnection $resourceConnection * @param ElementNameResolver $elementNameResolver */ public function __construct( @@ -88,7 +90,7 @@ public function __construct( BooleanUtils $booleanUtils, Sharding $sharding, ValidationComposite $validationComposite, - \Magento\Framework\App\ResourceConnection $resourceConnection, + ResourceConnection $resourceConnection, ElementNameResolver $elementNameResolver ) { $this->sharding = $sharding; @@ -116,8 +118,8 @@ public function addTablesData(array $tablesData) /** * Do schema validation and print all errors. * - * @param Schema $schema - * @throws Exception + * @param Schema $schema + * @throws LocalizedException */ private function validate(Schema $schema) { @@ -129,16 +131,16 @@ private function validate(Schema $schema) $messages .= sprintf("%s%s", PHP_EOL, $error['message']); } - throw new Exception(new Phrase($messages)); + throw new LocalizedException(new Phrase($messages)); } } /** * Build schema. * - * @param Schema $schema - * @throws Exception + * @param Schema $schema * @return Schema + * @throws ValidationException */ public function build(Schema $schema): Schema { @@ -184,10 +186,10 @@ private function isDisabled(array $structuralElementData): bool * * If column was renamed new key will be associated to it. * - * @param array $tableData - * @param string $resource - * @param Table $table - * @return array + * @param array $tableData + * @param string $resource + * @param Table $table + * @return array */ private function processColumns(array $tableData, string $resource, Table $table): array { @@ -209,10 +211,10 @@ private function processColumns(array $tableData, string $resource, Table $table /** * Process generic data that is support by all 3 child types: columns, constraints, indexes. * - * @param array $elementData - * @param string $resource - * @param Table $table - * @return array + * @param array $elementData + * @param string $resource + * @param Table $table + * @return array */ private function processGenericData(array $elementData, string $resource, Table $table): array { @@ -327,11 +329,11 @@ private function processIndexes(array $tableData, string $resource, Table $table /** * Convert and instantiate constraint objects. * - * @param array $tableData - * @param string $resource - * @param Schema $schema - * @param Table $table - * @return Constraint[] + * @param array $tableData + * @param string $resource + * @param Schema $schema + * @param Table $table + * @return Constraint[] */ private function processConstraints(array $tableData, string $resource, Schema $schema, Table $table): array { diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Integer.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Integer.php index 5c0c89dd0b4b8..401c2ad7c4f78 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Integer.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Columns/Integer.php @@ -64,7 +64,7 @@ public function __construct( string $name, string $type, Table $table, - int $padding, + int $padding = null, bool $nullable = true, bool $unsigned = false, bool $identity = false, @@ -83,7 +83,7 @@ public function __construct( /** * Column padding. * - * @return int + * @return int | null */ public function getPadding() { @@ -102,6 +102,7 @@ public function isNullable() /** * Return default value. + * * Note: default value should be int. * * @return int | null diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php index b35e2c9864e83..496897901bb28 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php @@ -6,6 +6,8 @@ namespace Magento\Framework\Setup\Declaration\Schema\Dto\Factories; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\DB\Adapter\SqlVersionProvider; use Magento\Framework\ObjectManagerInterface; /** @@ -21,7 +23,7 @@ class Integer implements FactoryInterface private static $defaultPadding = [ 'int' => '11', 'tinyint' => '2', - 'smallint' => '5', + 'smallint' => '6', 'bigint' => '20' ]; @@ -35,18 +37,26 @@ class Integer implements FactoryInterface */ private $className; + /** + * @var SqlVersionProvider + */ + private $sqlVersionProvider; + /** * Constructor. * - * @param ObjectManagerInterface $objectManager - * @param string $className + * @param ObjectManagerInterface $objectManager + * @param string $className + * @param SqlVersionProvider|null $sqlVersionProvider */ public function __construct( ObjectManagerInterface $objectManager, - $className = \Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Integer::class + $className = \Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Integer::class, + SqlVersionProvider $sqlVersionProvider = null ) { $this->objectManager = $objectManager; $this->className = $className; + $this->sqlVersionProvider = $sqlVersionProvider ?: $objectManager->get(SqlVersionProvider::class); } /** @@ -54,9 +64,13 @@ public function __construct( */ public function create(array $data) { - if (!isset($data['padding'])) { + if (isset($data['padding'])) { + unset($data['padding']); + } + if ($this->sqlVersionProvider->getSqlVersion() !== SqlVersionProvider::MYSQL_8_VERSION) { $data['padding'] = self::$defaultPadding[$data['type']]; } + //Auto increment field can`t be null if (isset($data['identity']) && $data['identity']) { $data['nullable'] = false; diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/types/integers/integer.xsd b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/types/integers/integer.xsd index ff68beb27191d..037cd8e086862 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/types/integers/integer.xsd +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/types/integers/integer.xsd @@ -27,8 +27,8 @@ - We can use padding only from 2, because padding 1 used for boolean type. - And we need to distinguish boolean and integer + This attribute is deprecated and the value is ignored. + See https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-19.html. diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/MySQL/Definition/Columns/StringBinaryTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/MySQL/Definition/Columns/StringBinaryTest.php index 16200f600bf4b..202aeae58e903 100644 --- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/MySQL/Definition/Columns/StringBinaryTest.php +++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/MySQL/Definition/Columns/StringBinaryTest.php @@ -113,6 +113,24 @@ public function testToDefinition() ); } + /** + * @param array $definition + * @param bool $expectedLength + * @dataProvider definitionDataProvider() + */ + public function testGetBinaryDefaultValueFromDefinition($definition) + { + $defaultValue = 'test'; + if (preg_match('/^(binary|varbinary)/', $definition)) { + $default = '0x' . bin2hex($defaultValue); + } else { + $default = $defaultValue; + } + + $result = $this->stringBinary->fromDefinition(['definition' => $definition, 'default' => $default]); + $this->assertEquals($result['default'], $defaultValue); + } + /** * Test from definition conversion. * diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php index 508d3786652b5..f7b893c8d06e2 100644 --- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php +++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php @@ -8,6 +8,8 @@ namespace Magento\Framework\Setup\Test\Unit\Declaration\Schema\Db; use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\SqlVersionProvider; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Framework\Setup\Declaration\Schema\Db\DbSchemaReaderInterface; use Magento\Framework\Setup\Declaration\Schema\Db\SchemaBuilder; use Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Integer; @@ -19,7 +21,6 @@ use Magento\Framework\Setup\Declaration\Schema\Dto\Schema; use Magento\Framework\Setup\Declaration\Schema\Dto\Table; use Magento\Framework\Setup\Declaration\Schema\Sharding; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use PHPUnit\Framework\Exception; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; @@ -27,7 +28,6 @@ /** * Test for SchemaBuilder. * - * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class SchemaBuilderTest extends TestCase @@ -57,6 +57,11 @@ class SchemaBuilderTest extends TestCase */ private $shardingMock; + /** + * @var \PHPUnit\Framework\MockObject\MockObject|\Magento\Framework\DB\Adapter\SqlVersionProvider + */ + private $sqlVersionProvider; + protected function setUp(): void { $this->elementFactoryMock = $this->getMockBuilder(ElementFactory::class) @@ -67,6 +72,9 @@ protected function setUp(): void $this->shardingMock = $this->getMockBuilder(Sharding::class) ->disableOriginalConstructor() ->getMock(); + $this->sqlVersionProvider = $this->getMockBuilder(SqlVersionProvider::class) + ->disableOriginalConstructor() + ->getMock(); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->model = $this->objectManagerHelper->getObject( @@ -74,7 +82,8 @@ protected function setUp(): void [ 'elementFactory' => $this->elementFactoryMock, 'dbSchemaReader' => $this->dbSchemaReaderMock, - 'sharding' => $this->shardingMock + 'sharding' => $this->shardingMock, + 'getDbVersion' => $this->sqlVersionProvider ] ); } @@ -105,8 +114,7 @@ public function dataProvider() 'second_column' => [ 'name' => 'second_column', 'type' => 'timestamp', - 'default' => 'CURRENT_TIMESTAMP', - 'on_update' => true + 'default' => 'CURRENT_TIMESTAMP' ], ], 'second_table' => [ @@ -408,7 +416,7 @@ private function prepareSchemaMocks(array $columns, array $references, array $co 'table' => $table, 'padding' => 10, 'identity' => true, - 'nullable' => false, + 'nullable' => false ] ], [ @@ -418,7 +426,7 @@ private function prepareSchemaMocks(array $columns, array $references, array $co 'type' => 'int', 'table' => $table, 'padding' => 10, - 'nullable' => false, + 'nullable' => false ] ], [ @@ -427,8 +435,7 @@ private function prepareSchemaMocks(array $columns, array $references, array $co 'name' => 'second_column', 'type' => 'timestamp', 'table' => $table, - 'default' => 'CURRENT_TIMESTAMP', - 'on_update' => true, + 'default' => 'CURRENT_TIMESTAMP' ] ], [ @@ -460,7 +467,7 @@ private function prepareSchemaMocks(array $columns, array $references, array $co 'type' => 'int', 'table' => $refTable, 'padding' => 10, - 'nullable' => false, + 'nullable' => false ] ], [ diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php index 2f6ec097913dd..28cb8e58fcc43 100644 --- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php +++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php @@ -8,6 +8,10 @@ namespace Magento\Framework\Setup\Test\Unit\Declaration\Schema\Declaration; use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\SqlVersionProvider; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Stdlib\BooleanUtils; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Framework\Setup\Declaration\Schema\Declaration\SchemaBuilder; use Magento\Framework\Setup\Declaration\Schema\Declaration\ValidationComposite; use Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Integer; @@ -19,16 +23,12 @@ use Magento\Framework\Setup\Declaration\Schema\Dto\Schema; use Magento\Framework\Setup\Declaration\Schema\Dto\Table; use Magento\Framework\Setup\Declaration\Schema\Sharding; -use Magento\Framework\Setup\Exception; -use Magento\Framework\Stdlib\BooleanUtils; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; /** * Test for SchemaBuilder. * - * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class SchemaBuilderTest extends TestCase @@ -68,6 +68,11 @@ class SchemaBuilderTest extends TestCase */ private $resourceConnectionMock; + /** + * @var SqlVersionProvider|\PHPUnit\Framework\MockObject\MockObject + */ + private $sqlVersionProvider; + protected function setUp(): void { $this->elementFactoryMock = $this->getMockBuilder(ElementFactory::class) @@ -85,6 +90,9 @@ protected function setUp(): void $this->resourceConnectionMock = $this->getMockBuilder(ResourceConnection::class) ->disableOriginalConstructor() ->getMock(); + $this->sqlVersionProvider = $this->getMockBuilder(SqlVersionProvider::class) + ->disableOriginalConstructor() + ->getMock(); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->model = $this->objectManagerHelper->getObject( @@ -94,7 +102,8 @@ protected function setUp(): void 'booleanUtils' => new BooleanUtils(), 'sharding' => $this->shardingMock, 'validationComposite' => $this->validationCompositeMock, - 'resourceConnection' => $this->resourceConnectionMock + 'resourceConnection' => $this->resourceConnectionMock, + 'sqlVersionProvider' => $this->sqlVersionProvider ] ); } @@ -302,7 +311,7 @@ private function createTimestampColumn($name, Table $table) * @dataProvider tablesProvider * @param array $tablesData * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - * @throws Exception + * @throws LocalizedException */ public function testBuild(array $tablesData) { diff --git a/lib/internal/Magento/Framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php b/lib/internal/Magento/Framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php new file mode 100644 index 0000000000000..572403a610034 --- /dev/null +++ b/lib/internal/Magento/Framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php @@ -0,0 +1,159 @@ + '^8\.0\.', + 'MySQL-5.7' => '^5\.7\.', + 'MariaDB-(10.2-10.4)' => '^10\.[2-4]\.' + ]; + + /** + * @return void + */ + protected function setUp(): void + { + $this->objectManager = new ObjectManager($this); + $this->resourceConnection = $this->getMockBuilder(ResourceConnection::class) + ->setMethods(['getConnection']) + ->disableOriginalConstructor() + ->getMock(); + $this->mysqlAdapter = $this->getMockBuilder(Mysql::class) + ->setMethods(['fetchPairs']) + ->disableOriginalConstructor() + ->getMock(); + $this->resourceConnection->expects($this->atLeastOnce()) + ->method('getConnection') + ->willReturn($this->mysqlAdapter); + } + + /** + * @dataProvider executeDataProvider + * + * @param array $versionVariableValue + * @param string $expectedResult + * + * @return void + * @throws ConnectionException + */ + public function testGetSqlVersionProviderReturnsRightResponse( + array $versionVariableValue, + string $expectedResult + ): void { + $this->prepareSqlProviderAndMySQLAdapter($versionVariableValue); + $this->assertEquals($expectedResult, $this->sqlVersionProvider->getSqlVersion()); + } + + /** + * @return void + */ + public function testSqlVersionProviderThrowsExceptionWhenNonSupportedEngineUsed(): void + { + $this->prepareSqlProviderAndMySQLAdapter(['version' => '10.5.0-MariaDB-1:10.5.0+maria~bionic']); + $this->expectExceptionMessage('Current version of RDBMS is not supported.'); + $this->expectException(ConnectionException::class); + $this->sqlVersionProvider->getSqlVersion(); + } + + /** + * @return array + */ + public function executeDataProvider(): array + { + return [ + 'MariaDB-10.4' => [ + ['version' => '10.4.12-MariaDB-1:10.4.12+maria~bionic'], + '10.4.' + ], + 'MariaDB-10.2' => [ + ['version' => '10.2.31-MariaDB-1:10.2.31+maria~bionic'], + '10.2.' + ], + 'MySQL-5.7' => [ + ['version' => '5.7.29'], + SqlVersionProvider::MYSQL_57_VERSION, + ], + 'MySQL-8' => [ + ['version' => '8.0.19'], + SqlVersionProvider::MYSQL_8_VERSION, + ], + 'Percona' => [ + ['version' => '5.7.29-32'], + SqlVersionProvider::MYSQL_57_VERSION, + ], + ]; + } + + /** + * @param array $versionVariableValue + * + * @return void + */ + private function prepareSqlProviderAndMySQLAdapter(array $versionVariableValue): void + { + $this->mysqlAdapter->expects($this->atLeastOnce()) + ->method('fetchPairs') + ->willReturn($versionVariableValue); + $this->sqlVersionProvider = $this->objectManager->getObject( + SqlVersionProvider::class, + [ + 'resourceConnection' => $this->resourceConnection, + 'supportedVersionPatterns' => $this->supportedVersionPatterns + ] + ); + } + + /** + * @return void + */ + protected function tearDown(): void + { + unset($this->sqlVersionProvider); + unset($this->mysqlAdapter); + } +} diff --git a/lib/internal/Magento/Framework/TestFramework/Unit/Block/Adminhtml.php b/lib/internal/Magento/Framework/TestFramework/Unit/Block/Adminhtml.php index 0ad3916156231..f8bb912ea6c85 100644 --- a/lib/internal/Magento/Framework/TestFramework/Unit/Block/Adminhtml.php +++ b/lib/internal/Magento/Framework/TestFramework/Unit/Block/Adminhtml.php @@ -109,7 +109,7 @@ class Adminhtml extends \PHPUnit\Framework\TestCase /** */ - protected function setUp() + protected function setUp(): void { // These mocks are accessed via context $this->_designMock = $this->_makeMock(\Magento\Framework\View\DesignInterface::class); diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index dfc81189bf544..d520c438c8ba1 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -34,7 +34,7 @@ "laminas/laminas-stdlib": "^3.2.1", "laminas/laminas-uri": "^2.5.1", "laminas/laminas-validator": "^2.6.0", - "magento/zendframework1": "~1.14.2", + "magento/zendframework1": "MC-14884-Discribe-Table-doesnt-return-column-type-width-dev", "monolog/monolog": "^1.17", "ramsey/uuid": "~3.8.0", "symfony/console": "~4.4.0", @@ -59,5 +59,11 @@ "files": [ "registration.php" ] - } + }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/magento-techdivision/zf1.git" + } + ] } diff --git a/setup/src/Magento/Setup/Fixtures/WebsiteCategoryProvider.php b/setup/src/Magento/Setup/Fixtures/WebsiteCategoryProvider.php index 42370639839c6..673b8156b8453 100644 --- a/setup/src/Magento/Setup/Fixtures/WebsiteCategoryProvider.php +++ b/setup/src/Magento/Setup/Fixtures/WebsiteCategoryProvider.php @@ -3,10 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Setup\Fixtures; use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\AdapterInterface; /** * Website and category provider @@ -29,7 +31,7 @@ class WebsiteCategoryProvider private $resourceConnection; /** - * @var \Magento\Framework\DB\Adapter\AdapterInterface + * @var AdapterInterface */ private $connection; @@ -93,6 +95,8 @@ public function getCategoryId($productIndex) } /** + * Get categories and websites + * * @return array */ private function getCategoriesAndWebsites() @@ -106,7 +110,7 @@ private function getCategoriesAndWebsites() ['sg' => $this->resourceConnection->getTableName('store_group')], "c.path like concat('1/', sg.root_category_id, '/%')", ['website' => 'website_id'] - ); + )->order('category ASC'); $this->categoriesPerWebsite = $this->getConnection()->fetchAll($select); } @@ -114,6 +118,8 @@ private function getCategoriesAndWebsites() } /** + * Checks is assign_entities_to_all_websites flag set + * * @return bool */ private function isAssignToAllWebsites() @@ -122,6 +128,8 @@ private function isAssignToAllWebsites() } /** + * Provides all websites + * * @return array */ private function getAllWebsites() @@ -134,6 +142,8 @@ private function getAllWebsites() } /** + * Provides all categories + * * @return array */ private function getAllCategories() @@ -146,7 +156,9 @@ private function getAllCategories() } /** - * @return \Magento\Framework\DB\Adapter\AdapterInterface + * Provides connection + * + * @return AdapterInterface */ private function getConnection() { From 9f7cf85595048de2f6e102e6b51c0f0ff0ad4c6d Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Mon, 18 May 2020 16:54:21 -0500 Subject: [PATCH 02/17] MC-14884: MySQL Upgrade - v8 - fix MFTF tests --- .../ActionGroup/AdminProductAttributeMassUpdateActionGroup.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeMassUpdateActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeMassUpdateActionGroup.xml index d20b44b0162f0..e4fc000deb9c7 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeMassUpdateActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeMassUpdateActionGroup.xml @@ -20,6 +20,7 @@ + From 054d374921de5346d38cd60a1b2082d6fb6ad1a2 Mon Sep 17 00:00:00 2001 From: Max Lesechko Date: Mon, 18 May 2020 22:26:26 -0500 Subject: [PATCH 03/17] MC-14884: MySQL Upgrade - v8 --- .../column_modification.php | 8 +-- .../declarative_installer/column_removal.php | 6 +- .../constraint_modification.mariadb10.php | 23 +++--- .../constraint_modification.php | 20 +++--- .../declarative_installer/installation.php | 8 +-- .../table_removal.mariadb10.php | 4 +- .../declarative_installer/table_removal.php | 4 +- .../fixture/dry_run_log.mariadb10.php | 56 +++++++++++++++ .../fixture/dry_run_log.php | 72 +++++++++---------- .../dry_run_log_on_upgrade.mariadb10.php | 13 ++++ .../fixture/dry_run_log_on_upgrade.php | 6 +- .../disabling_tables.mariadb10.php | 4 +- .../disabling_tables.php | 4 +- .../Magento/Setup/DiffOldSchemaTest.php | 19 +---- .../testsuite/Magento/Setup/DryRunTest.php | 4 +- .../Schema/Dto/Factories/Integer.php | 25 +------ 16 files changed, 153 insertions(+), 123 deletions(-) create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mariadb10.php create mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log_on_upgrade.mariadb10.php diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/column_modification.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/column_modification.php index f2a34c338edc2..8ca84c1638dc0 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/column_modification.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/column_modification.php @@ -5,13 +5,13 @@ */ return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(15) unsigned DEFAULT NULL, - `int_disabled_auto_increment` smallint(12) unsigned DEFAULT \'0\', + `int_auto_increment_with_nullable` int(10) unsigned DEFAULT NULL, + `int_disabled_auto_increment` smallint(5) unsigned DEFAULT \'0\', UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'reference_table' => 'CREATE TABLE `reference_table` ( `tinyint_ref` tinyint(7) NOT NULL AUTO_INCREMENT, - `tinyint_without_padding` tinyint(2) NOT NULL, + `tinyint_without_padding` tinyint(4) NOT NULL, `bigint_without_padding` bigint(20) NOT NULL DEFAULT \'0\', `smallint_without_padding` smallint(5) NOT NULL DEFAULT \'0\', `integer_without_padding` int(11) NOT NULL DEFAULT \'0\', @@ -42,7 +42,7 @@ `boolean` tinyint(1) DEFAULT \'1\', UNIQUE KEY `TEST_TABLE_SMALLINT_BIGINT` (`smallint`,`bigint`), KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`), - CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) + CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8', ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/column_removal.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/column_removal.php index 0091b89845a73..8fcdf5db7d43f 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/column_removal.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/column_removal.php @@ -5,12 +5,12 @@ */ return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(12) unsigned NOT NULL AUTO_INCREMENT, + `int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT, UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'reference_table' => 'CREATE TABLE `reference_table` ( `tinyint_ref` tinyint(7) NOT NULL AUTO_INCREMENT, - `tinyint_without_padding` tinyint(2) NOT NULL DEFAULT \'0\', + `tinyint_without_padding` tinyint(4) NOT NULL DEFAULT \'0\', `bigint_without_padding` bigint(20) NOT NULL DEFAULT \'0\', `integer_without_padding` int(11) NOT NULL DEFAULT \'0\', `smallint_with_big_padding` smallint(254) NOT NULL DEFAULT \'0\', @@ -39,7 +39,7 @@ `varbinary_rename` varbinary(255) DEFAULT \'10101\', UNIQUE KEY `TEST_TABLE_SMALLINT_BIGINT` (`smallint`,`bigint`), KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`), - CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) + CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8', ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mariadb10.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mariadb10.php index 42741b80efac7..f7a4b7caef6a8 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mariadb10.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.mariadb10.php @@ -6,20 +6,20 @@ // @codingStandardsIgnoreFile return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(6) unsigned DEFAULT 0, + `int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(5) unsigned DEFAULT 0, UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'reference_table' => 'CREATE TABLE `reference_table` ( - `tinyint_ref` tinyint(2) NOT NULL AUTO_INCREMENT, - `tinyint_without_padding` tinyint(2) NOT NULL DEFAULT 0, + `tinyint_ref` tinyint(4) NOT NULL AUTO_INCREMENT, + `tinyint_without_padding` tinyint(4) NOT NULL DEFAULT 0, `bigint_without_padding` bigint(20) NOT NULL DEFAULT 0, `smallint_without_padding` smallint(6) NOT NULL DEFAULT 0, `integer_without_padding` int(11) NOT NULL DEFAULT 0, `smallint_with_big_padding` smallint(6) NOT NULL DEFAULT 0, `smallint_without_default` smallint(6) DEFAULT NULL, `int_without_unsigned` int(11) DEFAULT NULL, - `int_unsigned` int(11) unsigned DEFAULT NULL, + `int_unsigned` int(10) unsigned DEFAULT NULL, `bigint_default_nullable` bigint(20) unsigned DEFAULT 1, `bigint_not_default_not_nullable` bigint(20) unsigned NOT NULL, `smallint_ref` smallint(6) NOT NULL DEFAULT 0, @@ -28,7 +28,7 @@ ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'test_table' => 'CREATE TABLE `test_table` ( `smallint` smallint(6) DEFAULT NULL, - `tinyint` tinyint(2) DEFAULT NULL, + `tinyint` tinyint(4) DEFAULT NULL, `bigint` bigint(20) DEFAULT 0, `float` float(12,10) DEFAULT 0.0000000000, `double` double(245,10) DEFAULT 11111111.1111110000, @@ -43,18 +43,15 @@ `mediumblob` mediumblob DEFAULT NULL, `blob` blob DEFAULT NULL, `boolean` tinyint(1) DEFAULT NULL, - `integer_main` int(11) unsigned DEFAULT NULL, + `integer_main` int(10) unsigned DEFAULT NULL, `smallint_main` smallint(6) NOT NULL DEFAULT 0, UNIQUE KEY `TEST_TABLE_SMALLINT_FLOAT` (`smallint`,`float`), UNIQUE KEY `TEST_TABLE_DOUBLE` (`double`), KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`), KEY `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` (`smallint_main`), KEY `FK_FB77604C299EB8612D01E4AF8D9931F2` (`integer_main`), - CONSTRAINT `FK_FB77604C299EB8612D01E4AF8D9931F2` FOREIGN KEY (`integer_main`) -REFERENCES `auto_increment_test` (`int_auto_increment_with_nullable`) ON DELETE CASCADE, - CONSTRAINT `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` FOREIGN KEY (`smallint_main`) -REFERENCES `reference_table` (`smallint_ref`) ON DELETE CASCADE, - CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) -REFERENCES `reference_table` (`tinyint_ref`) ON DELETE SET NULL + CONSTRAINT `FK_FB77604C299EB8612D01E4AF8D9931F2` FOREIGN KEY (`integer_main`) REFERENCES `auto_increment_test` (`int_auto_increment_with_nullable`) ON DELETE CASCADE, + CONSTRAINT `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` FOREIGN KEY (`smallint_main`) REFERENCES `reference_table` (`smallint_ref`) ON DELETE CASCADE, + CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8', ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php index 231566daf14af..6591b320f63fe 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php @@ -6,20 +6,20 @@ // @codingStandardsIgnoreFile return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(6) unsigned DEFAULT \'0\', + `int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(5) unsigned DEFAULT \'0\', UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'reference_table' => 'CREATE TABLE `reference_table` ( - `tinyint_ref` tinyint(2) NOT NULL AUTO_INCREMENT, - `tinyint_without_padding` tinyint(2) NOT NULL DEFAULT \'0\', + `tinyint_ref` tinyint(4) NOT NULL AUTO_INCREMENT, + `tinyint_without_padding` tinyint(4) NOT NULL DEFAULT \'0\', `bigint_without_padding` bigint(20) NOT NULL DEFAULT \'0\', `smallint_without_padding` smallint(6) NOT NULL DEFAULT \'0\', `integer_without_padding` int(11) NOT NULL DEFAULT \'0\', `smallint_with_big_padding` smallint(6) NOT NULL DEFAULT \'0\', `smallint_without_default` smallint(6) DEFAULT NULL, `int_without_unsigned` int(11) DEFAULT NULL, - `int_unsigned` int(11) unsigned DEFAULT NULL, + `int_unsigned` int(10) unsigned DEFAULT NULL, `bigint_default_nullable` bigint(20) unsigned DEFAULT \'1\', `bigint_not_default_not_nullable` bigint(20) unsigned NOT NULL, `smallint_ref` smallint(6) NOT NULL DEFAULT \'0\', @@ -28,7 +28,7 @@ ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'test_table' => 'CREATE TABLE `test_table` ( `smallint` smallint(6) DEFAULT NULL, - `tinyint` tinyint(2) DEFAULT NULL, + `tinyint` tinyint(4) DEFAULT NULL, `bigint` bigint(20) DEFAULT \'0\', `float` float(12,10) DEFAULT \'0.0000000000\', `double` double(245,10) DEFAULT \'11111111.1111110000\', @@ -43,18 +43,18 @@ `mediumblob` mediumblob, `blob` blob, `boolean` tinyint(1) DEFAULT NULL, - `integer_main` int(11) unsigned DEFAULT NULL, + `integer_main` int(10) unsigned DEFAULT NULL, `smallint_main` smallint(6) NOT NULL DEFAULT \'0\', UNIQUE KEY `TEST_TABLE_SMALLINT_FLOAT` (`smallint`,`float`), UNIQUE KEY `TEST_TABLE_DOUBLE` (`double`), KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`), KEY `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` (`smallint_main`), KEY `FK_FB77604C299EB8612D01E4AF8D9931F2` (`integer_main`), - CONSTRAINT `FK_FB77604C299EB8612D01E4AF8D9931F2` FOREIGN KEY (`integer_main`) + CONSTRAINT `FK_FB77604C299EB8612D01E4AF8D9931F2` FOREIGN KEY (`integer_main`) REFERENCES `auto_increment_test` (`int_auto_increment_with_nullable`) ON DELETE CASCADE, - CONSTRAINT `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` FOREIGN KEY (`smallint_main`) + CONSTRAINT `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` FOREIGN KEY (`smallint_main`) REFERENCES `reference_table` (`smallint_ref`) ON DELETE CASCADE, - CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) + CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8', ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/installation.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/installation.php index 3e807c25e3519..7a285e8567996 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/installation.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/installation.php @@ -5,13 +5,13 @@ */ return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(12) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(12) unsigned DEFAULT \'0\', + `int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(10) unsigned DEFAULT \'0\', UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8', 'reference_table' => 'CREATE TABLE `reference_table` ( `tinyint_ref` tinyint(7) NOT NULL AUTO_INCREMENT, - `tinyint_without_padding` tinyint(2) NOT NULL DEFAULT \'0\', + `tinyint_without_padding` tinyint(4) NOT NULL DEFAULT \'0\', `bigint_without_padding` bigint(20) NOT NULL DEFAULT \'0\', `smallint_without_padding` smallint(5) NOT NULL DEFAULT \'0\', `integer_without_padding` int(11) NOT NULL DEFAULT \'0\', @@ -41,7 +41,7 @@ `boolean` tinyint(1) DEFAULT NULL, UNIQUE KEY `TEST_TABLE_SMALLINT_BIGINT` (`smallint`,`bigint`), KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`), - CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) + CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8', ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mariadb10.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mariadb10.php index 1f5a600ea8464..df7177284bd90 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mariadb10.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.mariadb10.php @@ -5,8 +5,8 @@ */ return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(6) unsigned DEFAULT 0, + `int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(5) unsigned DEFAULT 0, UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8' ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.php index b54533906f1af..224dda0d55dd3 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/table_removal.php @@ -5,8 +5,8 @@ */ return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(6) unsigned DEFAULT \'0\', + `int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(5) unsigned DEFAULT \'0\', UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8' ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mariadb10.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mariadb10.php new file mode 100644 index 0000000000000..0221d6b569491 --- /dev/null +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mariadb10.php @@ -0,0 +1,56 @@ + 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(6) unsigned DEFAULT 0, + `int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(5) unsigned DEFAULT 0, UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8' ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.php index 57763a671c9a1..8a0c4dc50df37 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule9/fixture/declarative_installer/disabling_tables.php @@ -7,8 +7,8 @@ return [ 'auto_increment_test' => 'CREATE TABLE `auto_increment_test` ( - `int_auto_increment_with_nullable` int(11) unsigned NOT NULL AUTO_INCREMENT, - `int_disabled_auto_increment` smallint(6) unsigned DEFAULT \'0\', + `int_auto_increment_with_nullable` int(10) unsigned NOT NULL AUTO_INCREMENT, + `int_disabled_auto_increment` smallint(5) unsigned DEFAULT \'0\', UNIQUE KEY `AUTO_INCREMENT_TEST_INT_AUTO_INCREMENT_WITH_NULLABLE` (`int_auto_increment_with_nullable`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8' ]; diff --git a/dev/tests/setup-integration/testsuite/Magento/Setup/DiffOldSchemaTest.php b/dev/tests/setup-integration/testsuite/Magento/Setup/DiffOldSchemaTest.php index 28b28eed1f9c4..329ad0dca556d 100644 --- a/dev/tests/setup-integration/testsuite/Magento/Setup/DiffOldSchemaTest.php +++ b/dev/tests/setup-integration/testsuite/Magento/Setup/DiffOldSchemaTest.php @@ -6,7 +6,6 @@ namespace Magento\Setup; -use Magento\Framework\DB\Adapter\SqlVersionProvider; use Magento\Framework\Setup\Declaration\Schema\Diff\DiffFactory; use Magento\Framework\Setup\Declaration\Schema\Diff\SchemaDiff; use Magento\Framework\Setup\Declaration\Schema\SchemaConfigInterface; @@ -157,7 +156,7 @@ private function getBigIntKeyDbSensitiveData() return [ 'type' => 'bigint', 'nullable' => true, - 'padding' => $this->getPaddingValue(), + 'padding' => null, 'unsigned' => false, 'identity' => false, 'default' => 0, @@ -173,25 +172,11 @@ private function getBigIntKeyXmlSensitiveData() return [ 'type' => 'bigint', 'nullable' => true, - 'padding' => $this->getPaddingValue(), + 'padding' => null, 'unsigned' => false, 'identity' => false, 'default' => 1, 'comment' => 'Bigint', ]; } - - /** - * Get padding regarding the database. - * - * @return int|null - */ - private function getPaddingValue() - { - if (strpos($this->getDatabaseVersion(), SqlVersionProvider::MYSQL_8_VERSION) !== false) { - return null; - } - - return 20; - } } diff --git a/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php b/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php index ca6882a7d7cda..191ba635a35b6 100644 --- a/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php +++ b/dev/tests/setup-integration/testsuite/Magento/Setup/DryRunTest.php @@ -47,7 +47,7 @@ public function testDryRunOnCleanDatabase() ); self::assertFileExists($logFileName); $data = file_get_contents($logFileName); - self::assertEquals($data, $this->getData()[0]); + self::assertEquals($this->getData()[0], $data); } /** @@ -67,6 +67,6 @@ public function testDryRunOnUpgrade() $this->cliCommad->upgrade(['dry-run' => true]); self::assertFileExists($logFileName); $data = file_get_contents($logFileName); - self::assertEquals($data, $this->getData()[0]); + self::assertEquals($this->getData()[0], $data); } } diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php index 496897901bb28..66192f3b760e2 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php @@ -6,7 +6,6 @@ namespace Magento\Framework\Setup\Declaration\Schema\Dto\Factories; -use Magento\Framework\App\ObjectManager; use Magento\Framework\DB\Adapter\SqlVersionProvider; use Magento\Framework\ObjectManagerInterface; @@ -15,18 +14,6 @@ */ class Integer implements FactoryInterface { - /** - * Describe default for different integer types. - * - * @var array - */ - private static $defaultPadding = [ - 'int' => '11', - 'tinyint' => '2', - 'smallint' => '6', - 'bigint' => '20' - ]; - /** * @var ObjectManagerInterface */ @@ -47,16 +34,13 @@ class Integer implements FactoryInterface * * @param ObjectManagerInterface $objectManager * @param string $className - * @param SqlVersionProvider|null $sqlVersionProvider */ public function __construct( ObjectManagerInterface $objectManager, - $className = \Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Integer::class, - SqlVersionProvider $sqlVersionProvider = null + $className = \Magento\Framework\Setup\Declaration\Schema\Dto\Columns\Integer::class ) { $this->objectManager = $objectManager; $this->className = $className; - $this->sqlVersionProvider = $sqlVersionProvider ?: $objectManager->get(SqlVersionProvider::class); } /** @@ -64,12 +48,7 @@ public function __construct( */ public function create(array $data) { - if (isset($data['padding'])) { - unset($data['padding']); - } - if ($this->sqlVersionProvider->getSqlVersion() !== SqlVersionProvider::MYSQL_8_VERSION) { - $data['padding'] = self::$defaultPadding[$data['type']]; - } + unset($data['padding']); //Auto increment field can`t be null if (isset($data['identity']) && $data['identity']) { From 894dcdd6376231590d9edb245a146f6920bcb6cb Mon Sep 17 00:00:00 2001 From: Max Lesechko Date: Mon, 18 May 2020 23:14:40 -0500 Subject: [PATCH 04/17] MC-14884: MySQL Upgrade - v8 --- .../constraint_modification.php | 9 +-- .../fixture/dry_run_log.mariadb10.php | 56 --------------- .../fixture/dry_run_log.mysql8.php | 56 --------------- .../fixture/dry_run_log.php | 72 +++++++++---------- .../dry_run_log_on_upgrade.mariadb10.php | 13 ---- .../fixture/dry_run_log_on_upgrade.mysql8.php | 13 ---- .../fixture/dry_run_log_on_upgrade.php | 6 +- 7 files changed, 42 insertions(+), 183 deletions(-) delete mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mariadb10.php delete mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mysql8.php delete mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log_on_upgrade.mariadb10.php delete mode 100644 dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log_on_upgrade.mysql8.php diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php index 6591b320f63fe..5794f0dcf2bfc 100644 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php +++ b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/declarative_installer/constraint_modification.php @@ -50,11 +50,8 @@ KEY `TEST_TABLE_TINYINT_BIGINT` (`tinyint`,`bigint`), KEY `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` (`smallint_main`), KEY `FK_FB77604C299EB8612D01E4AF8D9931F2` (`integer_main`), - CONSTRAINT `FK_FB77604C299EB8612D01E4AF8D9931F2` FOREIGN KEY (`integer_main`) -REFERENCES `auto_increment_test` (`int_auto_increment_with_nullable`) ON DELETE CASCADE, - CONSTRAINT `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` FOREIGN KEY (`smallint_main`) -REFERENCES `reference_table` (`smallint_ref`) ON DELETE CASCADE, - CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) -REFERENCES `reference_table` (`tinyint_ref`) ON DELETE SET NULL + CONSTRAINT `FK_FB77604C299EB8612D01E4AF8D9931F2` FOREIGN KEY (`integer_main`) REFERENCES `auto_increment_test` (`int_auto_increment_with_nullable`) ON DELETE CASCADE, + CONSTRAINT `TEST_TABLE_SMALLINT_MAIN_REFERENCE_TABLE_SMALLINT_REF` FOREIGN KEY (`smallint_main`) REFERENCES `reference_table` (`smallint_ref`) ON DELETE CASCADE, + CONSTRAINT `TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF` FOREIGN KEY (`tinyint`) REFERENCES `reference_table` (`tinyint_ref`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8', ]; diff --git a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mariadb10.php b/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mariadb10.php deleted file mode 100644 index 0221d6b569491..0000000000000 --- a/dev/tests/setup-integration/_files/Magento/TestSetupDeclarationModule1/fixture/dry_run_log.mariadb10.php +++ /dev/null @@ -1,56 +0,0 @@ - Date: Tue, 19 May 2020 08:22:43 +0200 Subject: [PATCH 05/17] MC-14884: Fix static tests --- .../Unit/Model/Import/Product/Validator/TierPriceTest.php | 5 +++-- .../Magento/Framework/View/LayoutTestWithExceptions.php | 2 +- .../Setup/Declaration/Schema/Dto/Factories/Integer.php | 7 +------ .../Framework/TestFramework/Unit/Block/Adminhtml.php | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/TierPriceTest.php b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/TierPriceTest.php index 80975dcb7d3e7..8a0e4bfb2e4fc 100644 --- a/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/TierPriceTest.php +++ b/app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Validator/TierPriceTest.php @@ -41,9 +41,10 @@ protected function setUp(): void $this->groupRepositoryInterface = $this->createMock( GroupRepository::class ); - $this->searchCriteriaSearch = $this->createMock(SearchCriteria::class); + $searchCriteriaSearch = $this->createMock(SearchCriteria::class); $this->searchCriteriaBuilder = $this->createMock(SearchCriteriaBuilder::class); - $this->searchCriteriaBuilder->expects($this->any())->method('create')->willReturn($this->searchCriteriaSearch); + $this->searchCriteriaBuilder->expects($this->any())->method('create') + ->willReturn($searchCriteriaSearch); $this->storeResolver = $this->createMock( StoreResolver::class ); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php index 40f7853535068..7bb71a3d8b6b3 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/LayoutTestWithExceptions.php @@ -14,7 +14,7 @@ class LayoutTestWithExceptions extends \PHPUnit\Framework\TestCase */ protected $layout; - protected function setUp(): void + protected function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $layoutFactory = $objectManager->get(\Magento\Framework\View\LayoutFactory::class); diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php index 66192f3b760e2..e2d43a33dd1f2 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Integer.php @@ -3,10 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Framework\Setup\Declaration\Schema\Dto\Factories; -use Magento\Framework\DB\Adapter\SqlVersionProvider; use Magento\Framework\ObjectManagerInterface; /** @@ -24,11 +24,6 @@ class Integer implements FactoryInterface */ private $className; - /** - * @var SqlVersionProvider - */ - private $sqlVersionProvider; - /** * Constructor. * diff --git a/lib/internal/Magento/Framework/TestFramework/Unit/Block/Adminhtml.php b/lib/internal/Magento/Framework/TestFramework/Unit/Block/Adminhtml.php index f8bb912ea6c85..0ad3916156231 100644 --- a/lib/internal/Magento/Framework/TestFramework/Unit/Block/Adminhtml.php +++ b/lib/internal/Magento/Framework/TestFramework/Unit/Block/Adminhtml.php @@ -109,7 +109,7 @@ class Adminhtml extends \PHPUnit\Framework\TestCase /** */ - protected function setUp(): void + protected function setUp() { // These mocks are accessed via context $this->_designMock = $this->_makeMock(\Magento\Framework\View\DesignInterface::class); From 9a69e0dd83044e2905bcc8c64a671532719e0e02 Mon Sep 17 00:00:00 2001 From: Harald Deiser Date: Tue, 19 May 2020 10:07:42 +0200 Subject: [PATCH 06/17] MC-14884: Changed test description --- .../testsuite/Magento/Review/_files/different_reviews.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php b/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php index 503a258717457..51b642a11c7d9 100644 --- a/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php +++ b/dev/tests/integration/testsuite/Magento/Review/_files/different_reviews.php @@ -30,8 +30,8 @@ )->save(); /* - * Added a sleep because otherwise it could be that the three reviews have the same created at timestamp. - * In this case some tests would (randomly) fail because the sort order depends on mysql and not on order by. + * Added a sleep because in a few tests the sql query orders by created at. Without the sleep the reviews + * have sometimes the same created at timestamp, that causes this tests randomly to fail. */ sleep(1); @@ -58,8 +58,8 @@ )->save(); /* - * Added a sleep because otherwise it could be that the three reviews have the same created at timestamp. - * In this case some tests could (randomly) fail because the sort order depends on mysql and not on order by. + * Added a sleep because in a few tests the sql query orders by created at. Without the sleep the reviews + * have sometimes the same created at timestamp, that causes this tests randomly to fail. */ sleep(1); From f55422955d947284f5748db7a9d5802fdb340b72 Mon Sep 17 00:00:00 2001 From: Harald Deiser Date: Wed, 20 May 2020 11:04:58 +0200 Subject: [PATCH 07/17] MC-14884: MySQL Upgrade - v8 --- .../Framework/DB/Adapter/Pdo/Mysql.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index f68540a98113e..7db91c06d9649 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -135,11 +135,11 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface protected $_isDdlCacheAllowed = true; /** - * MySQL version(MySQL-8, MySQL-5.7, MariaDB) + * Save if mysql engine is 8 or not. * - * @var string + * @var bool */ - private $dbVersion; + private $isMysql8Engine; /** * MySQL column - Table DDL type pairs @@ -1196,7 +1196,7 @@ public function showTableStatus($tableName, $schemaName = null) } $query = sprintf('SHOW TABLE STATUS%s LIKE %s', $fromDbName, $this->quote($tableName)); //checks which slq engine used - if (!preg_match('/^(8\.)/', $this->isMysql8EngineUsed())) { + if (!$this->isMysql8EngineUsed()) { //if it's not MySQl-8 we just fetch results return $this->rawFetchRow($query); } @@ -1209,17 +1209,18 @@ public function showTableStatus($tableName, $schemaName = null) } /** - * Get database version. + * Checks if the engine is mysql 8 * - * @return string + * @return bool */ - private function isMysql8EngineUsed(): string + private function isMysql8EngineUsed(): bool { - if (!$this->dbVersion) { - $this->dbVersion = $this->fetchPairs("SHOW variables LIKE 'version'")['version']; + if (!$this->isMysql8Engine) { + $version = $this->fetchPairs("SHOW variables LIKE 'version'")['version']; + $this->isMysql8Engine = (bool) preg_match('/^(8\.)/', $version); } - return $this->dbVersion; + return $this->isMysql8Engine; } /** From 3d5bf67a508fb77da6bc08806956d3bcf50d73a7 Mon Sep 17 00:00:00 2001 From: Harald Deiser Date: Wed, 20 May 2020 11:52:56 +0200 Subject: [PATCH 08/17] MC-14884: MySQL Upgrade - v8 Revert back custom ZF1 branch, because new version with needed changes has already released. --- composer.json | 9 +---- composer.lock | 37 +++++++++----------- lib/internal/Magento/Framework/composer.json | 10 ++---- 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/composer.json b/composer.json index 72a6e40e9af5f..bb70029021765 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,6 @@ "OSL-3.0", "AFL-3.0" ], - "minimum-stability": "dev", "config": { "preferred-install": "dist", "sort-packages": true @@ -68,7 +67,7 @@ "laminas/laminas-view": "~2.11.2", "magento/composer": "1.6.x-dev", "magento/magento-composer-installer": ">=0.1.11", - "magento/zendframework1": "MC-14884-Discribe-Table-doesnt-return-column-type-width-dev", + "magento/zendframework1": "~1.14.2", "monolog/monolog": "^1.17", "paragonie/sodium_compat": "^1.6", "pelago/emogrifier": "^3.1.0", @@ -357,11 +356,5 @@ "Magento\\PhpStan\\": "dev/tests/static/framework/Magento/PhpStan/" } }, - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/magento-techdivision/zf1.git" - } - ], "prefer-stable": true } diff --git a/composer.lock b/composer.lock index 4aa375eb7d46f..350a2f9c5a2ed 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "39f3780d89bff51360c667aa4d52ac1d", + "content-hash": "087f8432a6f317056b40a0b8a160a2cf", "packages": [ { "name": "braintree/braintree_php", @@ -3420,25 +3420,18 @@ }, { "name": "magento/zendframework1", - "version": "dev-MC-14884-Discribe-Table-doesnt-return-column-type-width", + "version": "1.14.3", "source": { "type": "git", - "url": "https://github.com/magento-techdivision/zf1.git", - "reference": "92c628e96cc3e3242d55be12a0f8535c413a8fa3" + "url": "https://github.com/magento/zf1.git", + "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento-techdivision/zf1/zipball/92c628e96cc3e3242d55be12a0f8535c413a8fa3", - "reference": "92c628e96cc3e3242d55be12a0f8535c413a8fa3", + "url": "https://api.github.com/repos/magento/zf1/zipball/726855dfb080089dc7bc7b016624129f8e7bc4e5", + "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5", "shasum": "" }, - "archive": { - "exclude": [ - "/demos", - "/documentation", - "/tests" - ] - }, "require": { "php": ">=5.2.11" }, @@ -3447,11 +3440,17 @@ "phpunit/phpunit": "3.7.*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.12.x-dev" + } + }, "autoload": { "psr-0": { "Zend_": "library/" } }, + "notification-url": "https://packagist.org/downloads/", "include-path": [ "library/" ], @@ -3461,13 +3460,10 @@ "description": "Magento Zend Framework 1", "homepage": "http://framework.zend.com/", "keywords": [ - "framework", - "zf1" + "ZF1", + "framework" ], - "support": { - "source": "https://github.com/magento-techdivision/zf1/tree/MC-14884-Discribe-Table-doesnt-return-column-type-width" - }, - "time": "2020-04-20T12:19:33+00:00" + "time": "2019-11-26T15:09:40+00:00" }, { "name": "monolog/monolog", @@ -10114,10 +10110,9 @@ } ], "aliases": [], - "minimum-stability": "dev", + "minimum-stability": "stable", "stability-flags": { "magento/composer": 20, - "magento/zendframework1": 20, "magento/magento2-functional-testing-framework": 20 }, "prefer-stable": true, diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index d520c438c8ba1..dfc81189bf544 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -34,7 +34,7 @@ "laminas/laminas-stdlib": "^3.2.1", "laminas/laminas-uri": "^2.5.1", "laminas/laminas-validator": "^2.6.0", - "magento/zendframework1": "MC-14884-Discribe-Table-doesnt-return-column-type-width-dev", + "magento/zendframework1": "~1.14.2", "monolog/monolog": "^1.17", "ramsey/uuid": "~3.8.0", "symfony/console": "~4.4.0", @@ -59,11 +59,5 @@ "files": [ "registration.php" ] - }, - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/magento-techdivision/zf1.git" - } - ] + } } From 20fc4cfab7c364369c11b5a8ac196af23149c92a Mon Sep 17 00:00:00 2001 From: Stepan Furman Date: Wed, 20 May 2020 14:46:43 +0200 Subject: [PATCH 09/17] MC-14884: MySQL Upgrade - v8 Rename SqlVrsionProvider constants and change some comments in doc blocks --- .../Annotation/DataProviderFromFile.php | 2 +- .../Framework/DB/Adapter/SqlVersionProvider.php | 14 +++++++------- .../Unit/DB/Adapter/SqlVersionProviderTest.php | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/DataProviderFromFile.php b/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/DataProviderFromFile.php index 691e3b6f66678..d34a5b2d40828 100644 --- a/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/DataProviderFromFile.php +++ b/dev/tests/setup-integration/framework/Magento/TestFramework/Annotation/DataProviderFromFile.php @@ -25,7 +25,7 @@ class DataProviderFromFile * @var array */ const POSSIBLE_SUFFIXES = [ - SqlVersionProvider::MYSQL_8_VERSION => 'mysql8', + SqlVersionProvider::MYSQL_8_0_VERSION => 'mysql8', SqlVersionProvider::MARIA_DB_10_VERSION => 'mariadb10', ]; diff --git a/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php b/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php index f81e25c620950..ab3effed821b4 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php +++ b/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php @@ -12,27 +12,27 @@ /** * Class GetDbVersion provides sql engine version requesting version variable * - * @deprecated Temporary solution which will be replaced after release of main functionality + * @deprecated First iteration of proper solution which is planning to implement soon */ class SqlVersionProvider { /** - * @deprecated Temporary solution which will be replaced after release of main functionality + * @deprecated First iteration of proper solution which is planning to implement soon */ - public const MYSQL_8_VERSION = '8.0.'; + public const MYSQL_8_0_VERSION = '8.0.'; /** - * @deprecated Temporary solution which will be replaced after release of main functionality + * @deprecated First iteration of proper solution which is planning to implement soon */ - public const MYSQL_57_VERSION = '5.7.'; + public const MYSQL_5_7_VERSION = '5.7.'; /** - * @deprecated Temporary solution which will be replaced after release of main functionality + * @deprecated First iteration of proper solution which is planning to implement soon */ public const MARIA_DB_10_VERSION = '10.'; /** - * @deprecated Temporary solution which will be replaced after release of main functionality + * @deprecated First iteration of proper solution which is planning to implement soon */ private const VERSION_VAR_NAME = 'version'; diff --git a/lib/internal/Magento/Framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php b/lib/internal/Magento/Framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php index 572403a610034..13fbf30c99de8 100644 --- a/lib/internal/Magento/Framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/DB/Adapter/SqlVersionProviderTest.php @@ -116,15 +116,15 @@ public function executeDataProvider(): array ], 'MySQL-5.7' => [ ['version' => '5.7.29'], - SqlVersionProvider::MYSQL_57_VERSION, + SqlVersionProvider::MYSQL_5_7_VERSION, ], 'MySQL-8' => [ ['version' => '8.0.19'], - SqlVersionProvider::MYSQL_8_VERSION, + SqlVersionProvider::MYSQL_8_0_VERSION, ], 'Percona' => [ ['version' => '5.7.29-32'], - SqlVersionProvider::MYSQL_57_VERSION, + SqlVersionProvider::MYSQL_5_7_VERSION, ], ]; } From 9ec0fb5b46af977e7ae5f7c9a43e1e4cdde0f368 Mon Sep 17 00:00:00 2001 From: Harald Deiser Date: Wed, 20 May 2020 19:45:30 +0200 Subject: [PATCH 10/17] MC-14884: MySQL Upgrade - v8 --- composer.lock | 166 +++++++++++++++++++++++++------------------------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/composer.lock b/composer.lock index 350a2f9c5a2ed..1e642911f979f 100644 --- a/composer.lock +++ b/composer.lock @@ -535,16 +535,16 @@ }, { "name": "elasticsearch/elasticsearch", - "version": "v7.6.1", + "version": "v7.7.0", "source": { "type": "git", "url": "https://github.com/elastic/elasticsearch-php.git", - "reference": "d4f24bc43c2af60aece3df20eb689d322f9c8acf" + "reference": "1d90a7ff4fb1936dc4376f09d723af75714f6f05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/d4f24bc43c2af60aece3df20eb689d322f9c8acf", - "reference": "d4f24bc43c2af60aece3df20eb689d322f9c8acf", + "url": "https://api.github.com/repos/elastic/elasticsearch-php/zipball/1d90a7ff4fb1936dc4376f09d723af75714f6f05", + "reference": "1d90a7ff4fb1936dc4376f09d723af75714f6f05", "shasum": "" }, "require": { @@ -594,7 +594,7 @@ "elasticsearch", "search" ], - "time": "2020-02-15T00:09:00+00:00" + "time": "2020-05-13T15:19:26+00:00" }, { "name": "ezimuel/guzzlestreams", @@ -1310,16 +1310,16 @@ }, { "name": "laminas/laminas-dependency-plugin", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/laminas/laminas-dependency-plugin.git", - "reference": "f269716dc584cd7b69e7f6e8ac1092d645ab56d5" + "reference": "38bf91861f5b4d49f9a1c530327c997f7a7fb2db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-dependency-plugin/zipball/f269716dc584cd7b69e7f6e8ac1092d645ab56d5", - "reference": "f269716dc584cd7b69e7f6e8ac1092d645ab56d5", + "url": "https://api.github.com/repos/laminas/laminas-dependency-plugin/zipball/38bf91861f5b4d49f9a1c530327c997f7a7fb2db", + "reference": "38bf91861f5b4d49f9a1c530327c997f7a7fb2db", "shasum": "" }, "require": { @@ -1352,7 +1352,7 @@ "BSD-3-Clause" ], "description": "Replace zendframework and zfcampus packages with their Laminas Project equivalents.", - "time": "2020-01-14T19:36:52+00:00" + "time": "2020-05-20T13:45:39+00:00" }, { "name": "laminas/laminas-di", @@ -3253,16 +3253,16 @@ }, { "name": "laminas/laminas-zendframework-bridge", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/laminas/laminas-zendframework-bridge.git", - "reference": "bfbbdb6c998d50dbf69d2187cb78a5f1fa36e1e9" + "reference": "fcd87520e4943d968557803919523772475e8ea3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/bfbbdb6c998d50dbf69d2187cb78a5f1fa36e1e9", - "reference": "bfbbdb6c998d50dbf69d2187cb78a5f1fa36e1e9", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/fcd87520e4943d968557803919523772475e8ea3", + "reference": "fcd87520e4943d968557803919523772475e8ea3", "shasum": "" }, "require": { @@ -3301,7 +3301,7 @@ "laminas", "zf" ], - "time": "2020-04-03T16:01:00+00:00" + "time": "2020-05-20T16:45:56+00:00" }, { "name": "magento/composer", @@ -3420,16 +3420,16 @@ }, { "name": "magento/zendframework1", - "version": "1.14.3", + "version": "1.14.4", "source": { "type": "git", "url": "https://github.com/magento/zf1.git", - "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5" + "reference": "250f35c0e80b5e6fa1a1598c144cba2fff36b565" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/zf1/zipball/726855dfb080089dc7bc7b016624129f8e7bc4e5", - "reference": "726855dfb080089dc7bc7b016624129f8e7bc4e5", + "url": "https://api.github.com/repos/magento/zf1/zipball/250f35c0e80b5e6fa1a1598c144cba2fff36b565", + "reference": "250f35c0e80b5e6fa1a1598c144cba2fff36b565", "shasum": "" }, "require": { @@ -3463,7 +3463,7 @@ "ZF1", "framework" ], - "time": "2019-11-26T15:09:40+00:00" + "time": "2020-05-19T23:25:07+00:00" }, { "name": "monolog/monolog", @@ -4228,23 +4228,23 @@ }, { "name": "react/promise", - "version": "v2.7.1", + "version": "v2.8.0", "source": { "type": "git", "url": "https://github.com/reactphp/promise.git", - "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d" + "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/31ffa96f8d2ed0341a57848cbb84d88b89dd664d", - "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d", + "url": "https://api.github.com/repos/reactphp/promise/zipball/f3cff96a19736714524ca0dd1d4130de73dbbbc4", + "reference": "f3cff96a19736714524ca0dd1d4130de73dbbbc4", "shasum": "" }, "require": { "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^7.0 || ^6.5 || ^5.7 || ^4.8.36" }, "type": "library", "autoload": { @@ -4270,7 +4270,7 @@ "promise", "promises" ], - "time": "2019-01-07T21:25:54+00:00" + "time": "2020-05-12T15:16:56+00:00" }, { "name": "seld/jsonlint", @@ -4723,16 +4723,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", - "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", "shasum": "" }, "require": { @@ -4744,7 +4744,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -4777,20 +4777,20 @@ "polyfill", "portable" ], - "time": "2020-02-27T09:26:54+00:00" + "time": "2020-05-12T16:14:59+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf" + "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf", - "reference": "47bd6aa45beb1cd7c6a16b7d1810133b728bdfcf", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/3bff59ea7047e925be6b7f2059d60af31bb46d6a", + "reference": "3bff59ea7047e925be6b7f2059d60af31bb46d6a", "shasum": "" }, "require": { @@ -4804,7 +4804,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -4839,20 +4839,20 @@ "portable", "shim" ], - "time": "2020-03-09T19:04:49+00:00" + "time": "2020-05-12T16:47:27+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" + "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", - "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", + "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", "shasum": "" }, "require": { @@ -4864,7 +4864,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -4898,20 +4898,20 @@ "portable", "shim" ], - "time": "2020-03-09T19:04:49+00:00" + "time": "2020-05-12T16:47:27+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "37b0976c78b94856543260ce09b460a7bc852747" + "reference": "f048e612a3905f34931127360bdd2def19a5e582" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/37b0976c78b94856543260ce09b460a7bc852747", - "reference": "37b0976c78b94856543260ce09b460a7bc852747", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/f048e612a3905f34931127360bdd2def19a5e582", + "reference": "f048e612a3905f34931127360bdd2def19a5e582", "shasum": "" }, "require": { @@ -4920,7 +4920,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -4953,20 +4953,20 @@ "portable", "shim" ], - "time": "2020-02-27T09:26:54+00:00" + "time": "2020-05-12T16:47:27+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7" + "reference": "a760d8964ff79ab9bf057613a5808284ec852ccc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", - "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/a760d8964ff79ab9bf057613a5808284ec852ccc", + "reference": "a760d8964ff79ab9bf057613a5808284ec852ccc", "shasum": "" }, "require": { @@ -4975,7 +4975,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -5011,7 +5011,7 @@ "portable", "shim" ], - "time": "2020-02-27T09:26:54+00:00" + "time": "2020-05-12T16:47:27+00:00" }, { "name": "symfony/process", @@ -5536,16 +5536,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.137.5", + "version": "3.138.4", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "b3309075ec2a2c695c33d8e21c07b3d5c10cdb9a" + "reference": "2294604d4edb967249c4e41ab775a72d6baa247a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b3309075ec2a2c695c33d8e21c07b3d5c10cdb9a", - "reference": "b3309075ec2a2c695c33d8e21c07b3d5c10cdb9a", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2294604d4edb967249c4e41ab775a72d6baa247a", + "reference": "2294604d4edb967249c4e41ab775a72d6baa247a", "shasum": "" }, "require": { @@ -5616,7 +5616,7 @@ "s3", "sdk" ], - "time": "2020-05-07T18:16:43+00:00" + "time": "2020-05-19T18:15:45+00:00" }, { "name": "behat/gherkin", @@ -6879,16 +6879,16 @@ }, { "name": "league/flysystem", - "version": "1.0.67", + "version": "1.0.69", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "5b1f36c75c4bdde981294c2a0ebdb437ee6f275e" + "reference": "7106f78428a344bc4f643c233a94e48795f10967" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/5b1f36c75c4bdde981294c2a0ebdb437ee6f275e", - "reference": "5b1f36c75c4bdde981294c2a0ebdb437ee6f275e", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/7106f78428a344bc4f643c233a94e48795f10967", + "reference": "7106f78428a344bc4f643c233a94e48795f10967", "shasum": "" }, "require": { @@ -6959,7 +6959,7 @@ "sftp", "storage" ], - "time": "2020-04-16T13:21:26+00:00" + "time": "2020-05-18T15:13:39+00:00" }, { "name": "lusitanian/oauth", @@ -8060,16 +8060,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.23", + "version": "0.12.25", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "71e529efced79e055fa8318b692e7f7d03ea4e75" + "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/71e529efced79e055fa8318b692e7f7d03ea4e75", - "reference": "71e529efced79e055fa8318b692e7f7d03ea4e75", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9619551d68b2d4c0d681a8df73f3c847c798ee64", + "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64", "shasum": "" }, "require": { @@ -8098,7 +8098,7 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2020-05-05T12:55:44+00:00" + "time": "2020-05-10T20:36:16+00:00" }, { "name": "phpunit/php-code-coverage", @@ -8750,16 +8750,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.0", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "c0c26c9188b538bfa985ae10c9f05d278f12060d" + "reference": "3e523c576f29dacecff309f35e4cc5a5c168e78a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c0c26c9188b538bfa985ae10c9f05d278f12060d", - "reference": "c0c26c9188b538bfa985ae10c9f05d278f12060d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3e523c576f29dacecff309f35e4cc5a5c168e78a", + "reference": "3e523c576f29dacecff309f35e4cc5a5c168e78a", "shasum": "" }, "require": { @@ -8767,7 +8767,7 @@ }, "require-dev": { "phpunit/phpunit": "^9.0", - "symfony/process": "^4 || ^5" + "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { @@ -8802,7 +8802,7 @@ "unidiff", "unified diff" ], - "time": "2020-02-07T06:09:38+00:00" + "time": "2020-05-08T05:01:12+00:00" }, { "name": "sebastian/environment", @@ -9715,16 +9715,16 @@ }, { "name": "symfony/polyfill-php70", - "version": "v1.15.0", + "version": "v1.17.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "2a18e37a489803559284416df58c71ccebe50bf0" + "reference": "82225c2d7d23d7e70515496d249c0152679b468e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/2a18e37a489803559284416df58c71ccebe50bf0", - "reference": "2a18e37a489803559284416df58c71ccebe50bf0", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/82225c2d7d23d7e70515496d249c0152679b468e", + "reference": "82225c2d7d23d7e70515496d249c0152679b468e", "shasum": "" }, "require": { @@ -9734,7 +9734,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.17-dev" } }, "autoload": { @@ -9770,7 +9770,7 @@ "portable", "shim" ], - "time": "2020-02-27T09:26:54+00:00" + "time": "2020-05-12T16:47:27+00:00" }, { "name": "symfony/stopwatch", From 56334f1a46af3d2ad6dc234611dececc27d24df2 Mon Sep 17 00:00:00 2001 From: Iryna Lagno Date: Wed, 20 May 2020 15:21:37 -0500 Subject: [PATCH 11/17] MC-14884: MySQL Upgrade - v8 - fix configuration for phpstan 0.12.25 --- .../testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon | 3 --- 1 file changed, 3 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon index f4f6ff87f8175..a4e09ab060627 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon @@ -33,6 +33,3 @@ services: class: Magento\PhpStan\Formatters\FilteredErrorFormatter arguments: showTipsOfTheDay: false - checkThisOnly: false - inferPrivatePropertyTypeFromConstructor: true - checkMissingTypehints: %checkMissingTypehints% From 039992f9192451b71489b8325f6b613c82ac31ea Mon Sep 17 00:00:00 2001 From: Harald Deiser Date: Wed, 20 May 2020 22:46:23 +0200 Subject: [PATCH 12/17] MC-14884: MySQL Upgrade - v8 - removed unnecessary code --- .../Schema/Db/MySQL/Definition/Columns/Integer.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php index c1c4446cf4ded..ab24c71f83ccc 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php @@ -87,13 +87,6 @@ public function toDefinition(ElementInterface $column) $column->getType() ); - if ($column->getPadding() !== null) { - $definition .= sprintf( - '(%s)', - $column->getPadding() - ); - } - return sprintf( '%s %s %s %s %s %s', $definition, From adc8191bd4e2758d7cd67dbb076d8e95a1a22432 Mon Sep 17 00:00:00 2001 From: Max Lesechko Date: Wed, 20 May 2020 16:57:05 -0500 Subject: [PATCH 13/17] MC-14884: MySQL Upgrade - v8 --- .../Db/MySQL/Definition/Columns/Integer.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php index ab24c71f83ccc..035af45c52b64 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php @@ -106,17 +106,16 @@ public function fromDefinition(array $data) { $matches = []; if (preg_match( - '/^(?big|small|tiny|medium)?int(\((?\d+)\))*/', + '/^(?(?:big|small|tiny|medium)?int)(?:\((?\d+)\))?/', $data['definition'], $matches )) { - /** - * match[1] - prefix - * match[2] - padding with beaked, like (5) or (11) - * match[3] - padding, like 5 or 11 - */ - if (count($matches) >= 4) { - //Use shortcut for mediuminteger + $data['padding'] = null; + // we have an agreement that tinyint(1) is Boolean + if (isset($matches['padding']) + && $matches['type'] === 'tinyint' + && $matches['padding'] === '1' + ) { $data['padding'] = $matches['padding']; } $data = $this->unsigned->fromDefinition($data); From 700de1106e26b03a47e974525bd00bc39f617f8b Mon Sep 17 00:00:00 2001 From: Max Lesechko Date: Wed, 20 May 2020 19:52:10 -0500 Subject: [PATCH 14/17] MC-14884: MySQL Upgrade - v8 --- composer.json | 2 +- composer.lock | 22 +++++++++---------- .../Test/Php/_files/phpstan/phpstan.neon | 3 +++ .../Db/MySQL/Definition/Columns/Integer.php | 1 - .../MySQL/Definition/Columns/IntegerTest.php | 12 +++++----- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/composer.json b/composer.json index bb70029021765..b0312feeea2ed 100644 --- a/composer.json +++ b/composer.json @@ -93,7 +93,7 @@ "pdepend/pdepend": "~2.7.1", "phpcompatibility/php-compatibility": "^9.3", "phpmd/phpmd": "^2.8.0", - "phpstan/phpstan": "^0.12.3", + "phpstan/phpstan": ">=0.12.3 <=0.12.23", "phpunit/phpunit": "^9", "sebastian/phpcpd": "~5.0.0", "squizlabs/php_codesniffer": "~3.5.4" diff --git a/composer.lock b/composer.lock index 1e642911f979f..c898b11630d0f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "087f8432a6f317056b40a0b8a160a2cf", + "content-hash": "ecf7fcac6c2cf92a2c1fa5fea6732b41", "packages": [ { "name": "braintree/braintree_php", @@ -5536,16 +5536,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.138.4", + "version": "3.138.5", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "2294604d4edb967249c4e41ab775a72d6baa247a" + "reference": "2c9ce7a12991e983e009ac9db453036000188ddd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2294604d4edb967249c4e41ab775a72d6baa247a", - "reference": "2294604d4edb967249c4e41ab775a72d6baa247a", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/2c9ce7a12991e983e009ac9db453036000188ddd", + "reference": "2c9ce7a12991e983e009ac9db453036000188ddd", "shasum": "" }, "require": { @@ -5616,7 +5616,7 @@ "s3", "sdk" ], - "time": "2020-05-19T18:15:45+00:00" + "time": "2020-05-20T18:12:57+00:00" }, { "name": "behat/gherkin", @@ -8060,16 +8060,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.25", + "version": "0.12.23", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64" + "reference": "71e529efced79e055fa8318b692e7f7d03ea4e75" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9619551d68b2d4c0d681a8df73f3c847c798ee64", - "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/71e529efced79e055fa8318b692e7f7d03ea4e75", + "reference": "71e529efced79e055fa8318b692e7f7d03ea4e75", "shasum": "" }, "require": { @@ -8098,7 +8098,7 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2020-05-10T20:36:16+00:00" + "time": "2020-05-05T12:55:44+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon index a4e09ab060627..722c048581089 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon @@ -33,3 +33,6 @@ services: class: Magento\PhpStan\Formatters\FilteredErrorFormatter arguments: showTipsOfTheDay: false + checkThisOnly: false + inferPrivatePropertyTypeFromConstructor: true + checkMissingTypehints: %checkMissingTypehints% diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php index 035af45c52b64..fcebb549a2e56 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Db/MySQL/Definition/Columns/Integer.php @@ -110,7 +110,6 @@ public function fromDefinition(array $data) $data['definition'], $matches )) { - $data['padding'] = null; // we have an agreement that tinyint(1) is Boolean if (isset($matches['padding']) && $matches['type'] === 'tinyint' diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/MySQL/Definition/Columns/IntegerTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/MySQL/Definition/Columns/IntegerTest.php index d9a3ce02b1177..d60f4cba56629 100644 --- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/MySQL/Definition/Columns/IntegerTest.php +++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/MySQL/Definition/Columns/IntegerTest.php @@ -145,7 +145,7 @@ public function testToDefinition() ->with($column) ->willReturn('COMMENT "Comment"'); $this->assertEquals( - '`int_column` int(10) UNSIGNED NOT NULL DEFAULT 0 AUTO_INCREMENT COMMENT "Comment"', + '`int_column` int UNSIGNED NOT NULL DEFAULT 0 AUTO_INCREMENT COMMENT "Comment"', $this->integer->toDefinition($column) ); } @@ -180,13 +180,15 @@ public function definitionDataProvider() { return [ ['int'], - ['int(10)', 10], + ['int(10)'], ['tinyint'], - ['mediumint(5)', 5], + ['tinyint(1)', 1], + ['tinyint(2)'], + ['mediumint(5)'], ['mediumint'], - ['smallint(3)', 3], + ['smallint(3)'], ['smallint'], - ['bigint(10)', 10], + ['bigint(10)'], ['bigint'], ]; } From 4e045c7c291658e4843aca93077d00791ed8b9ea Mon Sep 17 00:00:00 2001 From: Max Lesechko Date: Wed, 20 May 2020 22:44:25 -0500 Subject: [PATCH 15/17] MC-14884: MySQL Upgrade - v8 --- .../Magento/Test/Php/_files/phpstan/phpstan.neon | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon index 722c048581089..408da608225b9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/phpstan.neon @@ -29,10 +29,10 @@ parameters: - '#Method (?:.*?) should return (?:.*?)void(?:.*?) but return statement is missing.#' services: - errorFormatter.filtered: - class: Magento\PhpStan\Formatters\FilteredErrorFormatter - arguments: - showTipsOfTheDay: false - checkThisOnly: false + errorFormatter.filtered: + class: Magento\PhpStan\Formatters\FilteredErrorFormatter + arguments: + showTipsOfTheDay: false + checkThisOnly: false inferPrivatePropertyTypeFromConstructor: true checkMissingTypehints: %checkMissingTypehints% From 8a3f0c9dc266246be727748ac3786c005472fad2 Mon Sep 17 00:00:00 2001 From: Maksym Aposov Date: Thu, 21 May 2020 12:07:39 -0500 Subject: [PATCH 16/17] MC-14884: MySQL Upgrade - v8 --- .../Test/Php/_files/phpstan/blacklist/common.txt | 3 --- .../Framework/DB/Adapter/SqlVersionProvider.php | 16 ++++++---------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt index fd7650790ea4f..1bb13d553c754 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt @@ -18,6 +18,3 @@ dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTe dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php app/code/Magento/Developer/Test/Unit/Console/Command/DevTestsRunCommandTest.php app/code/Magento/OfflineShipping/Test/Unit/Model/ResourceModel/Carrier/Tablerate/CSV/ColumnResolverTest.php -app/code/Magento/Staging/Test/Unit/Model/Entity/Action/UpdateVersionTest.php -app/code/Magento/Staging/Test/Unit/Model/Operation/DeleteTest.php -app/code/Magento/Staging/Test/Unit/Model/Operation/Update/DefaultTemporaryUpdateProcessorTest.php diff --git a/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php b/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php index ab3effed821b4..def51db16454d 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php +++ b/lib/internal/Magento/Framework/DB/Adapter/SqlVersionProvider.php @@ -12,27 +12,23 @@ /** * Class GetDbVersion provides sql engine version requesting version variable * - * @deprecated First iteration of proper solution which is planning to implement soon + * Rather then depending on this class, please implement this logic in your extension */ class SqlVersionProvider { - /** - * @deprecated First iteration of proper solution which is planning to implement soon + /**#@+ + * Database version specific templates */ public const MYSQL_8_0_VERSION = '8.0.'; - /** - * @deprecated First iteration of proper solution which is planning to implement soon - */ public const MYSQL_5_7_VERSION = '5.7.'; - /** - * @deprecated First iteration of proper solution which is planning to implement soon - */ public const MARIA_DB_10_VERSION = '10.'; + /**#@-*/ + /** - * @deprecated First iteration of proper solution which is planning to implement soon + * Database version variable name */ private const VERSION_VAR_NAME = 'version'; From a09cb8b9243fda205177210fccca614045d305d1 Mon Sep 17 00:00:00 2001 From: Max Lesechko Date: Fri, 22 May 2020 11:03:12 -0500 Subject: [PATCH 17/17] MC-14884: MySQL Upgrade - v8 -- resolve merge conflict --- composer.lock | 49 +------------------------------------------------ 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/composer.lock b/composer.lock index 05a6fe1550da3..167e801d3c318 100644 --- a/composer.lock +++ b/composer.lock @@ -4,55 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "73cb6fb6852fc30f4d926c7a013d1847", + "content-hash": "23086b14c6e4e9f771d89d7df324a06d", "packages": [ - { - "name": "braintree/braintree_php", - "version": "3.35.0", - "source": { - "type": "git", - "url": "https://github.com/braintree/braintree_php.git", - "reference": "6c4388199ce379432804a5c18b88585157ef2ed7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/braintree/braintree_php/zipball/6c4388199ce379432804a5c18b88585157ef2ed7", - "reference": "6c4388199ce379432804a5c18b88585157ef2ed7", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-dom": "*", - "ext-hash": "*", - "ext-openssl": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Braintree": "lib/" - }, - "psr-4": { - "Braintree\\": "lib/Braintree" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Braintree", - "homepage": "https://www.braintreepayments.com" - } - ], - "description": "Braintree PHP Client Library", - "time": "2018-07-26T14:37:38+00:00" - }, { "name": "colinmollenhour/cache-backend-file", "version": "v1.4.5",