From a80f3e9ec2645b2d573255e93b5d8afc75308f80 Mon Sep 17 00:00:00 2001 From: David Alger Date: Tue, 27 Oct 2015 16:50:59 -0500 Subject: [PATCH 0001/1004] Update registration files formatting --- app/code/Magento/AdminNotification/registration.php | 8 +++----- .../Magento/AdvancedPricingImportExport/registration.php | 8 +++----- app/code/Magento/Authorization/registration.php | 8 +++----- app/code/Magento/Authorizenet/registration.php | 8 +++----- app/code/Magento/Backend/registration.php | 8 +++----- app/code/Magento/Backup/registration.php | 8 +++----- app/code/Magento/Braintree/registration.php | 8 +++----- app/code/Magento/Bundle/registration.php | 8 +++----- app/code/Magento/BundleImportExport/registration.php | 8 +++----- app/code/Magento/CacheInvalidate/registration.php | 8 +++----- app/code/Magento/Captcha/registration.php | 8 +++----- app/code/Magento/Catalog/registration.php | 8 +++----- app/code/Magento/CatalogImportExport/registration.php | 8 +++----- app/code/Magento/CatalogInventory/registration.php | 8 +++----- app/code/Magento/CatalogRule/registration.php | 8 +++----- app/code/Magento/CatalogRuleConfigurable/registration.php | 8 +++----- app/code/Magento/CatalogSearch/registration.php | 8 +++----- app/code/Magento/CatalogUrlRewrite/registration.php | 8 +++----- app/code/Magento/CatalogWidget/registration.php | 8 +++----- app/code/Magento/Checkout/registration.php | 8 +++----- app/code/Magento/CheckoutAgreements/registration.php | 8 +++----- app/code/Magento/Cms/registration.php | 8 +++----- app/code/Magento/CmsUrlRewrite/registration.php | 8 +++----- app/code/Magento/Config/registration.php | 8 +++----- .../Magento/ConfigurableImportExport/registration.php | 8 +++----- app/code/Magento/ConfigurableProduct/registration.php | 8 +++----- app/code/Magento/Contact/registration.php | 8 +++----- app/code/Magento/Cookie/registration.php | 8 +++----- app/code/Magento/Cron/registration.php | 8 +++----- app/code/Magento/CurrencySymbol/registration.php | 8 +++----- app/code/Magento/Customer/registration.php | 8 +++----- app/code/Magento/CustomerImportExport/registration.php | 8 +++----- app/code/Magento/Deploy/registration.php | 8 +++----- app/code/Magento/Developer/registration.php | 8 +++----- app/code/Magento/Dhl/registration.php | 8 +++----- app/code/Magento/Directory/registration.php | 8 +++----- app/code/Magento/Downloadable/registration.php | 8 +++----- .../Magento/DownloadableImportExport/registration.php | 8 +++----- app/code/Magento/Eav/registration.php | 8 +++----- app/code/Magento/Email/registration.php | 8 +++----- app/code/Magento/EncryptionKey/registration.php | 8 +++----- app/code/Magento/Fedex/registration.php | 8 +++----- app/code/Magento/GiftMessage/registration.php | 8 +++----- app/code/Magento/GoogleAdwords/registration.php | 8 +++----- app/code/Magento/GoogleAnalytics/registration.php | 8 +++----- app/code/Magento/GoogleOptimizer/registration.php | 8 +++----- app/code/Magento/GroupedImportExport/registration.php | 8 +++----- app/code/Magento/GroupedProduct/registration.php | 8 +++----- app/code/Magento/ImportExport/registration.php | 8 +++----- app/code/Magento/Indexer/registration.php | 8 +++----- app/code/Magento/Integration/registration.php | 8 +++----- app/code/Magento/LayeredNavigation/registration.php | 8 +++----- app/code/Magento/Marketplace/registration.php | 8 +++----- app/code/Magento/MediaStorage/registration.php | 8 +++----- app/code/Magento/Msrp/registration.php | 8 +++----- app/code/Magento/Multishipping/registration.php | 8 +++----- app/code/Magento/NewRelicReporting/registration.php | 8 +++----- app/code/Magento/Newsletter/registration.php | 8 +++----- app/code/Magento/OfflinePayments/registration.php | 8 +++----- app/code/Magento/OfflineShipping/registration.php | 8 +++----- app/code/Magento/PageCache/registration.php | 8 +++----- app/code/Magento/Payment/registration.php | 8 +++----- app/code/Magento/Paypal/registration.php | 8 +++----- app/code/Magento/Persistent/registration.php | 8 +++----- app/code/Magento/ProductAlert/registration.php | 8 +++----- app/code/Magento/ProductVideo/registration.php | 8 +++----- app/code/Magento/Quote/registration.php | 8 +++----- app/code/Magento/Reports/registration.php | 8 +++----- app/code/Magento/RequireJs/registration.php | 8 +++----- app/code/Magento/Review/registration.php | 8 +++----- app/code/Magento/Rss/registration.php | 8 +++----- app/code/Magento/Rule/registration.php | 8 +++----- app/code/Magento/Sales/registration.php | 8 +++----- app/code/Magento/SalesRule/registration.php | 8 +++----- app/code/Magento/SalesSequence/registration.php | 8 +++----- app/code/Magento/SampleData/registration.php | 8 +++----- app/code/Magento/Search/registration.php | 8 +++----- app/code/Magento/SendFriend/registration.php | 8 +++----- app/code/Magento/Shipping/registration.php | 8 +++----- app/code/Magento/Sitemap/registration.php | 8 +++----- app/code/Magento/Store/registration.php | 8 +++----- app/code/Magento/Swagger/registration.php | 8 +++----- app/code/Magento/Swatches/registration.php | 8 +++----- app/code/Magento/Tax/registration.php | 8 +++----- app/code/Magento/TaxImportExport/registration.php | 8 +++----- app/code/Magento/Theme/registration.php | 8 +++----- app/code/Magento/Translation/registration.php | 8 +++----- app/code/Magento/Ui/registration.php | 8 +++----- app/code/Magento/Ups/registration.php | 8 +++----- app/code/Magento/UrlRewrite/registration.php | 8 +++----- app/code/Magento/User/registration.php | 8 +++----- app/code/Magento/Usps/registration.php | 8 +++----- app/code/Magento/Variable/registration.php | 8 +++----- app/code/Magento/Version/registration.php | 8 +++----- app/code/Magento/Webapi/registration.php | 8 +++----- app/code/Magento/Weee/registration.php | 8 +++----- app/code/Magento/Widget/registration.php | 8 +++----- app/code/Magento/Wishlist/registration.php | 8 +++----- app/design/adminhtml/Magento/backend/registration.php | 8 +++----- app/design/frontend/Magento/blank/registration.php | 8 +++----- app/design/frontend/Magento/luma/registration.php | 8 +++----- app/i18n/magento/de_de/registration.php | 8 +++----- app/i18n/magento/en_us/registration.php | 8 +++----- app/i18n/magento/es_es/registration.php | 8 +++----- app/i18n/magento/fr_fr/registration.php | 8 +++----- app/i18n/magento/nl_nl/registration.php | 8 +++----- app/i18n/magento/pt_br/registration.php | 8 +++----- app/i18n/magento/zh_hans_cn/registration.php | 8 +++----- .../_files/components/a/aa/aaa/registration.php | 8 +++----- .../Annotation/_files/components/a/aa/registration.php | 8 +++----- .../Test/Annotation/_files/components/b/registration.php | 8 +++----- .../Test/Annotation/_files/components/registration.php | 8 +++----- .../adminhtml/Magento/test_default/registration.php | 8 +++----- .../design/adminhtml/Magento/default/registration.php | 8 +++----- .../design/adminhtml/Vendor/custom_theme/registration.php | 8 +++----- .../design/adminhtml/Vendor/default/registration.php | 8 +++----- .../design/frontend/Magento/default/registration.php | 8 +++----- .../design/frontend/Vendor/custom_theme/registration.php | 8 +++----- .../design/frontend/Vendor/default/registration.php | 8 +++----- .../App/Language/_files/bar/en_gb/registration.php | 8 +++----- .../App/Language/_files/bar/en_us/registration.php | 8 +++----- .../App/Language/_files/baz/en_gb/registration.php | 8 +++----- .../App/Language/_files/first/en_us/registration.php | 8 +++----- .../App/Language/_files/foo/en_au/registration.php | 8 +++----- .../App/Language/_files/my/ru_ru/registration.php | 8 +++----- .../App/Language/_files/second/en_gb/registration.php | 8 +++----- .../App/Language/_files/theirs/ru_ru/registration.php | 8 +++----- .../App/Utility/_files/fixtures/language/registration.php | 8 +++----- .../App/Utility/_files/fixtures/library/registration.php | 8 +++----- .../App/Utility/_files/fixtures/module/registration.php | 8 +++----- .../App/Utility/_files/fixtures/theme/registration.php | 8 +++----- .../_files/code/Magento/Other/registration.php | 8 +++----- .../_files/code/Magento/Third/registration.php | 8 +++----- .../_files/design/frontend/Test/default/registration.php | 8 +++----- .../_files/design/frontend/Test/parent/registration.php | 8 +++----- .../Framework/View/_files/Fixture_Module/registration.php | 8 +++----- .../fallback/app/code/ViewTest_Module/registration.php | 8 +++----- .../design/frontend/Vendor/custom_theme/registration.php | 8 +++----- .../design/frontend/Vendor/custom_theme2/registration.php | 8 +++----- .../design/frontend/Vendor/default/registration.php | 8 +++----- .../frontend/Vendor/standalone_theme/registration.php | 8 +++----- .../Framework/View/_files/static/theme/registration.php | 8 +++----- .../_files/root/app/code/Magento/A/registration.php | 8 +++----- .../_files/root/app/code/Magento/B/registration.php | 8 +++----- .../_files/root/app/code/Magento/C/registration.php | 8 +++----- .../_files/root/app/code/Magento/D/registration.php | 8 +++----- .../_files/design/adminhtml/Vendor/test/registration.php | 8 +++----- .../design/area_two/Vendor/theme_one/registration.php | 8 +++----- .../design/design_area/Vendor/theme_one/registration.php | 8 +++----- .../design/frontend/Magento/default/registration.php | 8 +++----- .../frontend/Magento/default_iphone/registration.php | 8 +++----- .../frontend/Test/cache_test_theme/registration.php | 8 +++----- .../_files/design/frontend/Test/default/registration.php | 8 +++----- .../design/frontend/Test/publication/registration.php | 8 +++----- .../design/frontend/Test/test_theme/registration.php | 8 +++----- .../design/frontend/Vendor/custom_theme/registration.php | 8 +++----- .../design/frontend/Vendor/default/registration.php | 8 +++----- lib/internal/Magento/Framework/registration.php | 8 +++----- 158 files changed, 474 insertions(+), 790 deletions(-) diff --git a/app/code/Magento/AdminNotification/registration.php b/app/code/Magento/AdminNotification/registration.php index 97ce996e0cea8..e8b3c9b94f640 100644 --- a/app/code/Magento/AdminNotification/registration.php +++ b/app/code/Magento/AdminNotification/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_AdminNotification', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AdminNotification', __DIR__); diff --git a/app/code/Magento/AdvancedPricingImportExport/registration.php b/app/code/Magento/AdvancedPricingImportExport/registration.php index ada9c5dc775be..3661c88017287 100644 --- a/app/code/Magento/AdvancedPricingImportExport/registration.php +++ b/app/code/Magento/AdvancedPricingImportExport/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_AdvancedPricingImportExport', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AdvancedPricingImportExport', __DIR__); diff --git a/app/code/Magento/Authorization/registration.php b/app/code/Magento/Authorization/registration.php index d0f2766549041..17b85157be95b 100644 --- a/app/code/Magento/Authorization/registration.php +++ b/app/code/Magento/Authorization/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Authorization', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Authorization', __DIR__); diff --git a/app/code/Magento/Authorizenet/registration.php b/app/code/Magento/Authorizenet/registration.php index 949ec71a44826..675c4afc5b395 100644 --- a/app/code/Magento/Authorizenet/registration.php +++ b/app/code/Magento/Authorizenet/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Authorizenet', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Authorizenet', __DIR__); diff --git a/app/code/Magento/Backend/registration.php b/app/code/Magento/Backend/registration.php index 85b9e918845db..cf8896837da6b 100644 --- a/app/code/Magento/Backend/registration.php +++ b/app/code/Magento/Backend/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Backend', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Backend', __DIR__); diff --git a/app/code/Magento/Backup/registration.php b/app/code/Magento/Backup/registration.php index 36394020abca0..8c607c1526d56 100644 --- a/app/code/Magento/Backup/registration.php +++ b/app/code/Magento/Backup/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Backup', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Backup', __DIR__); diff --git a/app/code/Magento/Braintree/registration.php b/app/code/Magento/Braintree/registration.php index 913c5ea6786a6..b52bc910dbc8e 100644 --- a/app/code/Magento/Braintree/registration.php +++ b/app/code/Magento/Braintree/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Braintree', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Braintree', __DIR__); diff --git a/app/code/Magento/Bundle/registration.php b/app/code/Magento/Bundle/registration.php index 8d7712c274ae1..d92193b33d1d0 100644 --- a/app/code/Magento/Bundle/registration.php +++ b/app/code/Magento/Bundle/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Bundle', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Bundle', __DIR__); diff --git a/app/code/Magento/BundleImportExport/registration.php b/app/code/Magento/BundleImportExport/registration.php index 78aa21fe46130..b06501a60a30b 100644 --- a/app/code/Magento/BundleImportExport/registration.php +++ b/app/code/Magento/BundleImportExport/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_BundleImportExport', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_BundleImportExport', __DIR__); diff --git a/app/code/Magento/CacheInvalidate/registration.php b/app/code/Magento/CacheInvalidate/registration.php index 222f5fba1c110..7446da1525812 100644 --- a/app/code/Magento/CacheInvalidate/registration.php +++ b/app/code/Magento/CacheInvalidate/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CacheInvalidate', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CacheInvalidate', __DIR__); diff --git a/app/code/Magento/Captcha/registration.php b/app/code/Magento/Captcha/registration.php index 856e7b4979d1d..98b7025f9ea69 100644 --- a/app/code/Magento/Captcha/registration.php +++ b/app/code/Magento/Captcha/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Captcha', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Captcha', __DIR__); diff --git a/app/code/Magento/Catalog/registration.php b/app/code/Magento/Catalog/registration.php index 06bb9881a1640..6bc67b299e335 100644 --- a/app/code/Magento/Catalog/registration.php +++ b/app/code/Magento/Catalog/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Catalog', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Catalog', __DIR__); diff --git a/app/code/Magento/CatalogImportExport/registration.php b/app/code/Magento/CatalogImportExport/registration.php index a7f56291680a1..41fcb672533fe 100644 --- a/app/code/Magento/CatalogImportExport/registration.php +++ b/app/code/Magento/CatalogImportExport/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CatalogImportExport', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogImportExport', __DIR__); diff --git a/app/code/Magento/CatalogInventory/registration.php b/app/code/Magento/CatalogInventory/registration.php index 1e2d5650ddd99..bb3579d484f6d 100644 --- a/app/code/Magento/CatalogInventory/registration.php +++ b/app/code/Magento/CatalogInventory/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CatalogInventory', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogInventory', __DIR__); diff --git a/app/code/Magento/CatalogRule/registration.php b/app/code/Magento/CatalogRule/registration.php index 028df4fee7ffd..a1d8e658f46f2 100644 --- a/app/code/Magento/CatalogRule/registration.php +++ b/app/code/Magento/CatalogRule/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CatalogRule', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogRule', __DIR__); diff --git a/app/code/Magento/CatalogRuleConfigurable/registration.php b/app/code/Magento/CatalogRuleConfigurable/registration.php index 8b557765f5776..0deeca8b793b6 100644 --- a/app/code/Magento/CatalogRuleConfigurable/registration.php +++ b/app/code/Magento/CatalogRuleConfigurable/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CatalogRuleConfigurable', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogRuleConfigurable', __DIR__); diff --git a/app/code/Magento/CatalogSearch/registration.php b/app/code/Magento/CatalogSearch/registration.php index 4c9fa0a30238d..730503ed4e414 100644 --- a/app/code/Magento/CatalogSearch/registration.php +++ b/app/code/Magento/CatalogSearch/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CatalogSearch', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogSearch', __DIR__); diff --git a/app/code/Magento/CatalogUrlRewrite/registration.php b/app/code/Magento/CatalogUrlRewrite/registration.php index ddbb85efbf59d..fab34d86317ab 100644 --- a/app/code/Magento/CatalogUrlRewrite/registration.php +++ b/app/code/Magento/CatalogUrlRewrite/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CatalogUrlRewrite', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogUrlRewrite', __DIR__); diff --git a/app/code/Magento/CatalogWidget/registration.php b/app/code/Magento/CatalogWidget/registration.php index 7114504d48dc7..1925c251eb225 100644 --- a/app/code/Magento/CatalogWidget/registration.php +++ b/app/code/Magento/CatalogWidget/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CatalogWidget', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CatalogWidget', __DIR__); diff --git a/app/code/Magento/Checkout/registration.php b/app/code/Magento/Checkout/registration.php index 5766c0f44fc42..115303ff5cb29 100644 --- a/app/code/Magento/Checkout/registration.php +++ b/app/code/Magento/Checkout/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Checkout', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Checkout', __DIR__); diff --git a/app/code/Magento/CheckoutAgreements/registration.php b/app/code/Magento/CheckoutAgreements/registration.php index dee6e43ad0553..253721dedf551 100644 --- a/app/code/Magento/CheckoutAgreements/registration.php +++ b/app/code/Magento/CheckoutAgreements/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CheckoutAgreements', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CheckoutAgreements', __DIR__); diff --git a/app/code/Magento/Cms/registration.php b/app/code/Magento/Cms/registration.php index cd6957e1c40c0..968d5b54eff98 100644 --- a/app/code/Magento/Cms/registration.php +++ b/app/code/Magento/Cms/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Cms', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Cms', __DIR__); diff --git a/app/code/Magento/CmsUrlRewrite/registration.php b/app/code/Magento/CmsUrlRewrite/registration.php index 287bc718443b6..194cb64a21309 100644 --- a/app/code/Magento/CmsUrlRewrite/registration.php +++ b/app/code/Magento/CmsUrlRewrite/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CmsUrlRewrite', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CmsUrlRewrite', __DIR__); diff --git a/app/code/Magento/Config/registration.php b/app/code/Magento/Config/registration.php index 41a97b9b28fef..aa77cb8af2338 100644 --- a/app/code/Magento/Config/registration.php +++ b/app/code/Magento/Config/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Config', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Config', __DIR__); diff --git a/app/code/Magento/ConfigurableImportExport/registration.php b/app/code/Magento/ConfigurableImportExport/registration.php index 8e1dad3f348f8..989122a902a0c 100644 --- a/app/code/Magento/ConfigurableImportExport/registration.php +++ b/app/code/Magento/ConfigurableImportExport/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_ConfigurableImportExport', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ConfigurableImportExport', __DIR__); diff --git a/app/code/Magento/ConfigurableProduct/registration.php b/app/code/Magento/ConfigurableProduct/registration.php index 411e42eeecbfe..11f563e09601b 100644 --- a/app/code/Magento/ConfigurableProduct/registration.php +++ b/app/code/Magento/ConfigurableProduct/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_ConfigurableProduct', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ConfigurableProduct', __DIR__); diff --git a/app/code/Magento/Contact/registration.php b/app/code/Magento/Contact/registration.php index 3ebc422ed8f77..401beef571867 100644 --- a/app/code/Magento/Contact/registration.php +++ b/app/code/Magento/Contact/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Contact', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Contact', __DIR__); diff --git a/app/code/Magento/Cookie/registration.php b/app/code/Magento/Cookie/registration.php index 23fff0217dba4..ec516b5559455 100644 --- a/app/code/Magento/Cookie/registration.php +++ b/app/code/Magento/Cookie/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Cookie', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Cookie', __DIR__); diff --git a/app/code/Magento/Cron/registration.php b/app/code/Magento/Cron/registration.php index d1b83845fe0c4..6ed9ff3f8fe1b 100644 --- a/app/code/Magento/Cron/registration.php +++ b/app/code/Magento/Cron/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Cron', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Cron', __DIR__); diff --git a/app/code/Magento/CurrencySymbol/registration.php b/app/code/Magento/CurrencySymbol/registration.php index 09b8d2933a32c..65cc54b9376bd 100644 --- a/app/code/Magento/CurrencySymbol/registration.php +++ b/app/code/Magento/CurrencySymbol/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CurrencySymbol', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CurrencySymbol', __DIR__); diff --git a/app/code/Magento/Customer/registration.php b/app/code/Magento/Customer/registration.php index 88ff7b8bc1d71..3d7ab800e8b08 100644 --- a/app/code/Magento/Customer/registration.php +++ b/app/code/Magento/Customer/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Customer', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Customer', __DIR__); diff --git a/app/code/Magento/CustomerImportExport/registration.php b/app/code/Magento/CustomerImportExport/registration.php index 6e2ee2f2f0ca4..964c170c3a6f5 100644 --- a/app/code/Magento/CustomerImportExport/registration.php +++ b/app/code/Magento/CustomerImportExport/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_CustomerImportExport', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_CustomerImportExport', __DIR__); diff --git a/app/code/Magento/Deploy/registration.php b/app/code/Magento/Deploy/registration.php index e9dcb9c291941..0b6f025ce1683 100644 --- a/app/code/Magento/Deploy/registration.php +++ b/app/code/Magento/Deploy/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Deploy', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Deploy', __DIR__); diff --git a/app/code/Magento/Developer/registration.php b/app/code/Magento/Developer/registration.php index e1b00f9be04b6..c4b609ecc5952 100644 --- a/app/code/Magento/Developer/registration.php +++ b/app/code/Magento/Developer/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Developer', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Developer', __DIR__); diff --git a/app/code/Magento/Dhl/registration.php b/app/code/Magento/Dhl/registration.php index 8a06be1cc1c2b..eed01db015329 100644 --- a/app/code/Magento/Dhl/registration.php +++ b/app/code/Magento/Dhl/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Dhl', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Dhl', __DIR__); diff --git a/app/code/Magento/Directory/registration.php b/app/code/Magento/Directory/registration.php index d2515bf56c42f..3c2d40c95fd41 100644 --- a/app/code/Magento/Directory/registration.php +++ b/app/code/Magento/Directory/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Directory', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Directory', __DIR__); diff --git a/app/code/Magento/Downloadable/registration.php b/app/code/Magento/Downloadable/registration.php index b079cc78b2777..257a2ecb4cf8c 100644 --- a/app/code/Magento/Downloadable/registration.php +++ b/app/code/Magento/Downloadable/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Downloadable', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Downloadable', __DIR__); diff --git a/app/code/Magento/DownloadableImportExport/registration.php b/app/code/Magento/DownloadableImportExport/registration.php index a29186f647ea5..ad220e68c5590 100644 --- a/app/code/Magento/DownloadableImportExport/registration.php +++ b/app/code/Magento/DownloadableImportExport/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_DownloadableImportExport', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_DownloadableImportExport', __DIR__); diff --git a/app/code/Magento/Eav/registration.php b/app/code/Magento/Eav/registration.php index d4a9f06f65ba6..fab05731dc68a 100644 --- a/app/code/Magento/Eav/registration.php +++ b/app/code/Magento/Eav/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Eav', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Eav', __DIR__); diff --git a/app/code/Magento/Email/registration.php b/app/code/Magento/Email/registration.php index 12354803ede6f..4a6ef72c974d1 100644 --- a/app/code/Magento/Email/registration.php +++ b/app/code/Magento/Email/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Email', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Email', __DIR__); diff --git a/app/code/Magento/EncryptionKey/registration.php b/app/code/Magento/EncryptionKey/registration.php index fa66dfbec6adc..0bed9268311f5 100644 --- a/app/code/Magento/EncryptionKey/registration.php +++ b/app/code/Magento/EncryptionKey/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_EncryptionKey', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_EncryptionKey', __DIR__); diff --git a/app/code/Magento/Fedex/registration.php b/app/code/Magento/Fedex/registration.php index bd5ad69e40918..7c3a553cc401c 100644 --- a/app/code/Magento/Fedex/registration.php +++ b/app/code/Magento/Fedex/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Fedex', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Fedex', __DIR__); diff --git a/app/code/Magento/GiftMessage/registration.php b/app/code/Magento/GiftMessage/registration.php index 3b8af3d26702c..b9792205ebdb1 100644 --- a/app/code/Magento/GiftMessage/registration.php +++ b/app/code/Magento/GiftMessage/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_GiftMessage', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GiftMessage', __DIR__); diff --git a/app/code/Magento/GoogleAdwords/registration.php b/app/code/Magento/GoogleAdwords/registration.php index c907566628846..72c4a36800500 100644 --- a/app/code/Magento/GoogleAdwords/registration.php +++ b/app/code/Magento/GoogleAdwords/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_GoogleAdwords', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GoogleAdwords', __DIR__); diff --git a/app/code/Magento/GoogleAnalytics/registration.php b/app/code/Magento/GoogleAnalytics/registration.php index 16de0f025c15d..a6864b87d6a77 100644 --- a/app/code/Magento/GoogleAnalytics/registration.php +++ b/app/code/Magento/GoogleAnalytics/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_GoogleAnalytics', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GoogleAnalytics', __DIR__); diff --git a/app/code/Magento/GoogleOptimizer/registration.php b/app/code/Magento/GoogleOptimizer/registration.php index fe81deb668c86..6fa1397ad454f 100644 --- a/app/code/Magento/GoogleOptimizer/registration.php +++ b/app/code/Magento/GoogleOptimizer/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_GoogleOptimizer', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GoogleOptimizer', __DIR__); diff --git a/app/code/Magento/GroupedImportExport/registration.php b/app/code/Magento/GroupedImportExport/registration.php index c96c75b72b33e..0f5659f31fc75 100644 --- a/app/code/Magento/GroupedImportExport/registration.php +++ b/app/code/Magento/GroupedImportExport/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_GroupedImportExport', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GroupedImportExport', __DIR__); diff --git a/app/code/Magento/GroupedProduct/registration.php b/app/code/Magento/GroupedProduct/registration.php index d57f2b4a1feca..c8e7125a0b2ed 100644 --- a/app/code/Magento/GroupedProduct/registration.php +++ b/app/code/Magento/GroupedProduct/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_GroupedProduct', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_GroupedProduct', __DIR__); diff --git a/app/code/Magento/ImportExport/registration.php b/app/code/Magento/ImportExport/registration.php index 3a28c6ca75a7e..5164f66338a1f 100644 --- a/app/code/Magento/ImportExport/registration.php +++ b/app/code/Magento/ImportExport/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_ImportExport', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ImportExport', __DIR__); diff --git a/app/code/Magento/Indexer/registration.php b/app/code/Magento/Indexer/registration.php index ace398cb5f98d..18036580781fd 100644 --- a/app/code/Magento/Indexer/registration.php +++ b/app/code/Magento/Indexer/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Indexer', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Indexer', __DIR__); diff --git a/app/code/Magento/Integration/registration.php b/app/code/Magento/Integration/registration.php index b70e6ac688993..16b5db121867a 100644 --- a/app/code/Magento/Integration/registration.php +++ b/app/code/Magento/Integration/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Integration', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Integration', __DIR__); diff --git a/app/code/Magento/LayeredNavigation/registration.php b/app/code/Magento/LayeredNavigation/registration.php index 23ac6139c0402..32c0937589a34 100644 --- a/app/code/Magento/LayeredNavigation/registration.php +++ b/app/code/Magento/LayeredNavigation/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_LayeredNavigation', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_LayeredNavigation', __DIR__); diff --git a/app/code/Magento/Marketplace/registration.php b/app/code/Magento/Marketplace/registration.php index d4d9d7dc636bb..3e3ffeca2489f 100644 --- a/app/code/Magento/Marketplace/registration.php +++ b/app/code/Magento/Marketplace/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Marketplace', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Marketplace', __DIR__); diff --git a/app/code/Magento/MediaStorage/registration.php b/app/code/Magento/MediaStorage/registration.php index 06733697ff5bd..f705cdfae98c5 100644 --- a/app/code/Magento/MediaStorage/registration.php +++ b/app/code/Magento/MediaStorage/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_MediaStorage', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_MediaStorage', __DIR__); diff --git a/app/code/Magento/Msrp/registration.php b/app/code/Magento/Msrp/registration.php index a6c466c4beadc..234f0fcd219a2 100644 --- a/app/code/Magento/Msrp/registration.php +++ b/app/code/Magento/Msrp/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Msrp', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Msrp', __DIR__); diff --git a/app/code/Magento/Multishipping/registration.php b/app/code/Magento/Multishipping/registration.php index 0cd2ecac61d88..eb590b200d9db 100644 --- a/app/code/Magento/Multishipping/registration.php +++ b/app/code/Magento/Multishipping/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Multishipping', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Multishipping', __DIR__); diff --git a/app/code/Magento/NewRelicReporting/registration.php b/app/code/Magento/NewRelicReporting/registration.php index d342feffdd9e8..eac06d94025b2 100644 --- a/app/code/Magento/NewRelicReporting/registration.php +++ b/app/code/Magento/NewRelicReporting/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_NewRelicReporting', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_NewRelicReporting', __DIR__); diff --git a/app/code/Magento/Newsletter/registration.php b/app/code/Magento/Newsletter/registration.php index 0f282d1561dd3..18015f88c3174 100644 --- a/app/code/Magento/Newsletter/registration.php +++ b/app/code/Magento/Newsletter/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Newsletter', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Newsletter', __DIR__); diff --git a/app/code/Magento/OfflinePayments/registration.php b/app/code/Magento/OfflinePayments/registration.php index 7cc05a9270df4..d07b0cec13a5b 100644 --- a/app/code/Magento/OfflinePayments/registration.php +++ b/app/code/Magento/OfflinePayments/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_OfflinePayments', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_OfflinePayments', __DIR__); diff --git a/app/code/Magento/OfflineShipping/registration.php b/app/code/Magento/OfflineShipping/registration.php index 14c6bff9ecc81..032b255066b80 100644 --- a/app/code/Magento/OfflineShipping/registration.php +++ b/app/code/Magento/OfflineShipping/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_OfflineShipping', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_OfflineShipping', __DIR__); diff --git a/app/code/Magento/PageCache/registration.php b/app/code/Magento/PageCache/registration.php index f10b487e1a0b7..55ee624002d33 100644 --- a/app/code/Magento/PageCache/registration.php +++ b/app/code/Magento/PageCache/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_PageCache', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_PageCache', __DIR__); diff --git a/app/code/Magento/Payment/registration.php b/app/code/Magento/Payment/registration.php index eb2ae83543e95..1cdec98e42717 100644 --- a/app/code/Magento/Payment/registration.php +++ b/app/code/Magento/Payment/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Payment', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Payment', __DIR__); diff --git a/app/code/Magento/Paypal/registration.php b/app/code/Magento/Paypal/registration.php index 59ea72b9d9827..fb5d90c55c49a 100644 --- a/app/code/Magento/Paypal/registration.php +++ b/app/code/Magento/Paypal/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Paypal', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Paypal', __DIR__); diff --git a/app/code/Magento/Persistent/registration.php b/app/code/Magento/Persistent/registration.php index a66ba40c2fb65..242f3d29dafad 100644 --- a/app/code/Magento/Persistent/registration.php +++ b/app/code/Magento/Persistent/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Persistent', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Persistent', __DIR__); diff --git a/app/code/Magento/ProductAlert/registration.php b/app/code/Magento/ProductAlert/registration.php index 2ca33694cbfb0..d8c305aae8d5d 100644 --- a/app/code/Magento/ProductAlert/registration.php +++ b/app/code/Magento/ProductAlert/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_ProductAlert', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ProductAlert', __DIR__); diff --git a/app/code/Magento/ProductVideo/registration.php b/app/code/Magento/ProductVideo/registration.php index 8c5e3263fea71..775bd98f2c33b 100644 --- a/app/code/Magento/ProductVideo/registration.php +++ b/app/code/Magento/ProductVideo/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_ProductVideo', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ProductVideo', __DIR__); diff --git a/app/code/Magento/Quote/registration.php b/app/code/Magento/Quote/registration.php index b8005a355dc2d..2319c94ab7c6b 100644 --- a/app/code/Magento/Quote/registration.php +++ b/app/code/Magento/Quote/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Quote', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Quote', __DIR__); diff --git a/app/code/Magento/Reports/registration.php b/app/code/Magento/Reports/registration.php index c14d60ba8f79d..26dd64fb161a3 100644 --- a/app/code/Magento/Reports/registration.php +++ b/app/code/Magento/Reports/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Reports', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Reports', __DIR__); diff --git a/app/code/Magento/RequireJs/registration.php b/app/code/Magento/RequireJs/registration.php index 26b2e8a0ce72f..51379e77e6954 100644 --- a/app/code/Magento/RequireJs/registration.php +++ b/app/code/Magento/RequireJs/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_RequireJs', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_RequireJs', __DIR__); diff --git a/app/code/Magento/Review/registration.php b/app/code/Magento/Review/registration.php index cedf01574e13c..6ba34c116129d 100644 --- a/app/code/Magento/Review/registration.php +++ b/app/code/Magento/Review/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Review', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Review', __DIR__); diff --git a/app/code/Magento/Rss/registration.php b/app/code/Magento/Rss/registration.php index d3483620b6924..4bbd727d455bc 100644 --- a/app/code/Magento/Rss/registration.php +++ b/app/code/Magento/Rss/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Rss', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Rss', __DIR__); diff --git a/app/code/Magento/Rule/registration.php b/app/code/Magento/Rule/registration.php index 8f05b4bc0724b..e0c9b65a98b90 100644 --- a/app/code/Magento/Rule/registration.php +++ b/app/code/Magento/Rule/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Rule', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Rule', __DIR__); diff --git a/app/code/Magento/Sales/registration.php b/app/code/Magento/Sales/registration.php index 36ed3ebc3652e..5baf79d1f36c0 100644 --- a/app/code/Magento/Sales/registration.php +++ b/app/code/Magento/Sales/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Sales', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Sales', __DIR__); diff --git a/app/code/Magento/SalesRule/registration.php b/app/code/Magento/SalesRule/registration.php index 499709f1f8dbd..3f176709d51e4 100644 --- a/app/code/Magento/SalesRule/registration.php +++ b/app/code/Magento/SalesRule/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_SalesRule', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SalesRule', __DIR__); diff --git a/app/code/Magento/SalesSequence/registration.php b/app/code/Magento/SalesSequence/registration.php index a2140fe647f09..99b1267abff9c 100644 --- a/app/code/Magento/SalesSequence/registration.php +++ b/app/code/Magento/SalesSequence/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_SalesSequence', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SalesSequence', __DIR__); diff --git a/app/code/Magento/SampleData/registration.php b/app/code/Magento/SampleData/registration.php index 7dfbb9f61f8a2..30bc219b8373f 100644 --- a/app/code/Magento/SampleData/registration.php +++ b/app/code/Magento/SampleData/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_SampleData', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SampleData', __DIR__); diff --git a/app/code/Magento/Search/registration.php b/app/code/Magento/Search/registration.php index bab0ed127040e..49901d4ec2e8a 100644 --- a/app/code/Magento/Search/registration.php +++ b/app/code/Magento/Search/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Search', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Search', __DIR__); diff --git a/app/code/Magento/SendFriend/registration.php b/app/code/Magento/SendFriend/registration.php index 6fc0fecfa206b..8a29e1da75806 100644 --- a/app/code/Magento/SendFriend/registration.php +++ b/app/code/Magento/SendFriend/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_SendFriend', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SendFriend', __DIR__); diff --git a/app/code/Magento/Shipping/registration.php b/app/code/Magento/Shipping/registration.php index df871bf1c922b..975c2cf1ba38a 100644 --- a/app/code/Magento/Shipping/registration.php +++ b/app/code/Magento/Shipping/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Shipping', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Shipping', __DIR__); diff --git a/app/code/Magento/Sitemap/registration.php b/app/code/Magento/Sitemap/registration.php index aa9335c9f529f..b9f1579b66d27 100644 --- a/app/code/Magento/Sitemap/registration.php +++ b/app/code/Magento/Sitemap/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Sitemap', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Sitemap', __DIR__); diff --git a/app/code/Magento/Store/registration.php b/app/code/Magento/Store/registration.php index 0be50f910a0ea..508e3ff1da656 100644 --- a/app/code/Magento/Store/registration.php +++ b/app/code/Magento/Store/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Store', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Store', __DIR__); diff --git a/app/code/Magento/Swagger/registration.php b/app/code/Magento/Swagger/registration.php index 414fe9481e117..2902110898ed7 100644 --- a/app/code/Magento/Swagger/registration.php +++ b/app/code/Magento/Swagger/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Swagger', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Swagger', __DIR__); diff --git a/app/code/Magento/Swatches/registration.php b/app/code/Magento/Swatches/registration.php index b40ed4aca7387..ae493e1402b49 100644 --- a/app/code/Magento/Swatches/registration.php +++ b/app/code/Magento/Swatches/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Swatches', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Swatches', __DIR__); diff --git a/app/code/Magento/Tax/registration.php b/app/code/Magento/Tax/registration.php index 5b38947a20544..6460fdd0dda90 100644 --- a/app/code/Magento/Tax/registration.php +++ b/app/code/Magento/Tax/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Tax', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Tax', __DIR__); diff --git a/app/code/Magento/TaxImportExport/registration.php b/app/code/Magento/TaxImportExport/registration.php index 9d6ba649267f7..b1f8df8db4f65 100644 --- a/app/code/Magento/TaxImportExport/registration.php +++ b/app/code/Magento/TaxImportExport/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_TaxImportExport', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TaxImportExport', __DIR__); diff --git a/app/code/Magento/Theme/registration.php b/app/code/Magento/Theme/registration.php index e39fbb02c2120..bb37ef876f0e8 100644 --- a/app/code/Magento/Theme/registration.php +++ b/app/code/Magento/Theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Theme', __DIR__); diff --git a/app/code/Magento/Translation/registration.php b/app/code/Magento/Translation/registration.php index a521173713c1a..081c6fa65b321 100644 --- a/app/code/Magento/Translation/registration.php +++ b/app/code/Magento/Translation/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Translation', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Translation', __DIR__); diff --git a/app/code/Magento/Ui/registration.php b/app/code/Magento/Ui/registration.php index 32fdab913ffe3..7f731c17cddce 100644 --- a/app/code/Magento/Ui/registration.php +++ b/app/code/Magento/Ui/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Ui', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Ui', __DIR__); diff --git a/app/code/Magento/Ups/registration.php b/app/code/Magento/Ups/registration.php index 4093849996e4e..55ff81d20195d 100644 --- a/app/code/Magento/Ups/registration.php +++ b/app/code/Magento/Ups/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Ups', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Ups', __DIR__); diff --git a/app/code/Magento/UrlRewrite/registration.php b/app/code/Magento/UrlRewrite/registration.php index 8a6a136df051f..b7d317225a5be 100644 --- a/app/code/Magento/UrlRewrite/registration.php +++ b/app/code/Magento/UrlRewrite/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_UrlRewrite', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_UrlRewrite', __DIR__); diff --git a/app/code/Magento/User/registration.php b/app/code/Magento/User/registration.php index b05166ceea58b..7c9b9067e52e6 100644 --- a/app/code/Magento/User/registration.php +++ b/app/code/Magento/User/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_User', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_User', __DIR__); diff --git a/app/code/Magento/Usps/registration.php b/app/code/Magento/Usps/registration.php index 7125a0bce83fe..ca965c03ab189 100644 --- a/app/code/Magento/Usps/registration.php +++ b/app/code/Magento/Usps/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Usps', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Usps', __DIR__); diff --git a/app/code/Magento/Variable/registration.php b/app/code/Magento/Variable/registration.php index ad9d49341068d..39f23d797fdd8 100644 --- a/app/code/Magento/Variable/registration.php +++ b/app/code/Magento/Variable/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Variable', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Variable', __DIR__); diff --git a/app/code/Magento/Version/registration.php b/app/code/Magento/Version/registration.php index 8350c45984412..fa3727819777e 100644 --- a/app/code/Magento/Version/registration.php +++ b/app/code/Magento/Version/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Version', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Version', __DIR__); diff --git a/app/code/Magento/Webapi/registration.php b/app/code/Magento/Webapi/registration.php index 41f7965c1c275..3555321319a8f 100644 --- a/app/code/Magento/Webapi/registration.php +++ b/app/code/Magento/Webapi/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Webapi', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Webapi', __DIR__); diff --git a/app/code/Magento/Weee/registration.php b/app/code/Magento/Weee/registration.php index 5dff27bb7eb3a..0a984cf56e54a 100644 --- a/app/code/Magento/Weee/registration.php +++ b/app/code/Magento/Weee/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Weee', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Weee', __DIR__); diff --git a/app/code/Magento/Widget/registration.php b/app/code/Magento/Widget/registration.php index dfac30b3b8cef..f193b93215ec7 100644 --- a/app/code/Magento/Widget/registration.php +++ b/app/code/Magento/Widget/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Widget', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Widget', __DIR__); diff --git a/app/code/Magento/Wishlist/registration.php b/app/code/Magento/Wishlist/registration.php index ae9b8f371ccf3..f203794979b58 100644 --- a/app/code/Magento/Wishlist/registration.php +++ b/app/code/Magento/Wishlist/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Wishlist', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Wishlist', __DIR__); diff --git a/app/design/adminhtml/Magento/backend/registration.php b/app/design/adminhtml/Magento/backend/registration.php index fe7ecf22478d8..0ad3f1aca6fa4 100644 --- a/app/design/adminhtml/Magento/backend/registration.php +++ b/app/design/adminhtml/Magento/backend/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'adminhtml/Magento/backend', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/Magento/backend', __DIR__); diff --git a/app/design/frontend/Magento/blank/registration.php b/app/design/frontend/Magento/blank/registration.php index cdcf4b7b89ced..b986a4470c21c 100644 --- a/app/design/frontend/Magento/blank/registration.php +++ b/app/design/frontend/Magento/blank/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Magento/blank', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento/blank', __DIR__); diff --git a/app/design/frontend/Magento/luma/registration.php b/app/design/frontend/Magento/luma/registration.php index 9ff22252bc851..776821c909d5e 100644 --- a/app/design/frontend/Magento/luma/registration.php +++ b/app/design/frontend/Magento/luma/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Magento/luma', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento/luma', __DIR__); diff --git a/app/i18n/magento/de_de/registration.php b/app/i18n/magento/de_de/registration.php index 044091926dab6..6937e16448828 100644 --- a/app/i18n/magento/de_de/registration.php +++ b/app/i18n/magento/de_de/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'magento_de_de', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_de_de', __DIR__); diff --git a/app/i18n/magento/en_us/registration.php b/app/i18n/magento/en_us/registration.php index 5a2a809085fed..dd464d207e4f0 100644 --- a/app/i18n/magento/en_us/registration.php +++ b/app/i18n/magento/en_us/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'magento_en_us', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_en_us', __DIR__); diff --git a/app/i18n/magento/es_es/registration.php b/app/i18n/magento/es_es/registration.php index 303cd1f1b3796..a3faeb91aaa9d 100644 --- a/app/i18n/magento/es_es/registration.php +++ b/app/i18n/magento/es_es/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'magento_es_es', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_es_es', __DIR__); diff --git a/app/i18n/magento/fr_fr/registration.php b/app/i18n/magento/fr_fr/registration.php index fb876534299fa..43365939e88c0 100644 --- a/app/i18n/magento/fr_fr/registration.php +++ b/app/i18n/magento/fr_fr/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'magento_fr_fr', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_fr_fr', __DIR__); diff --git a/app/i18n/magento/nl_nl/registration.php b/app/i18n/magento/nl_nl/registration.php index 120aa707c6051..9becb85b5553a 100644 --- a/app/i18n/magento/nl_nl/registration.php +++ b/app/i18n/magento/nl_nl/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'magento_nl_nl', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_nl_nl', __DIR__); diff --git a/app/i18n/magento/pt_br/registration.php b/app/i18n/magento/pt_br/registration.php index dfddce390eca9..9c39e7d9af4fb 100644 --- a/app/i18n/magento/pt_br/registration.php +++ b/app/i18n/magento/pt_br/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'magento_pt_br', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_pt_br', __DIR__); diff --git a/app/i18n/magento/zh_hans_cn/registration.php b/app/i18n/magento/zh_hans_cn/registration.php index 18d028f3d0dfa..1104cea6cc47a 100644 --- a/app/i18n/magento/zh_hans_cn/registration.php +++ b/app/i18n/magento/zh_hans_cn/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'magento_zh_hans_cn', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_zh_hans_cn', __DIR__); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/aaa/registration.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/aaa/registration.php index e6e5057b6e1b9..909fd23c1cb68 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/aaa/registration.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/aaa/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Magento/theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento/theme', __DIR__); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/registration.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/registration.php index c51d8d31764af..6e6eeabb6dbd1 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/registration.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/a/aa/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'magento_language', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_language', __DIR__); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/b/registration.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/b/registration.php index 111996c5cbceb..bda637a9b9b76 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/b/registration.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/b/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LIBRARY, - 'magento/library', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LIBRARY, 'magento/library', __DIR__); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/registration.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/registration.php index 0ec16ca5d4caa..8d75ca545c062 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/registration.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Annotation/_files/components/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_ModuleOne', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_ModuleOne', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/registration.php b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/registration.php index 2c1e7e76f848f..176c4a618ff1b 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/design/adminhtml/Magento/test_default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'adminhtml/BackendTest/test_default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/BackendTest/test_default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/registration.php index 56cd0e58c3100..62cc535a003e5 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Magento/default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'adminhtml/Magento_EmailTest/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/Magento_EmailTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/registration.php index 3999c26bffd9b..b6c0fed3dc2f3 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/custom_theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'adminhtml/Vendor_EmailTest/custom_theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/Vendor_EmailTest/custom_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/registration.php index c991e8c966f61..4281c953efd55 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/adminhtml/Vendor/default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'adminhtml/Vendor_EmailTest/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/Vendor_EmailTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/registration.php index cbf77ed0582a5..84b6548eb5927 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Magento/default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Magento_EmailTest/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento_EmailTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/registration.php index 333b5468659a4..c8624c4c49b63 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/custom_theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Vendor_EmailTest/custom_theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_EmailTest/custom_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/registration.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/registration.php index 7ad272f658b7a..92f13468bfbb8 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/design/frontend/Vendor/default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Vendor_EmailTest/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_EmailTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/registration.php index e85db36508fe1..0d84d0376fad7 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'bar_en_gb', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'bar_en_gb', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php index 139f3bf40893b..7c78a7179ac26 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_us/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'bar_en_us', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'bar_en_us', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/registration.php index 61656d3140cd5..e3a6b6630633f 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/baz/en_gb/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'baz_en_gb', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'baz_en_gb', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php index c15a7d120cb2c..7961add2938e1 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/first/en_us/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'first_en_us', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'first_en_us', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/foo/en_au/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/foo/en_au/registration.php index 7bb873eef4920..4e1c6db2358a7 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/foo/en_au/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/foo/en_au/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'foo_en_au', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'foo_en_au', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/my/ru_ru/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/my/ru_ru/registration.php index 82b5867e23d68..8b38370f72bcc 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/my/ru_ru/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/my/ru_ru/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'my_ru_ru', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'my_ru_ru', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/registration.php index 94b6a39da0242..b3e2e29ae1da6 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/second/en_gb/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'second_en_gb', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'second_en_gb', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/theirs/ru_ru/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/theirs/ru_ru/registration.php index 207d2238e81e2..b7a89761a2852 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/theirs/ru_ru/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/theirs/ru_ru/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'theirs_ru_ru', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'theirs_ru_ru', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/language/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/language/registration.php index a0975883ef23c..fa670f9b96959 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/language/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/language/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LANGUAGE, - 'magento_test_lang', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LANGUAGE, 'magento_test_lang', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/library/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/library/registration.php index 4b2df6f818d94..08ca5a73e9a94 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/library/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/library/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LIBRARY, - 'magento/test', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LIBRARY, 'magento/test', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/module/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/module/registration.php index 7b4dcf888a0cd..31a0caae502cf 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/module/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/module/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_Module', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_Module', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/theme/registration.php b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/theme/registration.php index 51e6874c5dfaf..1bbb4653139db 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Utility/_files/fixtures/theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontent/Test/theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontent/Test/theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Other/registration.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Other/registration.php index de4863ba94ca7..f84192394674e 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Other/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Other/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'MagentoFrameworkCssTest_Other', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'MagentoFrameworkCssTest_Other', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Third/registration.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Third/registration.php index 634d8a467d2fd..a4220111cbd61 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Third/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/code/Magento/Third/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'MagentoFrameworkCssTest_Third', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'MagentoFrameworkCssTest_Third', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/default/registration.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/default/registration.php index d6ee757711949..15565a8f528a1 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/FrameworkCssTest/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/FrameworkCssTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/parent/registration.php b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/parent/registration.php index c14fdc49c621c..4f48c3b89b172 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/parent/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Css/PreProcessor/_files/design/frontend/Test/parent/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/FrameworkCssTest/parent', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/FrameworkCssTest/parent', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/Fixture_Module/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/Fixture_Module/registration.php index 72beab3537885..b72a6763ae92e 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/Fixture_Module/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/Fixture_Module/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Fixture_Module', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Fixture_Module', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/app/code/ViewTest_Module/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/app/code/ViewTest_Module/registration.php index 8522481ea3b6b..b3bef170c5cd0 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/app/code/ViewTest_Module/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/app/code/ViewTest_Module/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'ViewTest_Module', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'ViewTest_Module', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme/registration.php index 49ed5412d7d8b..ff30803292a5e 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Vendor_ViewTest/custom_theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_ViewTest/custom_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme2/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme2/registration.php index ab97f9711e8aa..a25cfe3af8742 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme2/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/custom_theme2/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Vendor_ViewTest/custom_theme2', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_ViewTest/custom_theme2', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/default/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/default/registration.php index 7e382a17578bf..6f8ec25319666 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Vendor_ViewTest/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_ViewTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/standalone_theme/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/standalone_theme/registration.php index e561eaa2172c3..845159426740d 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/standalone_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/fallback/design/frontend/Vendor/standalone_theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Vendor_ViewTest/standalone_theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_ViewTest/standalone_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Framework/View/_files/static/theme/registration.php b/dev/tests/integration/testsuite/Magento/Framework/View/_files/static/theme/registration.php index 259484077e401..a471e5a408178 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/View/_files/static/theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Framework/View/_files/static/theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/FrameworkViewMinifier/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/FrameworkViewMinifier/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/A/registration.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/A/registration.php index d46179cca6325..0132148084973 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/A/registration.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/A/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_A', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_A', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/B/registration.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/B/registration.php index 25dc252814736..4d2cc750ca9c7 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/B/registration.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/B/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_B', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_B', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/C/registration.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/C/registration.php index a90284a15071d..31f51c0207f29 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/C/registration.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/C/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_C', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_C', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/D/registration.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/D/registration.php index c3801c34a7002..9111666869611 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/D/registration.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/_files/root/app/code/Magento/D/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::MODULE, - 'Magento_D', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_D', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/adminhtml/Vendor/test/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/adminhtml/Vendor/test/registration.php index b13df2d236b5c..42c27fde32b30 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/adminhtml/Vendor/test/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/adminhtml/Vendor/test/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'adminhtml/FrameworkThemeTest/test', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/FrameworkThemeTest/test', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/area_two/Vendor/theme_one/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/area_two/Vendor/theme_one/registration.php index e3fcdf6dff8f1..b10bb28ade890 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/area_two/Vendor/theme_one/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/area_two/Vendor/theme_one/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'area_two/FrameworkThemeTest/theme_one', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'area_two/FrameworkThemeTest/theme_one', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/design_area/Vendor/theme_one/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/design_area/Vendor/theme_one/registration.php index dd9d9d6db2b22..7ee982fa733d3 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/design_area/Vendor/theme_one/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/design_area/Vendor/theme_one/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'design_area/FrameworkThemeTest/theme_one', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'design_area/FrameworkThemeTest/theme_one', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default/registration.php index 1b162158734e1..04fd69e89bba4 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Magento_FrameworkThemeTest/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento_FrameworkThemeTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default_iphone/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default_iphone/registration.php index 9f9679873d2d9..1452be77247d6 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default_iphone/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Magento/default_iphone/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Magento_FrameworkThemeTest/default_iphone', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Magento_FrameworkThemeTest/default_iphone', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/cache_test_theme/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/cache_test_theme/registration.php index afb83b7bd63a4..31a9bea4b1f87 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/cache_test_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/cache_test_theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Test_FrameworkThemeTest/cache_test_theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Test_FrameworkThemeTest/cache_test_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/registration.php index c3153b6148a46..68ea7874485ac 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Test_FrameworkThemeTest/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Test_FrameworkThemeTest/default', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/publication/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/publication/registration.php index 32e6637fce0a0..ef622af04144d 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/publication/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/publication/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Test_FrameworkThemeTest/publication', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Test_FrameworkThemeTest/publication', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/test_theme/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/test_theme/registration.php index 0dd30036d829f..a46bffa44ef40 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/test_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Test/test_theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Test_FrameworkThemeTest/test_theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Test_FrameworkThemeTest/test_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/custom_theme/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/custom_theme/registration.php index 7c2c11bfff98a..d98854574772a 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/custom_theme/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/custom_theme/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Vendor_FrameworkThemeTest/custom_theme', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_FrameworkThemeTest/custom_theme', __DIR__); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/default/registration.php b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/default/registration.php index fb6f91a1c7949..03652519abb7b 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/default/registration.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/_files/design/frontend/Vendor/default/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::THEME, - 'frontend/Vendor_FrameworkThemeTest/default', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Vendor_FrameworkThemeTest/default', __DIR__); diff --git a/lib/internal/Magento/Framework/registration.php b/lib/internal/Magento/Framework/registration.php index 1152ebad30d44..731f618bd3ef7 100644 --- a/lib/internal/Magento/Framework/registration.php +++ b/lib/internal/Magento/Framework/registration.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -\Magento\Framework\Component\ComponentRegistrar::register( - \Magento\Framework\Component\ComponentRegistrar::LIBRARY, - 'magento/framework', - __DIR__ -); +use \Magento\Framework\Component\ComponentRegistrar; + +ComponentRegistrar::register(ComponentRegistrar::LIBRARY, 'magento/framework', __DIR__); From 1d514f78203ef64a756ba249f75c9edf3eb2be7b Mon Sep 17 00:00:00 2001 From: David Alger Date: Wed, 28 Oct 2015 11:27:44 -0500 Subject: [PATCH 0002/1004] Fixed integration test which broken when assumption changed The `DependenciesShowFrameworkCommandTest` implementation relied on an assumption that there were two references to `Magento\Framework` in the mock modules. Since the change to the registration.php files reduced this to one, the total dependency count dropped from 3 to 2. --- .../Console/Command/DependenciesShowFrameworkCommandTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowFrameworkCommandTest.php b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowFrameworkCommandTest.php index 97abfdd0f856b..6786cbd19f254 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowFrameworkCommandTest.php +++ b/dev/tests/integration/testsuite/Magento/Setup/Console/Command/DependenciesShowFrameworkCommandTest.php @@ -74,8 +74,8 @@ public function testExecute() $fileContents ); $this->assertContains('"Dependencies for each module:",' . PHP_EOL, $fileContents); - $this->assertContains('"Magento\A",1' . PHP_EOL . '" -- Magento\Framework",3' . PHP_EOL, $fileContents); - $this->assertContains('"Magento\B",1' . PHP_EOL . '" -- Magento\Framework",3' . PHP_EOL, $fileContents); + $this->assertContains('"Magento\A",1' . PHP_EOL . '" -- Magento\Framework",2' . PHP_EOL, $fileContents); + $this->assertContains('"Magento\B",1' . PHP_EOL . '" -- Magento\Framework",2' . PHP_EOL, $fileContents); } } From c2267076f4ad1ef4c4bc362760952661171127ae Mon Sep 17 00:00:00 2001 From: wardcapp Date: Thu, 13 Oct 2016 12:56:43 +0200 Subject: [PATCH 0003/1004] MAGETWO-59282: Corrected previous fix, do not set store id on the response when it was not set in the first place. --- .../Controller/Adminhtml/Product/MassStatus.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php index 43114cb83ad14..c0c17f1189adc 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassStatus.php @@ -82,18 +82,18 @@ public function execute() { $collection = $this->filter->getCollection($this->collectionFactory->create()); $productIds = $collection->getAllIds(); - $storeId = (int) $this->getRequest()->getParam('store', 0); + $requestStoreId = $storeId = $this->getRequest()->getParam('store', null); + $filterRequest = $this->getRequest()->getParam('filters', null); $status = (int) $this->getRequest()->getParam('status'); - $filters = (array)$this->getRequest()->getParam('filters', []); - if (isset($filters['store_id'])) { - $storeId = (int)$filters['store_id']; + if (null !== $storeId && null !== $filterRequest) { + $storeId = (isset($filterRequest['store_id'])) ? (int) $filterRequest['store_id'] : 0; } try { $this->_validateMassStatus($productIds, $status); $this->_objectManager->get(\Magento\Catalog\Model\Product\Action::class) - ->updateAttributes($productIds, ['status' => $status], $storeId); + ->updateAttributes($productIds, ['status' => $status], (int) $storeId); $this->messageManager->addSuccess(__('A total of %1 record(s) have been updated.', count($productIds))); $this->_productPriceIndexerProcessor->reindexList($productIds); } catch (\Magento\Framework\Exception\LocalizedException $e) { @@ -104,6 +104,6 @@ public function execute() /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); - return $resultRedirect->setPath('catalog/*/', ['store' => $storeId]); + return $resultRedirect->setPath('catalog/*/', ['store' => $requestStoreId]); } } From c0f9508818a29d4f49c426ef9d8b4f6dca173682 Mon Sep 17 00:00:00 2001 From: Teun Lassche Date: Wed, 9 Nov 2016 11:36:52 +0100 Subject: [PATCH 0004/1004] Fix issue #6999: Configurable attribute cache was never hit --- .../ConfigurableProduct/Model/Product/Type/Configurable.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index 0b8a4aee9fece..3c888aca7896b 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -443,15 +443,15 @@ public function getConfigurableAttributes($product) */ protected function hasCacheData($configurableAttributes) { - $configurableAttributes = $configurableAttributes ?: unserialize($configurableAttributes); - if (is_array($configurableAttributes) && count($configurableAttributes)) { + $configurableAttributes = $configurableAttributes ? unserialize($configurableAttributes) : $configurableAttributes; + if ((is_array($configurableAttributes) || $configurableAttributes instanceof \Traversable) && count($configurableAttributes)) { foreach ($configurableAttributes as $attribute) { /** @var \Magento\ConfigurableProduct\Model\Product\Type\Configurable\Attribute $attribute */ if ($attribute->getData('options')) { return $configurableAttributes; } } - } + } return false; } From 00bcf1709931b078983ce97f33091380c6d3c503 Mon Sep 17 00:00:00 2001 From: Carey Sizer Date: Wed, 16 Nov 2016 13:06:08 +1300 Subject: [PATCH 0005/1004] Fix Swagger-generated operation parameter names for "body" parameters These were previously all output as a string "$body". This improves Swagger-generated API clients and compatibility with swagger-codegen & janephp/openapi generator. This caused the following issues: - Variable variable output in janephp/openapi code generation - Incorrect code output (multiple models called "Body") in janephp/openapi - "Anonymous" class naming in swagger-codegen generated clients (approx 20 models called Body1, Body2, Body3 are output for a Magento Enterprise schema) The new format is: operationNamePostBody. Operation Id is guaranteed to be unique under the Open API specification. Changing the body parameter in the schema should also not affect clients conforming to the specification. --- .../Magento/Webapi/Model/Rest/Swagger/Generator.php | 11 ++++++----- .../Test/Unit/Model/Rest/Swagger/GeneratorTest.php | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php index 5f31a2cb4c0f4..be57570878467 100644 --- a/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php +++ b/app/code/Magento/Webapi/Model/Rest/Swagger/Generator.php @@ -207,14 +207,14 @@ protected function getGeneralInfo() protected function generatePathInfo($methodName, $httpMethodData, $tagName) { $methodData = $httpMethodData[Converter::KEY_METHOD]; + $operationId = $this->typeProcessor->getOperationName($tagName, $methodData[Converter::KEY_METHOD]) . ucfirst($methodName); $pathInfo = [ 'tags' => [$tagName], 'description' => $methodData['documentation'], - 'operationId' => $this->typeProcessor->getOperationName($tagName, $methodData[Converter::KEY_METHOD]) . - ucfirst($methodName) + 'operationId' => $operationId, ]; - $parameters = $this->generateMethodParameters($httpMethodData); + $parameters = $this->generateMethodParameters($httpMethodData, $operationId); if ($parameters) { $pathInfo['parameters'] = $parameters; } @@ -268,11 +268,12 @@ protected function generateMethodResponses($methodData) * Generate parameters based on method data * * @param array $httpMethodData + * @param string $operationId * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ - private function generateMethodParameters($httpMethodData) + private function generateMethodParameters($httpMethodData, $operationId) { $bodySchema = []; $parameters = []; @@ -341,7 +342,7 @@ private function generateMethodParameters($httpMethodData) if ($bodySchema) { $bodyParam = []; - $bodyParam['name'] = '$body'; + $bodyParam['name'] = $operationId . 'Body'; $bodyParam['in'] = 'body'; $bodyParam['schema'] = $bodySchema; $parameters[] = $bodyParam; diff --git a/app/code/Magento/Webapi/Test/Unit/Model/Rest/Swagger/GeneratorTest.php b/app/code/Magento/Webapi/Test/Unit/Model/Rest/Swagger/GeneratorTest.php index aea9a8e6bd557..32672f23e2ace 100644 --- a/app/code/Magento/Webapi/Test/Unit/Model/Rest/Swagger/GeneratorTest.php +++ b/app/code/Magento/Webapi/Test/Unit/Model/Rest/Swagger/GeneratorTest.php @@ -205,7 +205,7 @@ public function generateDataProvider() ] ], // @codingStandardsIgnoreStart - '{"swagger":"2.0","info":{"version":"","title":""},"host":"magento.host","basePath":"/rest/default","schemes":["http://"],"tags":[{"name":"testModule5AllSoapAndRestV2","description":"AllSoapAndRestInterface"}],"paths":{"/V1/testModule5":{"post":{"tags":["testModule5AllSoapAndRestV2"],"description":"Add new item.","operationId":"' . self::OPERATION_NAME . 'Post","parameters":[{"name":"$body","in":"body","schema":{"required":["item"],"properties":{"item":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"type":"object"}}],"responses":{"200":{"description":"200 Success.","schema":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"401":{"description":"401 Unauthorized","schema":{"$ref":"#/definitions/error-response"}},"500":{"description":"Internal Server error","schema":{"$ref":"#/definitions/error-response"}},"default":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error-response"}}}}}},"definitions":{"error-response":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"errors":{"$ref":"#/definitions/error-errors"},"code":{"type":"integer","description":"Error code"},"parameters":{"$ref":"#/definitions/error-parameters"},"trace":{"type":"string","description":"Stack trace"}},"required":["message"]},"error-errors":{"type":"array","description":"Errors list","items":{"$ref":"#/definitions/error-errors-item"}},"error-errors-item":{"type":"object","description":"Error details","properties":{"message":{"type":"string","description":"Error message"},"parameters":{"$ref":"#/definitions/error-parameters"}}},"error-parameters":{"type":"array","description":"Error parameters list","items":{"$ref":"#/definitions/error-parameters-item"}},"error-parameters-item":{"type":"object","description":"Error parameters item","properties":{"resources":{"type":"string","description":"ACL resource"},"fieldName":{"type":"string","description":"Missing or invalid field name"},"fieldValue":{"type":"string","description":"Incorrect field value"}}},"test-module5-v2-entity-all-soap-and-rest":{"type":"object","description":"Some Data Object","properties":{"price":{"type":"integer"}},"required":["price"]}}}' + '{"swagger":"2.0","info":{"version":"","title":""},"host":"magento.host","basePath":"/rest/default","schemes":["http://"],"tags":[{"name":"testModule5AllSoapAndRestV2","description":"AllSoapAndRestInterface"}],"paths":{"/V1/testModule5":{"post":{"tags":["testModule5AllSoapAndRestV2"],"description":"Add new item.","operationId":"' . self::OPERATION_NAME . 'Post","parameters":[{"name":"operationNamePostBody","in":"body","schema":{"required":["item"],"properties":{"item":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"type":"object"}}],"responses":{"200":{"description":"200 Success.","schema":{"$ref":"#/definitions/test-module5-v2-entity-all-soap-and-rest"}},"401":{"description":"401 Unauthorized","schema":{"$ref":"#/definitions/error-response"}},"500":{"description":"Internal Server error","schema":{"$ref":"#/definitions/error-response"}},"default":{"description":"Unexpected error","schema":{"$ref":"#/definitions/error-response"}}}}}},"definitions":{"error-response":{"type":"object","properties":{"message":{"type":"string","description":"Error message"},"errors":{"$ref":"#/definitions/error-errors"},"code":{"type":"integer","description":"Error code"},"parameters":{"$ref":"#/definitions/error-parameters"},"trace":{"type":"string","description":"Stack trace"}},"required":["message"]},"error-errors":{"type":"array","description":"Errors list","items":{"$ref":"#/definitions/error-errors-item"}},"error-errors-item":{"type":"object","description":"Error details","properties":{"message":{"type":"string","description":"Error message"},"parameters":{"$ref":"#/definitions/error-parameters"}}},"error-parameters":{"type":"array","description":"Error parameters list","items":{"$ref":"#/definitions/error-parameters-item"}},"error-parameters-item":{"type":"object","description":"Error parameters item","properties":{"resources":{"type":"string","description":"ACL resource"},"fieldName":{"type":"string","description":"Missing or invalid field name"},"fieldValue":{"type":"string","description":"Incorrect field value"}}},"test-module5-v2-entity-all-soap-and-rest":{"type":"object","description":"Some Data Object","properties":{"price":{"type":"integer"}},"required":["price"]}}}' // @codingStandardsIgnoreEnd ], [ From f2f1d36511e7e249d219c013c8a81b1e1dabb42e Mon Sep 17 00:00:00 2001 From: kweij Date: Fri, 9 Dec 2016 14:34:04 +0100 Subject: [PATCH 0006/1004] Use backend model also for default config values This causes the ```afterLoad()``` method to be invoked, also for default configuration values from ```config.xml``` --- .../Config/Block/System/Config/Form.php | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Config/Block/System/Config/Form.php b/app/code/Magento/Config/Block/System/Config/Form.php index d1a0da2a700a3..05cb57f824013 100644 --- a/app/code/Magento/Config/Block/System/Config/Form.php +++ b/app/code/Magento/Config/Block/System/Config/Form.php @@ -337,22 +337,21 @@ protected function _initElement( if (array_key_exists($path, $this->_configData)) { $data = $this->_configData[$path]; $inherit = false; - - if ($field->hasBackendModel()) { - $backendModel = $field->getBackendModel(); - $backendModel->setPath($path) - ->setValue($data) - ->setWebsite($this->getWebsiteCode()) - ->setStore($this->getStoreCode()) - ->afterLoad(); - $data = $backendModel->getValue(); - } - } elseif ($field->getConfigPath() !== null) { $data = $this->getConfigValue($field->getConfigPath()); } else { $data = $this->getConfigValue($path); } + + if ($field->hasBackendModel()) { + $backendModel = $field->getBackendModel(); + $backendModel->setPath($path) + ->setValue($data) + ->setWebsite($this->getWebsiteCode()) + ->setStore($this->getStoreCode()) + ->afterLoad(); + $data = $backendModel->getValue(); + } } $fieldRendererClass = $field->getFrontendModel(); if ($fieldRendererClass) { From 3309db20fc3845da4a92ca35f63ccfc9b6015905 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Sun, 19 Feb 2017 19:50:31 +0000 Subject: [PATCH 0007/1004] Install ZF 2 mail component --- composer.json | 1 + composer.lock | 110 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 109 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 6f5db49046fd6..ce11abb0210c9 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ "zendframework/zend-validator": "~2.4.6", "zendframework/zend-crypt": "~2.4.6", "zendframework/zend-console": "~2.4.6", + "zendframework/zend-mail": "~2.4.6", "zendframework/zend-modulemanager": "~2.4.6", "zendframework/zend-mvc": "~2.4.6", "zendframework/zend-text": "~2.4.6", diff --git a/composer.lock b/composer.lock index e70cea5bcf431..1e9be321ca43f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "97ab1727a2fea10a0cd95f7adacac54f", - "content-hash": "0e5259f8a96420e846c5413dd07fd4bc", + "hash": "c7dc804fa3caa5766426e1f61ec354dd", + "content-hash": "cc8d47c917e48dfc1d70fe4c8a695631", "packages": [ { "name": "braintree/braintree_php", @@ -2725,6 +2725,62 @@ ], "time": "2015-05-07 14:55:31" }, + { + "name": "zendframework/zend-mail", + "version": "2.4.11", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-mail.git", + "reference": "c1c73d7f44b3e815e955cd59b822954ca7a92a77" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-mail/zipball/c1c73d7f44b3e815e955cd59b822954ca7a92a77", + "reference": "c1c73d7f44b3e815e955cd59b822954ca7a92a77", + "shasum": "" + }, + "require": { + "php": ">=5.3.23", + "zendframework/zend-crypt": "~2.4.0", + "zendframework/zend-loader": "~2.4.0", + "zendframework/zend-mime": "~2.4.0", + "zendframework/zend-stdlib": "~2.4.0", + "zendframework/zend-validator": "~2.4.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", + "zendframework/zend-config": "~2.4.0", + "zendframework/zend-servicemanager": "~2.4.0" + }, + "suggest": { + "zendframework/zend-servicemanager": "Zend\\ServiceManager component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev", + "dev-develop": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Mail\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides generalized functionality to compose and send both text and MIME-compliant multipart e-mail messages", + "homepage": "https://github.com/zendframework/zend-mail", + "keywords": [ + "mail", + "zf2" + ], + "time": "2016-12-19 22:35:29" + }, { "name": "zendframework/zend-math", "version": "2.4.11", @@ -2776,6 +2832,56 @@ ], "time": "2015-05-07 14:55:31" }, + { + "name": "zendframework/zend-mime", + "version": "2.4.11", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-mime.git", + "reference": "df81ca9f94f0d1cd31175b8d2df6002b61dd5973" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-mime/zipball/df81ca9f94f0d1cd31175b8d2df6002b61dd5973", + "reference": "df81ca9f94f0d1cd31175b8d2df6002b61dd5973", + "shasum": "" + }, + "require": { + "php": ">=5.3.23", + "zendframework/zend-stdlib": "self.version" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", + "zendframework/zend-mail": "self.version" + }, + "suggest": { + "zendframework/zend-mail": "Zend\\Mail component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev", + "dev-develop": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Mime\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-mime", + "keywords": [ + "mime", + "zf2" + ], + "time": "2015-05-07 16:53:42" + }, { "name": "zendframework/zend-modulemanager", "version": "2.4.11", From 584a17afff88e93056c789a96928540de73742c4 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Sun, 19 Feb 2017 21:43:16 +0000 Subject: [PATCH 0008/1004] Replace ZF1 Zend_Mail with ZF2 Zend\Mail --- .../Magento/Framework/Mail/Message.php | 45 ++++++++++--------- .../Mail/Test/Unit/TransportTest.php | 2 +- .../Magento/Framework/Mail/Transport.php | 7 +-- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/lib/internal/Magento/Framework/Mail/Message.php b/lib/internal/Magento/Framework/Mail/Message.php index 36a0e6a5cbc61..c212ad58e7366 100644 --- a/lib/internal/Magento/Framework/Mail/Message.php +++ b/lib/internal/Magento/Framework/Mail/Message.php @@ -7,14 +7,17 @@ */ namespace Magento\Framework\Mail; -class Message extends \Zend_Mail implements MessageInterface +use Zend\Mime\Mime; +use Zend\Mime\Part; + +class Message extends \Zend\Mail\Message implements MessageInterface { /** * @param string $charset */ public function __construct($charset = 'utf-8') { - parent::__construct($charset); + parent::setEncoding($charset); } /** @@ -24,25 +27,14 @@ public function __construct($charset = 'utf-8') */ protected $messageType = self::TYPE_TEXT; - /** - * Set message body - * - * @param string $body - * @return $this - */ - public function setBody($body) + private function htmlMimeFromString($htmlBody) { - return $this->messageType == self::TYPE_TEXT ? $this->setBodyText($body) : $this->setBodyHtml($body); - } - - /** - * Set message body - * - * @return string - */ - public function getBody() - { - return $this->messageType == self::TYPE_TEXT ? $this->getBodyText() : $this->getBodyHtml(); + $htmlPart = new Part($htmlBody); + $htmlPart->setCharset($this->getEncoding()); + $htmlPart->setType(Mime::TYPE_HTML); + $mimeMessage = new \Zend\Mime\Message(); + $mimeMessage->addPart($htmlPart); + return $mimeMessage; } /** @@ -56,4 +48,17 @@ public function setMessageType($type) $this->messageType = $type; return $this; } + + /** + * @param null|object|string|\Zend\Mime\Message $body + * @return \Zend\Mail\Message + */ + public function setBody($body) + { + if (is_string($body) && $this->messageType === MessageInterface::TYPE_HTML) { + $body = self::htmlMimeFromString($body); + } + return parent::setBody($body); + } + } diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php index 685920217d0b9..2562b29c8831e 100644 --- a/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php +++ b/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php @@ -25,7 +25,7 @@ protected function setUp() /** * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The message should be an instance of \Zend_Mail + * @expectedExceptionMessage The message should be an instance of \Zend\Mail\Message */ public function testTransportWithIncorrectMessageObject() { diff --git a/lib/internal/Magento/Framework/Mail/Transport.php b/lib/internal/Magento/Framework/Mail/Transport.php index b331032cabb73..e8890ed2f94d4 100644 --- a/lib/internal/Magento/Framework/Mail/Transport.php +++ b/lib/internal/Magento/Framework/Mail/Transport.php @@ -6,7 +6,8 @@ */ namespace Magento\Framework\Mail; -class Transport extends \Zend_Mail_Transport_Sendmail implements \Magento\Framework\Mail\TransportInterface + +class Transport extends \Zend\Mail\Transport\Sendmail implements \Magento\Framework\Mail\TransportInterface { /** * @var \Magento\Framework\Mail\MessageInterface @@ -20,8 +21,8 @@ class Transport extends \Zend_Mail_Transport_Sendmail implements \Magento\Framew */ public function __construct(\Magento\Framework\Mail\MessageInterface $message, $parameters = null) { - if (!$message instanceof \Zend_Mail) { - throw new \InvalidArgumentException('The message should be an instance of \Zend_Mail'); + if (!$message instanceof \Zend\Mail\Message) { + throw new \InvalidArgumentException('The message should be an instance of \Zend\Mail\Message'); } parent::__construct($parameters); $this->_message = $message; From ca1a3b2379ee911cb25137c60167f0e1f62e201b Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Sun, 19 Feb 2017 21:44:02 +0000 Subject: [PATCH 0009/1004] Remove unused variable --- app/code/Magento/Newsletter/Model/Template.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/code/Magento/Newsletter/Model/Template.php b/app/code/Magento/Newsletter/Model/Template.php index f13d8c3e4fe14..b2b3ce85a9894 100644 --- a/app/code/Magento/Newsletter/Model/Template.php +++ b/app/code/Magento/Newsletter/Model/Template.php @@ -36,12 +36,6 @@ */ class Template extends \Magento\Email\Model\AbstractTemplate { - /** - * Mail object - * - * @var \Zend_Mail - */ - protected $_mail; /** * Store manager to emulate design From d1be154b13095eb967ba6356d3eff2984e920801 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Sun, 19 Feb 2017 22:55:07 +0000 Subject: [PATCH 0010/1004] Update unit tests for ZF 2 mail --- .../Magento/Framework/Mail/Message.php | 33 ++++++++++++------- .../Framework/Mail/Test/Unit/MessageTest.php | 1 + .../Unit/Template/TransportBuilderTest.php | 2 ++ .../Mail/Test/Unit/TransportTest.php | 33 ++++++------------- 4 files changed, 35 insertions(+), 34 deletions(-) diff --git a/lib/internal/Magento/Framework/Mail/Message.php b/lib/internal/Magento/Framework/Mail/Message.php index c212ad58e7366..cb485815c3cfb 100644 --- a/lib/internal/Magento/Framework/Mail/Message.php +++ b/lib/internal/Magento/Framework/Mail/Message.php @@ -10,14 +10,22 @@ use Zend\Mime\Mime; use Zend\Mime\Part; +/** + * @todo composition instead of inheritance for better testability + * - add a ZendMailDecorator interface with getZendMail() method for usage in \Magento\Framework\Mail\Transport + * @todo get rid of temporal coupling (setMessageType() + setBody()) + * - deprecate setMessageType(), implement a HtmlMessage decorator instead + * - change usage in \Magento\Framework\Mail\Template\TransportBuilder::prepareMessage() + */ class Message extends \Zend\Mail\Message implements MessageInterface { + /** * @param string $charset */ public function __construct($charset = 'utf-8') { - parent::setEncoding($charset); + $this->encoding = $charset; } /** @@ -27,16 +35,6 @@ public function __construct($charset = 'utf-8') */ protected $messageType = self::TYPE_TEXT; - private function htmlMimeFromString($htmlBody) - { - $htmlPart = new Part($htmlBody); - $htmlPart->setCharset($this->getEncoding()); - $htmlPart->setType(Mime::TYPE_HTML); - $mimeMessage = new \Zend\Mime\Message(); - $mimeMessage->addPart($htmlPart); - return $mimeMessage; - } - /** * Set message type * @@ -61,4 +59,17 @@ public function setBody($body) return parent::setBody($body); } + /** + * @param string $htmlBody + * @return \Zend\Mime\Message + */ + private function htmlMimeFromString($htmlBody) + { + $htmlPart = new Part($htmlBody); + $htmlPart->setCharset($this->getEncoding()); + $htmlPart->setType(Mime::TYPE_HTML); + $mimeMessage = new \Zend\Mime\Message(); + $mimeMessage->addPart($htmlPart); + return $mimeMessage; + } } diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/MessageTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/MessageTest.php index 80e0709165d39..fd3ff4223fa11 100644 --- a/lib/internal/Magento/Framework/Mail/Test/Unit/MessageTest.php +++ b/lib/internal/Magento/Framework/Mail/Test/Unit/MessageTest.php @@ -14,6 +14,7 @@ class MessageTest extends \PHPUnit_Framework_TestCase protected function setUp() { + $this->markTestSkipped('obsolete ZF 1 test'); $this->_messageMock = $this->getMock( \Magento\Framework\Mail\Message::class, ['getBodyText', 'getBodyHtml', 'setBodyText', 'setBodyHtml'] diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php index 548359180a538..fafbad24331fe 100644 --- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php +++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php @@ -7,6 +7,7 @@ use Magento\Framework\App\TemplateTypesInterface; use Magento\Framework\Mail\MessageInterface; +use Zend\Mail\Headers; class TransportBuilderTest extends \PHPUnit_Framework_TestCase { @@ -53,6 +54,7 @@ protected function setUp() $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->templateFactoryMock = $this->getMock(\Magento\Framework\Mail\Template\FactoryInterface::class); $this->messageMock = $this->getMock(\Magento\Framework\Mail\Message::class); + $this->messageMock->method('getHeaders')->willReturn(new Headers()); $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); $this->senderResolverMock = $this->getMock(\Magento\Framework\Mail\Template\SenderResolverInterface::class); $this->mailTransportFactoryMock = $this->getMockBuilder( diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php index 2562b29c8831e..d7336e4be478e 100644 --- a/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php +++ b/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php @@ -5,45 +5,32 @@ */ namespace Magento\Framework\Mail\Test\Unit; +use Zend\Mail\Headers; + class TransportTest extends \PHPUnit_Framework_TestCase { - /** - * @var \PHPUnit_Framework_MockObject - */ - protected $_messageMock; - - /** - * @var \Magento\Framework\Mail\Transport - */ - protected $_transport; - - protected function setUp() - { - $this->_messageMock = $this->getMock(\Magento\Framework\Mail\Message::class, [], [], '', false); - $this->_transport = new \Magento\Framework\Mail\Transport($this->_messageMock); - } - /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage The message should be an instance of \Zend\Mail\Message */ public function testTransportWithIncorrectMessageObject() { - $this->_messageMock = $this->getMock(\Magento\Framework\Mail\MessageInterface::class); - $this->_transport = new \Magento\Framework\Mail\Transport($this->_messageMock); + new \Magento\Framework\Mail\Transport( + $this->getMock(\Magento\Framework\Mail\MessageInterface::class) + ); } /** * @covers \Magento\Framework\Mail\Transport::sendMessage * @expectedException \Magento\Framework\Exception\MailException - * @expectedExceptionMessage No body specified + * @expectedExceptionMessage Invalid email; contains no "To" header */ public function testSendMessageBrokenMessage() { - $this->_messageMock->expects($this->any()) - ->method('getParts') - ->will($this->returnValue(['a', 'b'])); + $transport = new \Magento\Framework\Mail\Transport( + new \Magento\Framework\Mail\Message() + ); - $this->_transport->sendMessage(); + $transport->sendMessage(); } } From c1d8e0db2f6f136910da9ce0eb6515fde7180eed Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Sat, 18 Mar 2017 23:25:38 +0000 Subject: [PATCH 0011/1004] Remove zend mail inheritance --- .../Newsletter/Model/SubscriberTest.php | 5 +- .../Magento/ProductAlert/Model/EmailTest.php | 2 +- .../ProductAlert/Model/ObserverTest.php | 2 +- .../Magento/Framework/Mail/Message.php | 80 ++++++++++++++++--- .../Framework/Mail/MessageInterface.php | 7 ++ .../Magento/Framework/Mail/Transport.php | 17 ++-- 6 files changed, 92 insertions(+), 21 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php index 1754c243e8ba0..b1f5b8af915b7 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php @@ -6,6 +6,8 @@ namespace Magento\Newsletter\Model; +use Magento\TestFramework\Mail\Template\TransportBuilderMock; + class SubscriberTest extends \PHPUnit_Framework_TestCase { /** @@ -27,13 +29,14 @@ protected function setUp() public function testEmailConfirmation() { $this->_model->subscribe('customer_confirm@example.com'); + /** @var TransportBuilderMock $transportBuilder */ $transportBuilder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get(\Magento\TestFramework\Mail\Template\TransportBuilderMock::class); // confirmationCode 'ysayquyajua23iq29gxwu2eax2qb6gvy' is taken from fixture $this->assertContains( '/newsletter/subscriber/confirm/id/' . $this->_model->getSubscriberId() . '/code/ysayquyajua23iq29gxwu2eax2qb6gvy', - $transportBuilder->getSentMessage()->getBodyHtml()->getRawContent() + $transportBuilder->getSentMessage()->getRawMessage() ); $this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->_model->getSubscriberStatus()); } diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php index 367080334813b..9a817a463beda 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/EmailTest.php @@ -82,7 +82,7 @@ public function testSend($isCustomerIdUsed) ); $this->assertContains( 'John Smith,', - $transportBuilder->getSentMessage()->getBodyHtml()->getRawContent() + $transportBuilder->getSentMessage()->getRawMessage() ); } diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php index c4f18ff806d38..3531f21715ffd 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Model/ObserverTest.php @@ -56,7 +56,7 @@ public function testProcess() ); $this->assertContains( 'John Smith,', - $transportBuilder->getSentMessage()->getBodyHtml()->getRawContent() + $transportBuilder->getSentMessage()->getRawMessage() ); } } diff --git a/lib/internal/Magento/Framework/Mail/Message.php b/lib/internal/Magento/Framework/Mail/Message.php index cb485815c3cfb..e8e66ff988952 100644 --- a/lib/internal/Magento/Framework/Mail/Message.php +++ b/lib/internal/Magento/Framework/Mail/Message.php @@ -11,21 +11,25 @@ use Zend\Mime\Part; /** - * @todo composition instead of inheritance for better testability - * - add a ZendMailDecorator interface with getZendMail() method for usage in \Magento\Framework\Mail\Transport * @todo get rid of temporal coupling (setMessageType() + setBody()) - * - deprecate setMessageType(), implement a HtmlMessage decorator instead + * - deprecate setMessageType(), setBody() and getBody() + * - implement setBodyHtml(), setBodyText(), getBodyHtml() and getBodyText() * - change usage in \Magento\Framework\Mail\Template\TransportBuilder::prepareMessage() */ -class Message extends \Zend\Mail\Message implements MessageInterface +class Message implements MessageInterface { + /** + * @var \Zend\Mail\Message + */ + private $zendMessage; /** - * @param string $charset + * @param string $encoding */ - public function __construct($charset = 'utf-8') + public function __construct($encoding = 'utf-8') { - $this->encoding = $charset; + $this->zendMessage = new \Zend\Mail\Message; + $this->zendMessage->setEncoding($encoding); } /** @@ -49,24 +53,76 @@ public function setMessageType($type) /** * @param null|object|string|\Zend\Mime\Message $body - * @return \Zend\Mail\Message + * @return $this */ public function setBody($body) { if (is_string($body) && $this->messageType === MessageInterface::TYPE_HTML) { - $body = self::htmlMimeFromString($body); + $body = self::createHtmlMimeFromString($body); } - return parent::setBody($body); + $this->zendMessage->setBody($body); + return $this; + } + + public function setSubject($subject) + { + $this->zendMessage->setSubject($subject); + return $this; + } + + public function getSubject() + { + return $this->zendMessage->getSubject(); + } + + public function getBody() + { + return $this->zendMessage->getBody(); + } + + public function setFrom($fromAddress) + { + $this->zendMessage->setFrom($fromAddress); + return $this; + } + + public function addTo($toAddress) + { + $this->zendMessage->addTo($toAddress); + return $this; + } + + public function addCc($ccAddress) + { + $this->zendMessage->addCc($ccAddress); + return $this; + } + + public function addBcc($bccAddress) + { + $this->zendMessage->addBcc($bccAddress); + return $this; + } + + public function setReplyTo($replyToAddress) + { + $this->zendMessage->setReplyTo($replyToAddress); + return $this; + } + + public function getRawMessage() + { + return $this->zendMessage->toString(); } /** * @param string $htmlBody * @return \Zend\Mime\Message */ - private function htmlMimeFromString($htmlBody) + private function createHtmlMimeFromString($htmlBody) { $htmlPart = new Part($htmlBody); - $htmlPart->setCharset($this->getEncoding()); + $htmlPart->setCharset($this->zendMessage->getEncoding()); $htmlPart->setType(Mime::TYPE_HTML); $mimeMessage = new \Zend\Mime\Message(); $mimeMessage->addPart($htmlPart); diff --git a/lib/internal/Magento/Framework/Mail/MessageInterface.php b/lib/internal/Magento/Framework/Mail/MessageInterface.php index 4b068cf0e737a..ca6877e6526b2 100644 --- a/lib/internal/Magento/Framework/Mail/MessageInterface.php +++ b/lib/internal/Magento/Framework/Mail/MessageInterface.php @@ -96,4 +96,11 @@ public function setReplyTo($replyToAddress); * @return $this */ public function setMessageType($type); + + /** + * Get message source code + * + * @return string + */ + public function getRawMessage(); } diff --git a/lib/internal/Magento/Framework/Mail/Transport.php b/lib/internal/Magento/Framework/Mail/Transport.php index e8890ed2f94d4..e68513f337bec 100644 --- a/lib/internal/Magento/Framework/Mail/Transport.php +++ b/lib/internal/Magento/Framework/Mail/Transport.php @@ -6,9 +6,15 @@ */ namespace Magento\Framework\Mail; +use Zend\Mail\Message; +use Zend\Mail\Transport\Sendmail; -class Transport extends \Zend\Mail\Transport\Sendmail implements \Magento\Framework\Mail\TransportInterface +class Transport implements \Magento\Framework\Mail\TransportInterface { + /** + * @var Sendmail + */ + private $zendTransport; /** * @var \Magento\Framework\Mail\MessageInterface */ @@ -21,10 +27,7 @@ class Transport extends \Zend\Mail\Transport\Sendmail implements \Magento\Framew */ public function __construct(\Magento\Framework\Mail\MessageInterface $message, $parameters = null) { - if (!$message instanceof \Zend\Mail\Message) { - throw new \InvalidArgumentException('The message should be an instance of \Zend\Mail\Message'); - } - parent::__construct($parameters); + $this->zendTransport = new Sendmail($parameters); $this->_message = $message; } @@ -37,7 +40,9 @@ public function __construct(\Magento\Framework\Mail\MessageInterface $message, $ public function sendMessage() { try { - parent::send($this->_message); + $this->zendTransport->send( + Message::fromString($this->_message->getRawMessage()) + ); } catch (\Exception $e) { throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e); } From 0be511c2862fc463d6f09aa353096f3e993ce227 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Sun, 19 Mar 2017 00:26:00 +0000 Subject: [PATCH 0012/1004] Remove conflicting class imports --- lib/internal/Magento/Framework/Mail/Transport.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Mail/Transport.php b/lib/internal/Magento/Framework/Mail/Transport.php index e68513f337bec..be54b8e5ad1f1 100644 --- a/lib/internal/Magento/Framework/Mail/Transport.php +++ b/lib/internal/Magento/Framework/Mail/Transport.php @@ -6,13 +6,10 @@ */ namespace Magento\Framework\Mail; -use Zend\Mail\Message; -use Zend\Mail\Transport\Sendmail; - class Transport implements \Magento\Framework\Mail\TransportInterface { /** - * @var Sendmail + * @var \Zend\Mail\Transport\Sendmail */ private $zendTransport; /** @@ -27,7 +24,7 @@ class Transport implements \Magento\Framework\Mail\TransportInterface */ public function __construct(\Magento\Framework\Mail\MessageInterface $message, $parameters = null) { - $this->zendTransport = new Sendmail($parameters); + $this->zendTransport = new \Zend\Mail\Transport\Sendmail($parameters); $this->_message = $message; } @@ -41,7 +38,7 @@ public function sendMessage() { try { $this->zendTransport->send( - Message::fromString($this->_message->getRawMessage()) + \Zend\Mail\Message::fromString($this->_message->getRawMessage()) ); } catch (\Exception $e) { throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e); From 00bc4177c79c06e277d61a0129d5626bb433e79c Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Sun, 19 Mar 2017 00:33:21 +0000 Subject: [PATCH 0013/1004] Fix integration test and code style issues --- .../Magento/Wishlist/Controller/IndexTest.php | 2 +- .../Magento/Framework/Mail/Message.php | 33 +++++++++++++++++++ .../Unit/Template/TransportBuilderTest.php | 2 -- .../Magento/Framework/Mail/Transport.php | 7 ++-- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php index cbc933d509642..2892c4114f84d 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php @@ -158,7 +158,7 @@ public function testSendAction() ); $actualResult = \Zend_Mime_Decode::decodeQuotedPrintable( - $transportBuilder->getSentMessage()->getBodyHtml()->getContent() + $transportBuilder->getSentMessage()->getRawMessage() ); $this->assertStringMatchesFormat( diff --git a/lib/internal/Magento/Framework/Mail/Message.php b/lib/internal/Magento/Framework/Mail/Message.php index e8e66ff988952..207945813dad1 100644 --- a/lib/internal/Magento/Framework/Mail/Message.php +++ b/lib/internal/Magento/Framework/Mail/Message.php @@ -64,52 +64,85 @@ public function setBody($body) return $this; } + /** + * @param string $subject + * @return $this + */ public function setSubject($subject) { $this->zendMessage->setSubject($subject); return $this; } + /** + * @return null|string + */ public function getSubject() { return $this->zendMessage->getSubject(); } + /** + * @return object + */ public function getBody() { return $this->zendMessage->getBody(); } + /** + * @param array|string $fromAddress + * @return $this + */ public function setFrom($fromAddress) { $this->zendMessage->setFrom($fromAddress); return $this; } + /** + * @param array|string $toAddress + * @return $this + */ public function addTo($toAddress) { $this->zendMessage->addTo($toAddress); return $this; } + /** + * @param array|string $ccAddress + * @return $this + */ public function addCc($ccAddress) { $this->zendMessage->addCc($ccAddress); return $this; } + /** + * @param array|string $bccAddress + * @return $this + */ public function addBcc($bccAddress) { $this->zendMessage->addBcc($bccAddress); return $this; } + /** + * @param array|string $replyToAddress + * @return $this + */ public function setReplyTo($replyToAddress) { $this->zendMessage->setReplyTo($replyToAddress); return $this; } + /** + * @return string + */ public function getRawMessage() { return $this->zendMessage->toString(); diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php index fafbad24331fe..548359180a538 100644 --- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php +++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php @@ -7,7 +7,6 @@ use Magento\Framework\App\TemplateTypesInterface; use Magento\Framework\Mail\MessageInterface; -use Zend\Mail\Headers; class TransportBuilderTest extends \PHPUnit_Framework_TestCase { @@ -54,7 +53,6 @@ protected function setUp() $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->templateFactoryMock = $this->getMock(\Magento\Framework\Mail\Template\FactoryInterface::class); $this->messageMock = $this->getMock(\Magento\Framework\Mail\Message::class); - $this->messageMock->method('getHeaders')->willReturn(new Headers()); $this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class); $this->senderResolverMock = $this->getMock(\Magento\Framework\Mail\Template\SenderResolverInterface::class); $this->mailTransportFactoryMock = $this->getMockBuilder( diff --git a/lib/internal/Magento/Framework/Mail/Transport.php b/lib/internal/Magento/Framework/Mail/Transport.php index be54b8e5ad1f1..96dd5f9c741a9 100644 --- a/lib/internal/Magento/Framework/Mail/Transport.php +++ b/lib/internal/Magento/Framework/Mail/Transport.php @@ -12,10 +12,11 @@ class Transport implements \Magento\Framework\Mail\TransportInterface * @var \Zend\Mail\Transport\Sendmail */ private $zendTransport; + /** * @var \Magento\Framework\Mail\MessageInterface */ - protected $_message; + private $message; /** * @param MessageInterface $message @@ -25,7 +26,7 @@ class Transport implements \Magento\Framework\Mail\TransportInterface public function __construct(\Magento\Framework\Mail\MessageInterface $message, $parameters = null) { $this->zendTransport = new \Zend\Mail\Transport\Sendmail($parameters); - $this->_message = $message; + $this->message = $message; } /** @@ -38,7 +39,7 @@ public function sendMessage() { try { $this->zendTransport->send( - \Zend\Mail\Message::fromString($this->_message->getRawMessage()) + \Zend\Mail\Message::fromString($this->message->getRawMessage()) ); } catch (\Exception $e) { throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e); From e02e28d10385bb6a34b74295430fa48a2f63fe84 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Sun, 19 Mar 2017 00:45:44 +0000 Subject: [PATCH 0014/1004] Remove redundant unit test The transport now can take any implementation of the message interface as argument --- .../Framework/Mail/Test/Unit/TransportTest.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php index d7336e4be478e..02a54142c957d 100644 --- a/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php +++ b/lib/internal/Magento/Framework/Mail/Test/Unit/TransportTest.php @@ -5,21 +5,8 @@ */ namespace Magento\Framework\Mail\Test\Unit; -use Zend\Mail\Headers; - class TransportTest extends \PHPUnit_Framework_TestCase { - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The message should be an instance of \Zend\Mail\Message - */ - public function testTransportWithIncorrectMessageObject() - { - new \Magento\Framework\Mail\Transport( - $this->getMock(\Magento\Framework\Mail\MessageInterface::class) - ); - } - /** * @covers \Magento\Framework\Mail\Transport::sendMessage * @expectedException \Magento\Framework\Exception\MailException From eb1fa975475bc450035936cc8ff55150f0a352e3 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Thu, 23 Mar 2017 09:59:51 +0000 Subject: [PATCH 0015/1004] Remove unused attribute Kept in constructor for backwards compatibility --- app/code/Magento/SampleData/Model/Dependency.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index 611f69e0babc1..d4f653d39e462 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -26,11 +26,6 @@ class Dependency */ protected $composerInformation; - /** - * @var Filesystem - */ - private $filesystem; - /** * @var PackageFactory */ @@ -54,7 +49,6 @@ public function __construct( ComponentRegistrar $componentRegistrar ) { $this->composerInformation = $composerInformation; - $this->filesystem = $filesystem; $this->packageFactory = $packageFactory; $this->componentRegistrar = $componentRegistrar; } From 479a443df80985a5052395fd7ff477f32bef50ca Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Thu, 23 Mar 2017 10:07:59 +0000 Subject: [PATCH 0016/1004] Change type hint to interface --- app/code/Magento/SampleData/Model/Dependency.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index d4f653d39e462..9c5c89154ee11 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -6,10 +6,11 @@ namespace Magento\SampleData\Model; use Magento\Framework\Component\ComponentRegistrar; +use Magento\Framework\Component\ComponentRegistrarInterface; use Magento\Framework\Composer\ComposerInformation; -use Magento\Framework\Filesystem; use Magento\Framework\Config\Composer\Package; use Magento\Framework\Config\Composer\PackageFactory; +use Magento\Framework\Filesystem; /** * Sample Data dependency @@ -32,7 +33,7 @@ class Dependency private $packageFactory; /** - * @var ComponentRegistrar + * @var ComponentRegistrarInterface */ private $componentRegistrar; @@ -40,13 +41,13 @@ class Dependency * @param ComposerInformation $composerInformation * @param Filesystem $filesystem * @param PackageFactory $packageFactory - * @param ComponentRegistrar $componentRegistrar + * @param ComponentRegistrarInterface $componentRegistrar */ public function __construct( ComposerInformation $composerInformation, Filesystem $filesystem, PackageFactory $packageFactory, - ComponentRegistrar $componentRegistrar + ComponentRegistrarInterface $componentRegistrar ) { $this->composerInformation = $composerInformation; $this->packageFactory = $packageFactory; From 9768fc614f070bb7a43713f67f01d13d3013d2f7 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Thu, 23 Mar 2017 11:59:24 +0000 Subject: [PATCH 0017/1004] Add unit test for Magento\SampleData\Model\Dependency --- .../Magento/SampleData/Model/Dependency.php | 29 +++- .../Test/Unit/Model/DependencyTest.php | 147 ++++++++++++++++++ 2 files changed, 168 insertions(+), 8 deletions(-) create mode 100644 app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index 9c5c89154ee11..dc6277acdbb93 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -5,6 +5,7 @@ */ namespace Magento\SampleData\Model; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Component\ComponentRegistrar; use Magento\Framework\Component\ComponentRegistrarInterface; use Magento\Framework\Composer\ComposerInformation; @@ -37,6 +38,11 @@ class Dependency */ private $componentRegistrar; + /** + * @var Filesystem\Directory\ReadInterfaceFactory + */ + private $directoryReadFactory; + /** * @param ComposerInformation $composerInformation * @param Filesystem $filesystem @@ -47,11 +53,16 @@ public function __construct( ComposerInformation $composerInformation, Filesystem $filesystem, PackageFactory $packageFactory, - ComponentRegistrarInterface $componentRegistrar + ComponentRegistrarInterface $componentRegistrar, + \Magento\Framework\Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory = null ) { $this->composerInformation = $composerInformation; $this->packageFactory = $packageFactory; $this->componentRegistrar = $componentRegistrar; + if ($directoryReadFactory === null) { + $directoryReadFactory = ObjectManager::getInstance()->get(Filesystem\Directory\ReadInterfaceFactory::class); + } + $this->directoryReadFactory = $directoryReadFactory; } /** @@ -81,14 +92,15 @@ protected function getSuggestsFromModules() { $suggests = []; foreach ($this->componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $moduleDir) { - $file = $moduleDir . '/composer.json'; - - if (!file_exists($file) || !is_readable($file)) { + /** @var Filesystem\Directory\ReadInterface $directory */ + $directory = $this->directoryReadFactory->create(['path' => $moduleDir]); + echo "path=$moduleDir\n"; + if (!$directory->isExist('composer.json') || !$directory->isReadable('composer.json')) { continue; } /** @var Package $package */ - $package = $this->getModuleComposerPackage($file); + $package = $this->getModuleComposerPackage($directory); $suggest = json_decode(json_encode($package->get('suggest')), true); if (!empty($suggest)) { $suggests += $suggest; @@ -100,11 +112,12 @@ protected function getSuggestsFromModules() /** * Load package * - * @param string $file + * @param Filesystem\Directory\ReadInterface $directory * @return Package + * @throws \Magento\Framework\Exception\FileSystemException */ - protected function getModuleComposerPackage($file) + protected function getModuleComposerPackage(Filesystem\Directory\ReadInterface $directory) { - return $this->packageFactory->create(['json' => json_decode(file_get_contents($file))]); + return $this->packageFactory->create(['json' => json_decode($directory->readFile('composer.json'))]); } } diff --git a/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php new file mode 100644 index 0000000000000..75c69a598580d --- /dev/null +++ b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php @@ -0,0 +1,147 @@ +getMockBuilder(ComposerInformation::class) + ->disableOriginalConstructor() + ->getMock(); + $composerInformation->method('getSuggestedPackages') + ->willReturn($suggestionsFromLockFile); + + /** @var Filesystem|\PHPUnit_Framework_MockObject_MockObject $filesystem */ + $filesystem = $this->getMockBuilder(Filesystem::class)->disableOriginalConstructor()->getMock(); + + /** @var PackageFactory|\PHPUnit_Framework_MockObject_MockObject $packageFactory */ + $packageFactory = $this->getMockBuilder(PackageFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $packageFactory->method('create') + ->willReturnCallback(function($args) { + return new Package($args['json']); + }); + + /** @var ComponentRegistrarInterface|\PHPUnit_Framework_MockObject_MockObject $componentRegistrar */ + $componentRegistrar = $this->getMockBuilder(ComponentRegistrarInterface::class) + ->getMockForAbstractClass(); + $componentRegistrar->method('getPaths') + ->with(ComponentRegistrar::MODULE) + ->willReturn( + $moduleDirectories + ); + + $directoryReadFactory = $this->getMockBuilder(Filesystem\Directory\ReadInterfaceFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $directoryReadFactory->method('create') + ->willReturnMap($composerJsonGenerator($this)); + + $dependency = new Dependency( + $composerInformation, + $filesystem, + $packageFactory, + $componentRegistrar, + $directoryReadFactory + ); + $this->assertEquals($expectedPackages, $dependency->getSampleDataPackages()); + } + public static function dataPackagesFromComposerSuggest() + { + return [ + [ + 'moduleDirectories' => [ + 'app/code/LocalModule', + 'app/code/LocalModuleWithoutComposerJson', + 'vendor/company/module', + ], + 'composerJsonGenerator' => function(DependencyTest $test) { + return [ + [ + ['path' => 'app/code/LocalModule'], + $test->stubComposerJsonReader( + ['name' => 'local/module', 'suggest' => ['local/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '0.1.0']] + ) + ], + [ + ['path' => 'app/code/LocalModuleWithoutComposerJson'], + $test->stubFileNotFoundReader() + ], + [ + ['path' => 'vendor/company/module'], + $test->stubComposerJsonReader( + ['name' => 'company/module', 'suggest' => ['company/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '1.0.0-beta']] + ) + ], + ]; + }, + 'suggestions' => [ + 'magento/foo-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '100.0.0', + 'thirdparty/bar-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '1.2.3', + 'thirdparty/something-else' => 'Just a suggested package', + ], + 'expectedPackages' => [ + 'magento/foo-sample-data' => '100.0.0', + 'thirdparty/bar-sample-data' => '1.2.3', + 'local/module-sample-data' => '0.1.0', + 'company/module-sample-data' => '1.0.0-beta', + ] + ] + ]; + } + + public function stubComposerJsonReader(array $composerJsonContent) + { + $stub = $this->getMockBuilder(Filesystem\Directory\ReadInterface::class) + ->getMockForAbstractClass(); + $stub->method('isExist') + ->with('composer.json') + ->willReturn(true); + $stub->method('isReadable') + ->with('composer.json') + ->willReturn(true); + $stub->method('readFile') + ->with('composer.json') + ->willReturn(json_encode($composerJsonContent)); + return $stub; + } + + public function stubFileNotFoundReader() + { + $stub = $this->getMockBuilder(Filesystem\Directory\ReadInterface::class) + ->getMockForAbstractClass(); + $stub->method('isExist') + ->with('composer.json') + ->willReturn(false); + $stub->method('readFile') + ->with('composer.json') + ->willThrowException(new FileSystemException(new Phrase('File not found'))); + return $stub; + } +} + From 29bc089e79ac40c822611b195b6008601eecde6a Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Thu, 23 Mar 2017 12:27:12 +0000 Subject: [PATCH 0018/1004] Look for composer.json in parent of registered module directory for sample data suggestions This allows modules to follow the pds/skeleton standard and have their source code in a 'src' subdirectory of the repository --- .../Magento/SampleData/Model/Dependency.php | 36 ++++++++++++------- .../Test/Unit/Model/DependencyTest.php | 24 +++++++++++++ 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index dc6277acdbb93..7d665ed7e5a2e 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -48,13 +48,15 @@ class Dependency * @param Filesystem $filesystem * @param PackageFactory $packageFactory * @param ComponentRegistrarInterface $componentRegistrar + * @param Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory + * @throws \RuntimeException */ public function __construct( ComposerInformation $composerInformation, Filesystem $filesystem, PackageFactory $packageFactory, ComponentRegistrarInterface $componentRegistrar, - \Magento\Framework\Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory = null + Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory = null ) { $this->composerInformation = $composerInformation; $this->packageFactory = $packageFactory; @@ -69,6 +71,7 @@ public function __construct( * Retrieve list of sample data packages from suggests * * @return array + * @throws \Magento\Framework\Exception\FileSystemException */ public function getSampleDataPackages() { @@ -87,20 +90,13 @@ public function getSampleDataPackages() * Retrieve suggested sample data packages from modules composer.json * * @return array + * @throws \Magento\Framework\Exception\FileSystemException */ protected function getSuggestsFromModules() { $suggests = []; foreach ($this->componentRegistrar->getPaths(ComponentRegistrar::MODULE) as $moduleDir) { - /** @var Filesystem\Directory\ReadInterface $directory */ - $directory = $this->directoryReadFactory->create(['path' => $moduleDir]); - echo "path=$moduleDir\n"; - if (!$directory->isExist('composer.json') || !$directory->isReadable('composer.json')) { - continue; - } - - /** @var Package $package */ - $package = $this->getModuleComposerPackage($directory); + $package = $this->getModuleComposerPackage($moduleDir); $suggest = json_decode(json_encode($package->get('suggest')), true); if (!empty($suggest)) { $suggests += $suggest; @@ -112,12 +108,26 @@ protected function getSuggestsFromModules() /** * Load package * - * @param Filesystem\Directory\ReadInterface $directory + * @param string $moduleDir * @return Package * @throws \Magento\Framework\Exception\FileSystemException */ - protected function getModuleComposerPackage(Filesystem\Directory\ReadInterface $directory) + private function getModuleComposerPackage($moduleDir): Package { - return $this->packageFactory->create(['json' => json_decode($directory->readFile('composer.json'))]); + /* + * Also look in parent directory of registered module directory to allow modules to follow the pds/skeleton + * standard and have their source code in a "src" subdirectory of the repository + * + * see: https://github.com/php-pds/skeleton + */ + foreach ([$moduleDir, $moduleDir . DIRECTORY_SEPARATOR . '..'] as $dir) { + /** @var Filesystem\Directory\ReadInterface $directory */ + $directory = $this->directoryReadFactory->create(['path' => $dir]); + if ($directory->isExist('composer.json') && $directory->isReadable('composer.json')) { + /** @var Package $package */ + return $this->packageFactory->create(['json' => json_decode($directory->readFile('composer.json'))]); + } + } + return $this->packageFactory->create(['json' => new \stdClass]); } } diff --git a/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php index 75c69a598580d..b32118f6b864c 100644 --- a/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php +++ b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php @@ -79,6 +79,7 @@ public static function dataPackagesFromComposerSuggest() 'app/code/LocalModule', 'app/code/LocalModuleWithoutComposerJson', 'vendor/company/module', + 'vendor/company2/module/src' ], 'composerJsonGenerator' => function(DependencyTest $test) { return [ @@ -98,6 +99,28 @@ public static function dataPackagesFromComposerSuggest() ['name' => 'company/module', 'suggest' => ['company/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '1.0.0-beta']] ) ], + [ + ['path' => 'vendor/company2/module/src/..'], + $test->stubComposerJsonReader( + ['name' => 'company2/module', 'suggest' => ['company2/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '1.10']] + ) + ], + [ + ['path' => 'vendor/company2/module/src'], + $test->stubFileNotFoundReader() + ], + [ + ['path' => 'vendor/company/module/..'], + $test->stubFileNotFoundReader() + ], + [ + ['path' => 'app/code/LocalModuleWithoutComposerJson/..'], + $test->stubFileNotFoundReader() + ], + [ + ['path' => 'app/code/LocalModule/..'], + $test->stubFileNotFoundReader() + ], ]; }, 'suggestions' => [ @@ -110,6 +133,7 @@ public static function dataPackagesFromComposerSuggest() 'thirdparty/bar-sample-data' => '1.2.3', 'local/module-sample-data' => '0.1.0', 'company/module-sample-data' => '1.0.0-beta', + 'company2/module-sample-data' => '1.10', ] ] ]; From e45250ab4458db0165e09a3990d492e5239cc4a4 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Thu, 23 Mar 2017 13:31:09 +0000 Subject: [PATCH 0019/1004] Fix code style issues --- .../Magento/SampleData/Model/Dependency.php | 3 ++ .../Test/Unit/Model/DependencyTest.php | 34 ++++++++++++++----- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index 7d665ed7e5a2e..bf9a8f501be94 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -53,9 +53,12 @@ class Dependency */ public function __construct( ComposerInformation $composerInformation, + // $filesystem kept for BC + // @codingStandardsIgnoreLine Filesystem $filesystem, PackageFactory $packageFactory, ComponentRegistrarInterface $componentRegistrar, + // $directoryReadFactory optional for BC Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory = null ) { $this->composerInformation = $composerInformation; diff --git a/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php index b32118f6b864c..3be13af6ae91b 100644 --- a/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php +++ b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php @@ -24,8 +24,12 @@ class DependencyTest extends \PHPUnit_Framework_TestCase * @param string[] $suggestionsFromLockFile * @param string[] $expectedPackages */ - public function testPackagesFromComposerSuggest($moduleDirectories, callable $composerJsonGenerator, $suggestionsFromLockFile, $expectedPackages) - { + public function testPackagesFromComposerSuggest( + array $moduleDirectories, + callable $composerJsonGenerator, + array $suggestionsFromLockFile, + array $expectedPackages + ) { /** @var ComposerInformation|\PHPUnit_Framework_MockObject_MockObject $composerInformation */ $composerInformation = $this->getMockBuilder(ComposerInformation::class) ->disableOriginalConstructor() @@ -42,7 +46,7 @@ public function testPackagesFromComposerSuggest($moduleDirectories, callable $co ->setMethods(['create']) ->getMock(); $packageFactory->method('create') - ->willReturnCallback(function($args) { + ->willReturnCallback(function ($args) { return new Package($args['json']); }); @@ -81,12 +85,17 @@ public static function dataPackagesFromComposerSuggest() 'vendor/company/module', 'vendor/company2/module/src' ], - 'composerJsonGenerator' => function(DependencyTest $test) { + 'composerJsonGenerator' => function (DependencyTest $test) { return [ [ ['path' => 'app/code/LocalModule'], $test->stubComposerJsonReader( - ['name' => 'local/module', 'suggest' => ['local/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '0.1.0']] + [ + 'name' => 'local/module', + 'suggest' => [ + 'local/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '0.1.0' + ] + ] ) ], [ @@ -96,13 +105,23 @@ public static function dataPackagesFromComposerSuggest() [ ['path' => 'vendor/company/module'], $test->stubComposerJsonReader( - ['name' => 'company/module', 'suggest' => ['company/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '1.0.0-beta']] + [ + 'name' => 'company/module', + 'suggest' => [ + 'company/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '1.0.0-beta' + ] + ] ) ], [ ['path' => 'vendor/company2/module/src/..'], $test->stubComposerJsonReader( - ['name' => 'company2/module', 'suggest' => ['company2/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '1.10']] + [ + 'name' => 'company2/module', + 'suggest' => [ + 'company2/module-sample-data' => Dependency::SAMPLE_DATA_SUGGEST . '1.10' + ] + ] ) ], [ @@ -168,4 +187,3 @@ public function stubFileNotFoundReader() return $stub; } } - From 4355d78e7f98aa0b03067c88c1a3aedabb652edb Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Thu, 23 Mar 2017 13:55:30 +0000 Subject: [PATCH 0020/1004] Add missing DI preference for Filesystem\Directory\ReadInterface --- app/code/Magento/SampleData/etc/di.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/SampleData/etc/di.xml b/app/code/Magento/SampleData/etc/di.xml index cfc9a280bb80e..aedd2d31f58dc 100644 --- a/app/code/Magento/SampleData/etc/di.xml +++ b/app/code/Magento/SampleData/etc/di.xml @@ -15,4 +15,5 @@ + From 3319ea0f58ef4014d4d2c89457e521a785c80c47 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Thu, 23 Mar 2017 17:24:47 +0000 Subject: [PATCH 0021/1004] Keep it PHP 5.6 compatible for now --- app/code/Magento/SampleData/Model/Dependency.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index bf9a8f501be94..03e1999d72898 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -51,16 +51,17 @@ class Dependency * @param Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory * @throws \RuntimeException */ + // @codingStandardsIgnoreStart public function __construct( ComposerInformation $composerInformation, // $filesystem kept for BC - // @codingStandardsIgnoreLine Filesystem $filesystem, PackageFactory $packageFactory, ComponentRegistrarInterface $componentRegistrar, // $directoryReadFactory optional for BC Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory = null ) { + // @codingStandardsIgnoreEnd $this->composerInformation = $composerInformation; $this->packageFactory = $packageFactory; $this->componentRegistrar = $componentRegistrar; @@ -115,7 +116,7 @@ protected function getSuggestsFromModules() * @return Package * @throws \Magento\Framework\Exception\FileSystemException */ - private function getModuleComposerPackage($moduleDir): Package + private function getModuleComposerPackage($moduleDir) { /* * Also look in parent directory of registered module directory to allow modules to follow the pds/skeleton From 9b0608ec020a6f73df5748660fdaf77c6f1f3db1 Mon Sep 17 00:00:00 2001 From: Ricards Date: Fri, 24 Mar 2017 11:53:39 +0200 Subject: [PATCH 0022/1004] Correctly process global product attributes #5941 --- .../Model/ResourceModel/Catalog/Product.php | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php index f40da53c99814..32d1ab729302f 100644 --- a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php @@ -170,9 +170,10 @@ protected function _addFilter($storeId, $attributeCode, $value, $type = '=') * * @param int $storeId * @param string $attributeCode + * @param string $column Add attribute value to given column * @return void */ - protected function _joinAttribute($storeId, $attributeCode) + protected function _joinAttribute($storeId, $attributeCode, $column = null) { $connection = $this->getConnection(); $attribute = $this->_getAttribute($attributeCode); @@ -185,6 +186,8 @@ protected function _joinAttribute($storeId, $attributeCode) . ' AND ' . $connection->quoteInto($attrTableAlias . '.attribute_id = ?', $attribute['attribute_id']), [] ); + // Global scope attribute value + $columnValue = 't1_' . $attributeCode . '.value'; if (!$attribute['is_global']) { $attrTableAlias2 = 't2_' . $attributeCode; @@ -195,6 +198,15 @@ protected function _joinAttribute($storeId, $attributeCode) . ' AND ' . $connection->quoteInto($attrTableAlias2 . '.store_id = ?', $storeId), [] ); + // Store scope attribute value + $columnValue = $this->getConnection()->getIfNullSql('t2_' . $attributeCode . '.value', $columnValue); + } + + // Add attribute value to result set if needed + if (isset($column)) { + $this->_select->columns([ + $column => $columnValue + ]); } } @@ -263,30 +275,15 @@ public function getCollection($storeId) // Join product images required attributes $imageIncludePolicy = $this->_sitemapData->getProductImageIncludePolicy($store->getId()); if (\Magento\Sitemap\Model\Source\Product\Image\IncludeImage::INCLUDE_NONE != $imageIncludePolicy) { - $this->_joinAttribute($store->getId(), 'name'); - $this->_select->columns( - ['name' => $this->getConnection()->getIfNullSql('t2_name.value', 't1_name.value')] - ); - + $this->_joinAttribute($store->getId(), 'name', 'name'); if (\Magento\Sitemap\Model\Source\Product\Image\IncludeImage::INCLUDE_ALL == $imageIncludePolicy) { - $this->_joinAttribute($store->getId(), 'thumbnail'); - $this->_select->columns( - [ - 'thumbnail' => $this->getConnection()->getIfNullSql( - 't2_thumbnail.value', - 't1_thumbnail.value' - ), - ] - ); + $this->_joinAttribute($store->getId(), 'thumbnail', 'thumbnail'); } elseif (\Magento\Sitemap\Model\Source\Product\Image\IncludeImage::INCLUDE_BASE == $imageIncludePolicy) { - $this->_joinAttribute($store->getId(), 'image'); - $this->_select->columns( - ['image' => $this->getConnection()->getIfNullSql('t2_image.value', 't1_image.value')] - ); + $this->_joinAttribute($store->getId(), 'image', 'image'); } } - $query = $connection->query($this->_select); + $query = $connection->query($this->prepareSelectStatement($this->_select)); while ($row = $query->fetch()) { $product = $this->_prepareProduct($row, $store->getId()); $products[$product->getId()] = $product; @@ -401,4 +398,15 @@ protected function _getMediaConfig() { return $this->_mediaConfig; } + + /** + * Allow to modify select statement with plugins + * + * @param \Magento\Framework\DB\Select $select + * @return \Magento\Framework\DB\Select + */ + public function prepareSelectStatement(\Magento\Framework\DB\Select $select) + { + return $select; + } } From d039dacbac30d92ff102b4cee6f5af1d909475df Mon Sep 17 00:00:00 2001 From: Tom Klingenberg Date: Tue, 26 Jan 2016 07:40:04 +0100 Subject: [PATCH 0023/1004] more safe includes on application start the include operations were not isolated then glob'ed registration.php and cli_commands.php are automatically included. this commit separates the globl-list from the code to include and the inclusion is done in a separated scope. --- app/etc/NonComposerComponentRegistration.php | 47 ++++++++++++++------ app/etc/include-globlist.php | 13 ++++++ 2 files changed, 46 insertions(+), 14 deletions(-) create mode 100644 app/etc/include-globlist.php diff --git a/app/etc/NonComposerComponentRegistration.php b/app/etc/NonComposerComponentRegistration.php index 8fba26490d511..c5fe8b46b1d36 100755 --- a/app/etc/NonComposerComponentRegistration.php +++ b/app/etc/NonComposerComponentRegistration.php @@ -4,19 +4,38 @@ * See COPYING.txt for license details. */ -$pathList[] = dirname(__DIR__) . '/code/*/*/cli_commands.php'; -$pathList[] = dirname(__DIR__) . '/code/*/*/registration.php'; -$pathList[] = dirname(__DIR__) . '/design/*/*/*/registration.php'; -$pathList[] = dirname(__DIR__) . '/i18n/*/*/registration.php'; -$pathList[] = dirname(dirname(__DIR__)) . '/lib/internal/*/*/registration.php'; -$pathList[] = dirname(dirname(__DIR__)) . '/lib/internal/*/*/*/registration.php'; -foreach ($pathList as $path) { - // Sorting is disabled intentionally for performance improvement - $files = glob($path, GLOB_NOSORT); - if ($files === false) { - throw new \RuntimeException('glob() returned error while searching in \'' . $path . '\''); - } - foreach ($files as $file) { - include $file; +namespace Magento\NonComposerComponentRegistration; + +use RuntimeException; + +/** + * Include files from a list of glob patterns + * + * @throws RuntimeException + * @return void + */ +function main() +{ + $globPatterns = include __DIR__ . '/include-globlist.php'; + $baseDir = dirname(__DIR__) . '/'; + + foreach ($globPatterns as $globPattern) { + // Sorting is disabled intentionally for performance improvement + $files = glob($baseDir . $globPattern, GLOB_NOSORT); + if ($files === false) { + throw new RuntimeException("glob(): error with '$baseDir$globPattern'"); + } + array_map(__NAMESPACE__ . '\file', $files); } } + +/** + * Isolated include with it's own variable scope + * + * @return void + */ +function file() { + include func_get_arg(0); +} + +main(); diff --git a/app/etc/include-globlist.php b/app/etc/include-globlist.php new file mode 100644 index 0000000000000..e5f789c26ce90 --- /dev/null +++ b/app/etc/include-globlist.php @@ -0,0 +1,13 @@ + Date: Wed, 27 Jan 2016 08:12:05 +0100 Subject: [PATCH 0024/1004] rename NonComposerComponentRegistration to registration - rename to registration - rename the glob pattern-list-file accordingly - streamline with autoload.php as it is on the same level, that is, effec- tively move the file one directory up. - require file with list of glob patterns (squash) --- app/etc/{include-globlist.php => registration_globlist.php} | 2 +- ...onComposerComponentRegistration.php => registration.php} | 6 ++++-- composer.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) rename app/etc/{include-globlist.php => registration_globlist.php} (81%) rename app/{etc/NonComposerComponentRegistration.php => registration.php} (83%) diff --git a/app/etc/include-globlist.php b/app/etc/registration_globlist.php similarity index 81% rename from app/etc/include-globlist.php rename to app/etc/registration_globlist.php index e5f789c26ce90..57aec1e391a4a 100644 --- a/app/etc/include-globlist.php +++ b/app/etc/registration_globlist.php @@ -1,7 +1,7 @@ Date: Wed, 1 Mar 2017 22:19:21 +0100 Subject: [PATCH 0025/1004] simplify product lists --- .../frontend/templates/product/list.phtml | 5 +- .../templates/product/list/items.phtml | 7 +- .../frontend/templates/product/listing.phtml | 103 ++++++----- .../widget/new/column/new_default_list.phtml | 91 +++++----- .../product/widget/new/content/new_grid.phtml | 5 +- .../product/widget/new/content/new_list.phtml | 159 ++++++++-------- .../product/widget/content/grid.phtml | 126 +++++++------ .../column/compared_default_list.phtml | 97 +++++----- .../compared/content/compared_grid.phtml | 155 ++++++++-------- .../compared/content/compared_list.phtml | 171 +++++++++--------- .../viewed/column/viewed_default_list.phtml | 95 +++++----- .../viewed/column/viewed_images_list.phtml | 7 +- .../widget/viewed/content/viewed_grid.phtml | 151 ++++++++-------- .../widget/viewed/content/viewed_list.phtml | 167 +++++++++-------- .../view/frontend/templates/item/list.phtml | 15 +- 15 files changed, 669 insertions(+), 685 deletions(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml index bcbd2882e02c2..0109cdd348dea 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml @@ -42,11 +42,10 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); $pos = $block->getPositioned(); ?>
-
    - ' : '
  1. ' ?> +
  2. getImage($_product, $image); @@ -112,7 +111,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output');
- ' : '' ?> + diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml index 84be9271980b4..3d1cb88cac4d8 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/items.phtml @@ -174,7 +174,6 @@ switch ($type = $block->getType()) {
    - isComposite() && $_item->isSaleable() && $type == 'related'): ?> @@ -183,9 +182,9 @@ switch ($type = $block->getType()) { - ' : '
  1. ' ?> +
  2. ' ?> @@ -252,7 +251,7 @@ switch ($type = $block->getType()) {
- ' : '' ?> + diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml index 2f5bb0211a1ee..27907bf5ebe95 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/listing.phtml @@ -38,61 +38,60 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); } ?>
-
    - ' : '
  1. ' ?> -
    - - - getImage($_product, $image)->toHtml(); ?> - -
    - ' - . ' ' - . $_helper->productAttribute($_product, $_product->getName(), 'name') - . ''; - $info['price'] = $block->getProductPrice($_product); - $info['review'] = $block->getReviewsSummaryHtml($_product, $templateType); - - if ($_product->isSaleable()) { - $info['button'] = ''; - } else { - $info['button'] = $_product->getIsSalable() ? '
    ' . __('In stock') . '
    ' : - '
    ' . __('Out of stock') . '
    '; - } - - $info['links'] = ''; - $info['actions'] = '
    ' . $info['button'] . $info['links'] . '
    '; - - if ($showDescription) { - $info['description'] = '
    ' - . $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') - . ' ' - . __('Learn More') . '
    '; - } else { - $info['description'] = ''; - } - - $details = $block->getInfoOrder() ?: ['name','price','review','description','actions']; - foreach ($details as $detail) { - /* @escapeNotVerified */ echo $info[$detail]; - } - ?> - +
  2. +
    + + + getImage($_product, $image)->toHtml(); ?> + +
    + ' + . ' ' + . $_helper->productAttribute($_product, $_product->getName(), 'name') + . ''; + $info['price'] = $block->getProductPrice($_product); + $info['review'] = $block->getReviewsSummaryHtml($_product, $templateType); + + if ($_product->isSaleable()) { + $info['button'] = ''; + } else { + $info['button'] = $_product->getIsSalable() ? '
    ' . __('In stock') . '
    ' : + '
    ' . __('Out of stock') . '
    '; + } + + $info['links'] = ''; + $info['actions'] = '
    ' . $info['button'] . $info['links'] . '
    '; + + if ($showDescription) { + $info['description'] = '
    ' + . $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') + . ' ' + . __('Learn More') . '
    '; + } else { + $info['description'] = ''; + } + + $details = $block->getInfoOrder() ?: ['name','price','review','description','actions']; + foreach ($details as $detail) { + /* @escapeNotVerified */ echo $info[$detail]; + } + ?> + +
    -
- ' : '' ?> + diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml index e2f3c1888c30e..b5f7d2e1559f0 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/column/new_default_list.phtml @@ -14,59 +14,58 @@
getNameInLayout(); ?> -
    getItems() as $_product): ?> - ' : '
  1. ' ?> -
    - - getImage($_product, 'side_column_widget_product_thumbnail')->toHtml(); ?> - -
    - - - helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> - - - getProductPriceHtml($_product, '-widget-new-' . $suffix) ?> -
    -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_product)): ?> - +
  2. +
    + + getImage($_product, 'side_column_widget_product_thumbnail')->toHtml(); ?> + +
    + + + helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + + + getProductPriceHtml($_product, '-widget-new-' . $suffix) ?> +
    +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_product)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); - ?> - + getIsSalable()): ?> +
    + +
    + +
    + +
    + - - getIsSalable()): ?> -
    - -
    - -
    - -
    - - +
    -
- getItems())+1) ? '' : '' ?> + getPagerHtml() ?> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml index 897d70c23acc2..342613f5efcb4 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_grid.phtml @@ -39,9 +39,8 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> ' ?> - ' : '' ?> + diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml index 567ccb2d11581..125e92683be9f 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/widget/new/content/new_list.phtml @@ -40,91 +40,90 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()-> ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml($_item, $type); ?> - - - getReviewsSummaryHtml($_item, $templateType) ?> - - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml($_item, $type); ?> + + + getReviewsSummaryHtml($_item, $templateType) ?> + + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    + - - getIsSalable()): ?> -
    - -
    +
    + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + - -
    - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare'); ?> - - - - -
    - -
    - - -
    - productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> - -
    - + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare'); ?> + + + + +
    + +
    + + +
    + productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml b/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml index 51943355e8ea7..9976d6fa6bdd6 100644 --- a/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml +++ b/app/code/Magento/CatalogWidget/view/frontend/templates/product/widget/content/grid.phtml @@ -33,78 +33,76 @@ ' ?>
    - -
  1. -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml($_item, $type); - ?> +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml($_item, $type); + ?> - - getReviewsSummaryHtml($_item, $templateType) ?> - + + getReviewsSummaryHtml($_item, $templateType) ?> + - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    escapeHtml(__('In stock')) ?>
    + +
    escapeHtml(__('Out of stock')) ?>
    + - - getIsSalable()): ?> -
    escapeHtml(__('In stock')) ?>
    - -
    escapeHtml(__('Out of stock')) ?>
    +
    + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + escapeHtml(__('Add to Wish List')) ?> + + + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare');?> + + escapeHtml(__('Add to Compare')) ?> + - -
    - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - escapeHtml(__('Add to Wish List')) ?> - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare');?> - - escapeHtml(__('Add to Compare')) ?> - - -
    - -
    - +
    + +
    + +
    -
    - ' : '' ?> +
diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml index f26c96a9f9e2f..b6a76e945d0a2 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/column/compared_default_list.phtml @@ -33,61 +33,60 @@ if ($exist = $block->getRecentlyComparedProducts()) {
getNameInLayout(); ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_product, $image)->toHtml(); ?> - -
    - - - helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> - - - getProductPriceHtml( - $_product, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-widget-compared-' . $suffix - ] - ) ?> -
    - isSaleable()): ?> -
    - getTypeInstance()->hasRequiredOptions($_product)): ?> - +
  2. +
    + + getImage($_product, $image)->toHtml(); ?> + +
    + + + helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + + + getProductPriceHtml( + $_product, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-widget-compared-' . $suffix + ] + ) ?> +
    + isSaleable()): ?> +
    + getTypeInstance()->hasRequiredOptions($_product)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]) + ?> + + +
    - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    +
    - - getIsSalable()): ?> -
    - -
    - -
    -
- ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml index 151e5d6044515..8d0a87fe615ab 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_grid.phtml @@ -37,89 +37,88 @@ if ($exist = $block->getRecentlyComparedProducts()) { ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml( - $_item, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-' . $type - ] - ) ?> - - getReviewsSummaryHtml($_item, $rating) ?> - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> + + getReviewsSummaryHtml($_item, $rating) ?> + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    + - - getIsSalable()): ?> -
    - -
    +
    + + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + - -
    - - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare'); ?> - - - - -
    - -
    - + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare'); ?> + + + + +
    + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml index 9b6dbc9cbac2c..0ddfc9d936a78 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/compared/content/compared_list.phtml @@ -38,97 +38,96 @@ if ($exist = $block->getRecentlyComparedProducts()) { ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml( - $_item, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-' . $type - ] - ) ?> - - getReviewsSummaryHtml($_item, $rating) ?> - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> + + getReviewsSummaryHtml($_item, $rating) ?> + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    + - - getIsSalable()): ?> -
    - -
    +
    + + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + - -
    - - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare');?> - - - - -
    - -
    - - -
    - productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> - -
    - + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare');?> + + + + +
    + +
    + + +
    + productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml index 0c4b84737a08c..3b84087284881 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_default_list.phtml @@ -38,60 +38,59 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr
getNameInLayout(); ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_product, $image)->toHtml(); ?> - -
    - - - helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> - - - getProductPriceHtml( - $_product, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-widget-viewed-' . $suffix - ] - ) ?> -
    - isSaleable()): ?> -
    - getTypeInstance()->hasRequiredOptions($_product)): ?> - +
  2. +
    + + getImage($_product, $image)->toHtml(); ?> + +
    + + + helper('Magento\Catalog\Helper\Output')->productAttribute($_product, $_product->getName(), 'name') ?> + + + getProductPriceHtml( + $_product, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-widget-viewed-' . $suffix + ] + ) ?> +
    + isSaleable()): ?> +
    + getTypeInstance()->hasRequiredOptions($_product)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); + ?> + + +
    - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); - ?> - + getIsSalable()): ?> +
    + +
    +
    - - getIsSalable()): ?> -
    - -
    - -
    -
- ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml index 3a548aaedb8ad..e5b3b735edb10 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/column/viewed_images_list.phtml @@ -35,14 +35,13 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr
getNameInLayout(); ?>
    - - ' : '
  1. ' ?> +
  2. getImage($_product, $image)->toHtml(); ?> - ' : '' ?> - +
  3. +
diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml index e9fe8c8c3aea9..d2c694179eb0f 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_grid.phtml @@ -39,87 +39,86 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml( - $_item, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-' . $type - ] - ) ?> - - getReviewsSummaryHtml($_item, $rating) ?> - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> + + getReviewsSummaryHtml($_item, $rating) ?> + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) - ?> - + getIsSalable()): ?> +
    + +
    + - - getIsSalable()): ?> -
    - -
    +
    + + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + + + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare');?> + + + - -
    - - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare');?> - - - - -
    - -
    - +
    + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml index b2077b441b79f..2a2700886a9d9 100644 --- a/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/templates/widget/viewed/content/viewed_list.phtml @@ -41,96 +41,95 @@ if ($exist = ($block->getRecentlyViewedProducts() && $block->getRecentlyViewedPr ' ?>
    - - ' : '
  1. ' ?> -
    - - getImage($_item, $image)->toHtml(); ?> - -
    - - - escapeHtml($_item->getName()) ?> - - - getProductPriceHtml( - $_item, - \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, - \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, - [ - 'price_id_suffix' => '-' . $type - ] - ) ?> - - getReviewsSummaryHtml($_item, $rating) ?> - - -
    - -
    - isSaleable()): ?> - getTypeInstance()->hasRequiredOptions($_item)): ?> - +
  2. +
    + + getImage($_item, $image)->toHtml(); ?> + +
    + + + escapeHtml($_item->getName()) ?> + + + getProductPriceHtml( + $_item, + \Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE, + \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, + [ + 'price_id_suffix' => '-' . $type + ] + ) ?> + + getReviewsSummaryHtml($_item, $rating) ?> + + +
    + +
    + isSaleable()): ?> + getTypeInstance()->hasRequiredOptions($_item)): ?> + + + helper('Magento\Framework\Data\Helper\PostHelper'); + $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); + ?> + + - helper('Magento\Framework\Data\Helper\PostHelper'); - $postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); - ?> - + getIsSalable()): ?> +
    + +
    - - getIsSalable()): ?> -
    - -
    - -
    - +
    + - -
    - helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - - - - - getAddToCompareUrl() && $showCompare): ?> - helper('Magento\Catalog\Helper\Product\Compare');?> - - - - -
    - -
    - - -
    - productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> - -
    - + +
    + helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> + + + + + getAddToCompareUrl() && $showCompare): ?> + helper('Magento\Catalog\Helper\Product\Compare');?> + + + + +
    + +
    + + +
    + productAttribute($_item, $_item->getShortDescription(), 'short_description') ?> + +
    + +
- - ' : '' ?> + diff --git a/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml b/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml index dce3241ea5f92..38cda03093018 100644 --- a/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml +++ b/app/code/Magento/Wishlist/view/frontend/templates/item/list.phtml @@ -13,17 +13,16 @@ $columns = $block->getColumns(); ?>
- getItems())): ?>
    getItems() as $item): ?> - escapeHtmlAttr($item->getId()) . '">' : '
  1. ' ?> -
    - - setItem($item); echo $column->toHtml($item);?> - -
    - getItems())+1) ? '
  2. ' : '' ?> +
  3. +
    + + setItem($item); echo $column->toHtml($item);?> + +
    +
From 1886e266eed0410d29555698fef621ed0802794a Mon Sep 17 00:00:00 2001 From: Rafael Kassner Date: Sun, 26 Mar 2017 22:32:17 +0200 Subject: [PATCH 0026/1004] Fix fatal errors with deleteOptionsAndSelections --- .../Model/Import/Product/Type/Bundle.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php b/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php index d5548f61c2bf2..8e13dee30aea6 100644 --- a/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php +++ b/app/code/Magento/BundleImportExport/Model/Import/Product/Type/Bundle.php @@ -629,8 +629,13 @@ protected function _initAttributes() */ protected function deleteOptionsAndSelections($productIds) { + if (empty($productIds)) { + return $this; + } + $optionTable = $this->_resource->getTableName('catalog_product_bundle_option'); $optionValueTable = $this->_resource->getTableName('catalog_product_bundle_option_value'); + $selectionTable = $this->_resource->getTableName('catalog_product_bundle_selection'); $valuesIds = $this->connection->fetchAssoc($this->connection->select()->from( ['bov' => $optionValueTable], ['value_id'] @@ -643,17 +648,16 @@ protected function deleteOptionsAndSelections($productIds) $productIds )); $this->connection->delete( - $optionTable, + $optionValueTable, $this->connection->quoteInto('value_id IN (?)', array_keys($valuesIds)) ); - $productIdsInWhere = $this->connection->quoteInto('parent_id IN (?)', $productIds); $this->connection->delete( $optionTable, - $this->connection->quoteInto('parent_id IN (?)', $productIdsInWhere) + $this->connection->quoteInto('parent_id IN (?)', $productIds) ); $this->connection->delete( - $optionTable, - $this->connection->quoteInto('parent_product_id IN (?)', $productIdsInWhere) + $selectionTable, + $this->connection->quoteInto('parent_product_id IN (?)', $productIds) ); return $this; } From c4894fac36f2bffd5aa3326af4086f7b981e18e0 Mon Sep 17 00:00:00 2001 From: David Verholen Date: Sun, 14 Feb 2016 10:05:32 +0100 Subject: [PATCH 0027/1004] decouple product view gallery images config from Gallery Block --- .../Catalog/Block/Product/View/Gallery.php | 76 ++++++++++--------- .../Product/Gallery/ImagesConfigFactory.php | 47 ++++++++++++ .../Gallery/ImagesConfigFactoryInterface.php | 20 +++++ .../Unit/Block/Product/View/GalleryTest.php | 12 ++- app/code/Magento/Catalog/etc/di.xml | 1 + app/code/Magento/Catalog/etc/frontend/di.xml | 21 +++++ .../Block/Product/View/Gallery.php | 16 ++-- 7 files changed, 153 insertions(+), 40 deletions(-) create mode 100644 app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php create mode 100644 app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactoryInterface.php diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index a9d60a39a6665..4fd757ade2949 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -11,9 +11,10 @@ */ namespace Magento\Catalog\Block\Product\View; -use Magento\Framework\Data\Collection; -use Magento\Framework\Json\EncoderInterface; use Magento\Catalog\Helper\Image; +use Magento\Catalog\Model\Product; +use Magento\Framework\Data\Collection; +use Magento\Framework\DataObject; class Gallery extends \Magento\Catalog\Block\Product\View\AbstractView { @@ -28,19 +29,29 @@ class Gallery extends \Magento\Catalog\Block\Product\View\AbstractView protected $jsonEncoder; /** - * @param \Magento\Catalog\Block\Product\Context $context - * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils - * @param EncoderInterface $jsonEncoder - * @param array $data + * @var DataObject + */ + protected $galleryImagesConfig; + + /** + * @param \Magento\Catalog\Block\Product\Context $context + * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils + * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder + * @param \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface $imagesConfigFactory + * @param array $galleryImagesConfig + * @param array $data */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, - EncoderInterface $jsonEncoder, + \Magento\Framework\Json\EncoderInterface $jsonEncoder, + \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface $imagesConfigFactory, + array $galleryImagesConfig = [], array $data = [] ) { $this->jsonEncoder = $jsonEncoder; parent::__construct($context, $arrayUtils, $data); + $this->galleryImagesConfig = $imagesConfigFactory->create($galleryImagesConfig); } /** @@ -54,25 +65,15 @@ public function getGalleryImages() $images = $product->getMediaGalleryImages(); if ($images instanceof \Magento\Framework\Data\Collection) { foreach ($images as $image) { - /* @var \Magento\Framework\DataObject $image */ - $image->setData( - 'small_image_url', - $this->_imageHelper->init($product, 'product_page_image_small') - ->setImageFile($image->getFile()) - ->getUrl() - ); - $image->setData( - 'medium_image_url', - $this->_imageHelper->init($product, 'product_page_image_medium_no_frame') - ->setImageFile($image->getFile()) - ->getUrl() - ); - $image->setData( - 'large_image_url', - $this->_imageHelper->init($product, 'product_page_image_large_no_frame') - ->setImageFile($image->getFile()) - ->getUrl() - ); + /** @var DataObject $image */ + $this->galleryImagesConfig->walk(function (DataObject $imageConfig) use ($image, $product) { + /** @var Product $product */ + $productImage = $this->_imageHelper->init($product, + $imageConfig['image_id']) + ->setImageFile($image->getData('file')) + ->getUrl(); + $image->setData($imageConfig->getData('data_object_key'), $productImage); + }); } } @@ -107,15 +108,22 @@ public function getBreakpoints() public function getGalleryImagesJson() { $imagesItems = []; + /** @var DataObject $image */ foreach ($this->getGalleryImages() as $image) { - $imagesItems[] = [ - 'thumb' => $image->getData('small_image_url'), - 'img' => $image->getData('medium_image_url'), - 'full' => $image->getData('large_image_url'), - 'caption' => $image->getLabel(), - 'position' => $image->getPosition(), - 'isMain' => $this->isMainImage($image), - ]; + $imageItem = new DataObject([ + 'caption' => $image->getData('label'), + 'position' => $image->getData('position'), + 'isMain' => $this->isMainImage($image), + ]); + $this->galleryImagesConfig->walk(function ( + DataObject $imageConfig + ) use ($imageItem, $image) { + $imageItem->setData( + $imageConfig->getData('json_object_key'), + $image->getData($imageConfig->getData('data_object_key')) + ); + }); + $imagesItems[] = $imageItem->toArray(); } if (empty($imagesItems)) { $imagesItems[] = [ diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php new file mode 100644 index 0000000000000..f9cb562a945b6 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php @@ -0,0 +1,47 @@ +_dataCollectionFactory = $_dataCollectionFactory; + } + + /** + * create Gallery Images Config Collection from array + * + * @param array $imagesConfig + * @param array $data + * + * @return \Magento\Framework\Data\Collection + */ + public function create(array $imagesConfig, array $data = []) + { + /** @var \Magento\Framework\Data\Collection $collection */ + $collection = $this->_dataCollectionFactory->create($data); + array_map(function($imageConfig) use ($collection) { + $collection->addItem(new DataObject($imageConfig)); + }, $imagesConfig); + + return $collection; + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactoryInterface.php b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactoryInterface.php new file mode 100644 index 0000000000000..84a0d9d25ab18 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactoryInterface.php @@ -0,0 +1,20 @@ +mockContext(); @@ -49,10 +54,15 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); + $this->imagesConfigMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface') + ->disableOriginalConstructor() + ->getMock(); + $this->model = new \Magento\Catalog\Block\Product\View\Gallery( $this->context, $this->arrayUtils, - $this->jsonEncoderMock + $this->jsonEncoderMock, + $this->imagesConfigMock ); } diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index ca0403121cb1d..8c845e16fdd40 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -63,6 +63,7 @@ + diff --git a/app/code/Magento/Catalog/etc/frontend/di.xml b/app/code/Magento/Catalog/etc/frontend/di.xml index 85b7b81d863eb..e45dd53893475 100644 --- a/app/code/Magento/Catalog/etc/frontend/di.xml +++ b/app/code/Magento/Catalog/etc/frontend/di.xml @@ -60,4 +60,25 @@ + + + + + product_page_image_small + small_image_url + thumb + + + product_page_image_medium + medium_image_url + img + + + product_page_image_large + large_image_url + full + + + + diff --git a/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php b/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php index 6552223371dac..55b764b342c5e 100644 --- a/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php +++ b/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php @@ -19,23 +19,29 @@ class Gallery extends \Magento\Catalog\Block\Product\View\Gallery protected $mediaHelper; /** - * @param \Magento\Catalog\Block\Product\Context $context - * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils - * @param \Magento\ProductVideo\Helper\Media $mediaHelper - * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder - * @param array $data + * @param \Magento\Catalog\Block\Product\Context $context + * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils + * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder + * @param \Magento\ProductVideo\Helper\Media $mediaHelper + * @param \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface $imagesConfigFactory + * @param array $galleryImagesConfig + * @param array $data */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\ProductVideo\Helper\Media $mediaHelper, + \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface $imagesConfigFactory, + array $galleryImagesConfig = [], array $data = [] ) { parent::__construct( $context, $arrayUtils, $jsonEncoder, + $imagesConfigFactory, + $galleryImagesConfig, $data ); $this->mediaHelper = $mediaHelper; From 3b9261b51c67fdff2e551202b4c6db1121c1d3e8 Mon Sep 17 00:00:00 2001 From: David Verholen Date: Sun, 14 Feb 2016 11:37:39 +0100 Subject: [PATCH 0028/1004] Fix Product View Gallery Block Unit Tests --- .../Catalog/Block/Product/View/Gallery.php | 23 +++---- .../Unit/Block/Product/View/GalleryTest.php | 69 +++++++++++++++++-- 2 files changed, 75 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 4fd757ade2949..934004816efd2 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -65,15 +65,16 @@ public function getGalleryImages() $images = $product->getMediaGalleryImages(); if ($images instanceof \Magento\Framework\Data\Collection) { foreach ($images as $image) { - /** @var DataObject $image */ - $this->galleryImagesConfig->walk(function (DataObject $imageConfig) use ($image, $product) { + foreach($this->galleryImagesConfig->getItems() as $imageConfig) { /** @var Product $product */ - $productImage = $this->_imageHelper->init($product, - $imageConfig['image_id']) - ->setImageFile($image->getData('file')) - ->getUrl(); - $image->setData($imageConfig->getData('data_object_key'), $productImage); - }); + $image->setData( + $imageConfig->getData('data_object_key'), + $this->_imageHelper->init($product, + $imageConfig['image_id']) + ->setImageFile($image->getData('file')) + ->getUrl() + ); + } } } @@ -115,14 +116,12 @@ public function getGalleryImagesJson() 'position' => $image->getData('position'), 'isMain' => $this->isMainImage($image), ]); - $this->galleryImagesConfig->walk(function ( - DataObject $imageConfig - ) use ($imageItem, $image) { + foreach($this->galleryImagesConfig->getItems() as $imageConfig) { $imageItem->setData( $imageConfig->getData('json_object_key'), $image->getData($imageConfig->getData('data_object_key')) ); - }); + } $imagesItems[] = $imageItem->toArray(); } if (empty($imagesItems)) { diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php index 428ad5d7cc412..29560fead4f48 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php @@ -40,7 +40,12 @@ class GalleryTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $imagesConfigMock; + protected $imagesConfigFactoryMock; + + /** + * @var \Magento\Framework\Data\Collection|\PHPUnit_Framework_MockObject_MockObject + */ + protected $galleryImagesConfigMock; protected function setUp() { @@ -54,15 +59,13 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $this->imagesConfigMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface') - ->disableOriginalConstructor() - ->getMock(); + $this->imagesConfigFactoryMock = $this->getImagesConfigFactory(); $this->model = new \Magento\Catalog\Block\Product\View\Gallery( $this->context, $this->arrayUtils, $this->jsonEncoderMock, - $this->imagesConfigMock + $this->imagesConfigFactoryMock ); } @@ -117,6 +120,10 @@ public function testGetGalleryImages() ->with('product') ->willReturn($productMock); + $this->galleryImagesConfigMock->expects($this->exactly(1)) + ->method('getItems') + ->willReturn($this->getGalleryImagesConfigItems()); + $this->imageHelper->expects($this->exactly(3)) ->method('init') ->willReturnMap([ @@ -164,4 +171,56 @@ private function getImagesCollection() return $collectionMock; } + + /** + * getImagesConfigFactory + * + * @return \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface + */ + private function getImagesConfigFactory() + { + $this->galleryImagesConfigMock = $this->getMockBuilder('\Magento\Framework\Data\Collection') + ->disableOriginalConstructor() + ->getMock(); + + $this->galleryImagesConfigMock->expects($this->any()) + ->method('getIterator') + ->willReturn(new \ArrayIterator($this->getGalleryImagesConfigItems())); + + $galleryImagesConfigFactoryMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface') + ->disableOriginalConstructor() + ->getMock(); + + $galleryImagesConfigFactoryMock->expects($this->any()) + ->method('create') + ->willReturn($this->galleryImagesConfigMock); + + return $galleryImagesConfigFactoryMock; + } + + /** + * getGalleryImagesConfigItems + * + * @return array + */ + private function getGalleryImagesConfigItems() + { + return [ + new \Magento\Framework\DataObject([ + 'image_id' => 'product_page_image_small', + 'data_object_key' => 'small_image_url', + 'json_object_key' => 'thumb' + ]), + new \Magento\Framework\DataObject([ + 'image_id' => 'product_page_image_medium', + 'data_object_key' => 'medium_image_url', + 'json_object_key' => 'img' + ]), + new \Magento\Framework\DataObject([ + 'image_id' => 'product_page_image_large', + 'data_object_key' => 'large_image_url', + 'json_object_key' => 'full' + ]) + ]; + } } From ae25fd224081608d44502eab27e01d6e5a6d6678 Mon Sep 17 00:00:00 2001 From: David Verholen Date: Thu, 13 Apr 2017 14:03:44 +0200 Subject: [PATCH 0029/1004] implement code review change requests --- .../Catalog/Block/Product/View/Gallery.php | 60 +++++++++++++------ .../Product/Gallery/ImagesConfigFactory.php | 10 ++-- .../Block/Product/View/Gallery.php | 6 +- 3 files changed, 50 insertions(+), 26 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 934004816efd2..89e6ab6427946 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -11,12 +11,18 @@ */ namespace Magento\Catalog\Block\Product\View; +use Magento\Catalog\Block\Product\Context; use Magento\Catalog\Helper\Image; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface; use Magento\Framework\Data\Collection; use Magento\Framework\DataObject; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Json\EncoderInterface; +use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Stdlib\ArrayUtils; -class Gallery extends \Magento\Catalog\Block\Product\View\AbstractView +class Gallery extends AbstractView { /** * @var \Magento\Framework\Config\View @@ -24,7 +30,7 @@ class Gallery extends \Magento\Catalog\Block\Product\View\AbstractView protected $configView; /** - * @var \Magento\Framework\Json\EncoderInterface + * @var EncoderInterface */ protected $jsonEncoder; @@ -34,24 +40,30 @@ class Gallery extends \Magento\Catalog\Block\Product\View\AbstractView protected $galleryImagesConfig; /** - * @param \Magento\Catalog\Block\Product\Context $context - * @param \Magento\Framework\Stdlib\ArrayUtils $arrayUtils - * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder - * @param \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface $imagesConfigFactory - * @param array $galleryImagesConfig - * @param array $data + * @var ImagesConfigFactoryInterface + */ + private $galleryImagesConfigFactory; + + /** + * @param Context $context + * @param ArrayUtils $arrayUtils + * @param EncoderInterface $jsonEncoder + * @param ImagesConfigFactoryInterface $imagesConfigFactory + * @param array $galleryImagesConfig + * @param array $data */ public function __construct( - \Magento\Catalog\Block\Product\Context $context, - \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, - \Magento\Framework\Json\EncoderInterface $jsonEncoder, - \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface $imagesConfigFactory, - array $galleryImagesConfig = [], - array $data = [] + Context $context, + ArrayUtils $arrayUtils, + EncoderInterface $jsonEncoder, + array $data = [], + ImagesConfigFactoryInterface $imagesConfigFactory = null, + array $galleryImagesConfig = [] ) { - $this->jsonEncoder = $jsonEncoder; parent::__construct($context, $arrayUtils, $data); - $this->galleryImagesConfig = $imagesConfigFactory->create($galleryImagesConfig); + $this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class); + $this->galleryImagesConfigFactory = $imagesConfigFactory ?: ObjectManager::getInstance()->get(ImagesConfigFactoryInterface::class); + $this->galleryImagesConfig = $galleryImagesConfig; } /** @@ -65,7 +77,7 @@ public function getGalleryImages() $images = $product->getMediaGalleryImages(); if ($images instanceof \Magento\Framework\Data\Collection) { foreach ($images as $image) { - foreach($this->galleryImagesConfig->getItems() as $imageConfig) { + foreach($this->getGalleryImagesConfig()->getItems() as $imageConfig) { /** @var Product $product */ $image->setData( $imageConfig->getData('data_object_key'), @@ -116,7 +128,7 @@ public function getGalleryImagesJson() 'position' => $image->getData('position'), 'isMain' => $this->isMainImage($image), ]); - foreach($this->galleryImagesConfig->getItems() as $imageConfig) { + foreach($this->getGalleryImagesConfig()->getItems() as $imageConfig) { $imageItem->setData( $imageConfig->getData('json_object_key'), $image->getData($imageConfig->getData('data_object_key')) @@ -189,4 +201,16 @@ private function getConfigView() } return $this->configView; } + + /** + * @return Collection + */ + private function getGalleryImagesConfig() + { + if (false === $this->hasData('gallery_images_config')) { + $this->setData('gallery_images_config', $this->galleryImagesConfigFactory->create($this->galleryImagesConfig)); + } + + return $this->getData('gallery_images_config'); + } } diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php index f9cb562a945b6..80fa53d8ae04d 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php @@ -14,16 +14,16 @@ class ImagesConfigFactory implements ImagesConfigFactoryInterface /** * @var \Magento\Framework\Data\CollectionFactory */ - protected $_dataCollectionFactory; + protected $dataCollectionFactory; /** * ImagesConfigFactory constructor. * - * @param CollectionFactory $_dataCollectionFactory + * @param CollectionFactory $dataCollectionFactory */ - public function __construct(CollectionFactory $_dataCollectionFactory) + public function __construct(CollectionFactory $dataCollectionFactory) { - $this->_dataCollectionFactory = $_dataCollectionFactory; + $this->dataCollectionFactory = $dataCollectionFactory; } /** @@ -37,7 +37,7 @@ public function __construct(CollectionFactory $_dataCollectionFactory) public function create(array $imagesConfig, array $data = []) { /** @var \Magento\Framework\Data\Collection $collection */ - $collection = $this->_dataCollectionFactory->create($data); + $collection = $this->dataCollectionFactory->create($data); array_map(function($imageConfig) use ($collection) { $collection->addItem(new DataObject($imageConfig)); }, $imagesConfig); diff --git a/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php b/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php index 55b764b342c5e..1ef006e00dde2 100644 --- a/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php +++ b/app/code/Magento/ProductVideo/Block/Product/View/Gallery.php @@ -32,9 +32,9 @@ public function __construct( \Magento\Framework\Stdlib\ArrayUtils $arrayUtils, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\ProductVideo\Helper\Media $mediaHelper, - \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface $imagesConfigFactory, - array $galleryImagesConfig = [], - array $data = [] + array $data = [], + \Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface $imagesConfigFactory = null, + array $galleryImagesConfig = [] ) { parent::__construct( $context, From 3983becd6eca1b1535997155a3e012df44c2c126 Mon Sep 17 00:00:00 2001 From: evgk Date: Sun, 16 Apr 2017 03:00:55 +0600 Subject: [PATCH 0030/1004] A fix for issue #9265 This line: $quantity = $quantity ?: 1; in ./vendor/magento/module-catalog/Pricing/Price/TierPrice.php, line 75, uses the ternary shorthand operator to set the quantity to 1 when the quantity that is passed can be converted to false. At this point, the quantity comes from the SaleableInterface item - the simple product model itself. Note that the type signature for the getQty method in SaleableInterface indicates that it should always return a float: /** * Returns quantity of saleable item * * @return float */ public function getQty(); However, on the grouped-product page this item comes from this collection: ./vendor/magento/module-catalog/Model/ResourceModel/Product/Link/Product/Collection.php (a collection of linked products). So the quantity that is set in the product model comes from the "Default quantity" field which is stored as an attribute of the link(catalog_product_link_attribute_decimal) - however, since neither Magento nor the underlying Zend libraries have any conversion from the MySQL to PHP types when loading the collections, and MySQL client/server communication is done via a text-based protocol, this "qty" field ends up being a string in PHP. Thus, the getQty function will return a string representation of a decimal value("0.0000000") in a clear violation of the SaleableInterface, and it leads to this issue with the tier price above(since the ternary shorthand operator will treat "0.000000" string as true, not setting the quantity to 1 as a result). Suggested fix does a forceful conversion of the link-attributes with type=decimal to a PHP float-value on the link-product-collection afterLoad event. It is possible to do the same for the integer type as well, but doing it just for the type=decimal seems least intrusive, and it would solve this interface-mismatch and tier-price issue. --- .../Product/Link/Product/Collection.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index 17c0d0836121a..7bbeeb647e079 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -361,4 +361,28 @@ private function joinProductsToLinks() ); } } + + /** + * After the collection has been loaded + * + * @return $this + */ + protected function _afterLoad() + { + if($this->getLinkModel()) { + $attributes = $this->getLinkAttributes(); + foreach($this as $item) { + foreach ($attributes as $attribute) { + $code = $attribute['code']; + $value = $item->getData($code); + if($value !== null) { + if($attribute['type'] == 'decimal') { + $item->setData($code,(float)$value); + } + } + } + } + } + return parent::_afterLoad(); + } } From b26c7cc127c18ba5a9f9d919d2053c2a158865d1 Mon Sep 17 00:00:00 2001 From: evgk Date: Sun, 16 Apr 2017 04:14:38 +0600 Subject: [PATCH 0031/1004] Fixes to pass static test --- .../Product/Link/Product/Collection.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index 7bbeeb647e079..aa1e820ba71dd 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -369,20 +369,20 @@ private function joinProductsToLinks() */ protected function _afterLoad() { - if($this->getLinkModel()) { + if ($this->getLinkModel()) { $attributes = $this->getLinkAttributes(); - foreach($this as $item) { + foreach ($this as $item) { foreach ($attributes as $attribute) { $code = $attribute['code']; $value = $item->getData($code); - if($value !== null) { - if($attribute['type'] == 'decimal') { - $item->setData($code,(float)$value); + if ($value !== null) { + if ($attribute['type'] == 'decimal') { + $item->setData($code, (float)$value); } } } } } return parent::_afterLoad(); - } + } } From 553aa2263d305b032dc67a6f79326c4c8bb1b6d7 Mon Sep 17 00:00:00 2001 From: evgk Date: Sun, 16 Apr 2017 05:38:06 +0600 Subject: [PATCH 0032/1004] codacy fix codacy fix --- .../Model/ResourceModel/Product/Link/Product/Collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index aa1e820ba71dd..737ec03c33bc2 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -361,7 +361,7 @@ private function joinProductsToLinks() ); } } - + /** * After the collection has been loaded * From cbc6a678acaf0a84a8a15130f696ba6d87c96c80 Mon Sep 17 00:00:00 2001 From: evgk Date: Sun, 16 Apr 2017 15:29:39 +0600 Subject: [PATCH 0033/1004] Supress the camelCase warning --- .../Model/ResourceModel/Product/Link/Product/Collection.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php index 737ec03c33bc2..f944bcfe26c2c 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php @@ -365,6 +365,7 @@ private function joinProductsToLinks() /** * After the collection has been loaded * + * @SuppressWarnings(PHPMD.CamelCaseMethodName) * @return $this */ protected function _afterLoad() From 9e6ad2fb1e7a46ec38c509671b0ef739c36d28b2 Mon Sep 17 00:00:00 2001 From: Evgeni Obukhovsky Date: Tue, 25 Apr 2017 14:35:24 +0300 Subject: [PATCH 0034/1004] Fixed indexed product positions for anchor categories. --- .../Model/Indexer/Category/Product/AbstractAction.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php index 5704bc4b2cbfd..d97e618dfb92d 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php @@ -431,6 +431,10 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store) ['ccp' => $this->getTable('catalog_category_product')], 'ccp.category_id = cc2.child_id', [] + )->joinLeft( + ['ccp2' => $this->getTable('catalog_category_product')], + 'ccp2.category_id = cc2.parent_id AND ccp.product_id = ccp2.product_id', + [] )->joinInner( ['cpe' => $this->getTable('catalog_product_entity')], 'ccp.product_id = cpe.entity_id', @@ -493,7 +497,7 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store) [ 'category_id' => 'cc.entity_id', 'product_id' => 'ccp.product_id', - 'position' => new \Zend_Db_Expr('ccp.position + 10000'), + 'position' => new \Zend_Db_Expr($this->connection->getIfNullSql('ccp2.position', 'ccp.position + 10000')), 'is_parent' => new \Zend_Db_Expr('0'), 'store_id' => new \Zend_Db_Expr($store->getId()), 'visibility' => new \Zend_Db_Expr($this->connection->getIfNullSql('cpvs.value', 'cpvd.value')), From 7717a56a21b63e773c0e21f46909ef94c0c0d8e8 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 26 Apr 2017 02:36:43 +0200 Subject: [PATCH 0035/1004] Update Template.php This update enable the use of loop into template files. Allowing the user iterate through collections --- .../Magento/Framework/Filter/Template.php | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/lib/internal/Magento/Framework/Filter/Template.php b/lib/internal/Magento/Framework/Filter/Template.php index eda75cace3f55..dff6d98d8de23 100644 --- a/lib/internal/Magento/Framework/Filter/Template.php +++ b/lib/internal/Magento/Framework/Filter/Template.php @@ -24,6 +24,11 @@ class Template implements \Zend_Filter_Interface const CONSTRUCTION_IF_PATTERN = '/{{if\s*(.*?)}}(.*?)({{else}}(.*?))?{{\\/if\s*}}/si'; const CONSTRUCTION_TEMPLATE_PATTERN = '/{{(template)(.*?)}}/si'; + + /** + * Looping regular expression + */ + const LOOP_PATTERN = '/{{loop(.*?)delimiter=(.*?)}}(.*?){{\/loop}}/si'; /**#@-*/ @@ -131,6 +136,8 @@ public function filter($value) } } + $value = $this->_filterLoop($value); + if (preg_match_all(self::CONSTRUCTION_PATTERN, $value, $constructions, PREG_SET_ORDER)) { foreach ($constructions as $construction) { $callback = [$this, $construction[1] . 'Directive']; @@ -371,4 +378,59 @@ protected function getStackArgs($stack) } return $stack; } + + /** + * Filter the string as template. + * + * @param string $value + * @return string + */ + protected function _filterLoop($value) + { + if (preg_match_all(self::LOOP_PATTERN, $value, $constructions, PREG_SET_ORDER)) { + foreach ($constructions as $index => $construction) { + + $full_text_to_replace = $construction[0]; + $objectArrayData = $this->_getVariable($construction[1], ''); + $delimiter = $construction[2]; + $loop_text_to_replace = $construction[3]; + + if (is_array($objectArrayData) || $objectArrayData instanceof Varien_Data_Collection) { + + $loopText = []; + foreach ($objectArrayData as $k => $objectData) { + + if (!$objectData instanceof Varien_Object) { // is array? + + if (!is_array($objectData)) { + continue; + } + + $_item = new Varien_Object(); + $_item->setData($k, $objectData); + $objectData = $_item; + } + + $this->_templateVars['item'] = $objectData; + + if (preg_match_all(self::CONSTRUCTION_PATTERN, $loop_text_to_replace, $attributes, PREG_SET_ORDER)) { + + $subText = $loop_text_to_replace; + foreach ($attributes as $j => $attribute) { + $text = $this->_getVariable($attribute[2], ''); + $subText = str_replace($attribute[0], $text, $subText); + } + $loopText[] = $subText; + } + unset($this->_templateVars['item']); + + } + $replaceText = implode($delimiter, $loopText); + $value = str_replace($full_text_to_replace, $replaceText, $value); + } + } + } + + return $value; + } } From 3026960f84809073cd6de5f88cd448a94f20c4df Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 26 Apr 2017 02:49:08 +0200 Subject: [PATCH 0036/1004] Update Template.php removing unused variables --- lib/internal/Magento/Framework/Filter/Template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Filter/Template.php b/lib/internal/Magento/Framework/Filter/Template.php index dff6d98d8de23..c5fb853722cf1 100644 --- a/lib/internal/Magento/Framework/Filter/Template.php +++ b/lib/internal/Magento/Framework/Filter/Template.php @@ -388,7 +388,7 @@ protected function getStackArgs($stack) protected function _filterLoop($value) { if (preg_match_all(self::LOOP_PATTERN, $value, $constructions, PREG_SET_ORDER)) { - foreach ($constructions as $index => $construction) { + foreach ($constructions as $construction) { $full_text_to_replace = $construction[0]; $objectArrayData = $this->_getVariable($construction[1], ''); @@ -416,7 +416,7 @@ protected function _filterLoop($value) if (preg_match_all(self::CONSTRUCTION_PATTERN, $loop_text_to_replace, $attributes, PREG_SET_ORDER)) { $subText = $loop_text_to_replace; - foreach ($attributes as $j => $attribute) { + foreach ($attributes as $attribute) { $text = $this->_getVariable($attribute[2], ''); $subText = str_replace($attribute[0], $text, $subText); } From 18ed2eb6ae3709ae299ceab4c1083d077b0e321b Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 26 Apr 2017 13:41:40 +0200 Subject: [PATCH 0037/1004] Update Template.php removing m1 variables type and renaming m1 methods --- .../Magento/Framework/Filter/Template.php | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/internal/Magento/Framework/Filter/Template.php b/lib/internal/Magento/Framework/Filter/Template.php index c5fb853722cf1..dbb47f46e76fd 100644 --- a/lib/internal/Magento/Framework/Filter/Template.php +++ b/lib/internal/Magento/Framework/Filter/Template.php @@ -24,7 +24,7 @@ class Template implements \Zend_Filter_Interface const CONSTRUCTION_IF_PATTERN = '/{{if\s*(.*?)}}(.*?)({{else}}(.*?))?{{\\/if\s*}}/si'; const CONSTRUCTION_TEMPLATE_PATTERN = '/{{(template)(.*?)}}/si'; - + /** * Looping regular expression */ @@ -136,8 +136,8 @@ public function filter($value) } } - $value = $this->_filterLoop($value); - + $value = $this->filterLoop($value); + if (preg_match_all(self::CONSTRUCTION_PATTERN, $value, $constructions, PREG_SET_ORDER)) { foreach ($constructions as $construction) { $callback = [$this, $construction[1] . 'Directive']; @@ -326,7 +326,7 @@ protected function getVariable($value, $default = '{no_value_defined}') // Getting of template value $stackVars[$i]['variable'] = & $this->templateVars[$stackVars[$i]['name']]; } elseif (isset($stackVars[$i - 1]['variable']) - && $stackVars[$i - 1]['variable'] instanceof \Magento\Framework\DataObject + && $stackVars[$i - 1]['variable'] instanceof \Magento\Framework\DataObject ) { // If object calling methods or getting properties if ($stackVars[$i]['type'] == 'property') { @@ -340,7 +340,7 @@ protected function getVariable($value, $default = '{no_value_defined}') } elseif ($stackVars[$i]['type'] == 'method') { // Calling of object method if (method_exists($stackVars[$i - 1]['variable'], $stackVars[$i]['name']) - || substr($stackVars[$i]['name'], 0, 3) == 'get' + || substr($stackVars[$i]['name'], 0, 3) == 'get' ) { $stackVars[$i]['args'] = $this->getStackArgs($stackVars[$i]['args']); $stackVars[$i]['variable'] = call_user_func_array( @@ -378,51 +378,51 @@ protected function getStackArgs($stack) } return $stack; } - + /** * Filter the string as template. * * @param string $value * @return string */ - protected function _filterLoop($value) + protected function filterLoop($value) { if (preg_match_all(self::LOOP_PATTERN, $value, $constructions, PREG_SET_ORDER)) { foreach ($constructions as $construction) { $full_text_to_replace = $construction[0]; - $objectArrayData = $this->_getVariable($construction[1], ''); + $objectArrayData = $this->getVariable($construction[1], ''); $delimiter = $construction[2]; $loop_text_to_replace = $construction[3]; - - if (is_array($objectArrayData) || $objectArrayData instanceof Varien_Data_Collection) { + + if (is_array($objectArrayData) || $objectArrayData instanceof \Traversable) { $loopText = []; foreach ($objectArrayData as $k => $objectData) { - if (!$objectData instanceof Varien_Object) { // is array? + if (!$objectData instanceof \Magento\Framework\DataObject) { // is array? if (!is_array($objectData)) { continue; } - - $_item = new Varien_Object(); + + $_item = new \Magento\Framework\DataObject; $_item->setData($k, $objectData); $objectData = $_item; } - $this->_templateVars['item'] = $objectData; + $this->templateVars['item'] = $objectData; if (preg_match_all(self::CONSTRUCTION_PATTERN, $loop_text_to_replace, $attributes, PREG_SET_ORDER)) { $subText = $loop_text_to_replace; foreach ($attributes as $attribute) { - $text = $this->_getVariable($attribute[2], ''); + $text = $this->getVariable($attribute[2], ''); $subText = str_replace($attribute[0], $text, $subText); } $loopText[] = $subText; } - unset($this->_templateVars['item']); + unset($this->templateVars['item']); } $replaceText = implode($delimiter, $loopText); From e77cedf47669e6238d565d84734d4e214d322e51 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 26 Apr 2017 14:00:15 +0200 Subject: [PATCH 0038/1004] Update removing useless delimiter --- lib/internal/Magento/Framework/Filter/Template.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Filter/Template.php b/lib/internal/Magento/Framework/Filter/Template.php index dbb47f46e76fd..7e585650e36d8 100644 --- a/lib/internal/Magento/Framework/Filter/Template.php +++ b/lib/internal/Magento/Framework/Filter/Template.php @@ -28,7 +28,7 @@ class Template implements \Zend_Filter_Interface /** * Looping regular expression */ - const LOOP_PATTERN = '/{{loop(.*?)delimiter=(.*?)}}(.*?){{\/loop}}/si'; + const LOOP_PATTERN = '/{{loop(.*?)}}(.*?){{\/loop}}/si'; /**#@-*/ @@ -392,8 +392,7 @@ protected function filterLoop($value) $full_text_to_replace = $construction[0]; $objectArrayData = $this->getVariable($construction[1], ''); - $delimiter = $construction[2]; - $loop_text_to_replace = $construction[3]; + $loop_text_to_replace = $construction[2]; if (is_array($objectArrayData) || $objectArrayData instanceof \Traversable) { @@ -425,7 +424,7 @@ protected function filterLoop($value) unset($this->templateVars['item']); } - $replaceText = implode($delimiter, $loopText); + $replaceText = implode('', $loopText); $value = str_replace($full_text_to_replace, $replaceText, $value); } } From ccab782facc967a33cd0919d9a3d551bcc741f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20R=C3=B6ttig?= Date: Sat, 20 May 2017 13:44:13 +0200 Subject: [PATCH 0039/1004] Add new InventoryApi Module and implement Interfaces --- .../Api/Data/SourceExtensionInterface.php | 11 + .../InventoryApi/Api/Data/SourceInterface.php | 315 ++++++++++++++++++ .../Api/Data/SourceSearchResultsInterface.php | 11 + .../Api/SourceRepositoryInterface.php | 35 ++ app/code/Magento/InventoryApi/LICENSE.txt | 48 +++ app/code/Magento/InventoryApi/LICENSE_AFL.txt | 48 +++ app/code/Magento/InventoryApi/README.md | 0 app/code/Magento/InventoryApi/composer.json | 28 ++ app/code/Magento/InventoryApi/etc/module.xml | 16 + .../Magento/InventoryApi/registration.php | 11 + 10 files changed, 523 insertions(+) create mode 100644 app/code/Magento/InventoryApi/Api/Data/SourceExtensionInterface.php create mode 100644 app/code/Magento/InventoryApi/Api/Data/SourceInterface.php create mode 100644 app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php create mode 100644 app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php create mode 100644 app/code/Magento/InventoryApi/LICENSE.txt create mode 100644 app/code/Magento/InventoryApi/LICENSE_AFL.txt create mode 100644 app/code/Magento/InventoryApi/README.md create mode 100644 app/code/Magento/InventoryApi/composer.json create mode 100644 app/code/Magento/InventoryApi/etc/module.xml create mode 100644 app/code/Magento/InventoryApi/registration.php diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceExtensionInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceExtensionInterface.php new file mode 100644 index 0000000000000..82c05acac2e1c --- /dev/null +++ b/app/code/Magento/InventoryApi/Api/Data/SourceExtensionInterface.php @@ -0,0 +1,11 @@ +" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. \ No newline at end of file diff --git a/app/code/Magento/InventoryApi/LICENSE_AFL.txt b/app/code/Magento/InventoryApi/LICENSE_AFL.txt new file mode 100644 index 0000000000000..f39d641b18a19 --- /dev/null +++ b/app/code/Magento/InventoryApi/LICENSE_AFL.txt @@ -0,0 +1,48 @@ + +Academic Free License ("AFL") v. 3.0 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Academic Free License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. diff --git a/app/code/Magento/InventoryApi/README.md b/app/code/Magento/InventoryApi/README.md new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/app/code/Magento/InventoryApi/composer.json b/app/code/Magento/InventoryApi/composer.json new file mode 100644 index 0000000000000..661e80602ad45 --- /dev/null +++ b/app/code/Magento/InventoryApi/composer.json @@ -0,0 +1,28 @@ +{ + "name": "magento/module-inventory-api", + "description": "N/A", + "require": { + "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", + "magento/module-store": "100.2.*", + "magento/module-backend": "100.2.*", + "magento/module-customer": "100.2.*", + "magento/module-user": "100.2.*", + "magento/module-security": "100.2.*", + "magento/framework": "100.2.*", + "magento/module-authorization": "100.2.*" + }, + "type": "magento2-module", + "version": "100.2.0-dev", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\InventoryApi\\": "" + } + } +} diff --git a/app/code/Magento/InventoryApi/etc/module.xml b/app/code/Magento/InventoryApi/etc/module.xml new file mode 100644 index 0000000000000..ef47fefb842cc --- /dev/null +++ b/app/code/Magento/InventoryApi/etc/module.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/app/code/Magento/InventoryApi/registration.php b/app/code/Magento/InventoryApi/registration.php new file mode 100644 index 0000000000000..ce0a9c85a875e --- /dev/null +++ b/app/code/Magento/InventoryApi/registration.php @@ -0,0 +1,11 @@ + Date: Sat, 20 May 2017 13:54:46 +0200 Subject: [PATCH 0040/1004] magento-engcom/magento2#25 Update dependencies --- .gitignore | 36 +++ app/code/Magento/InventoryApi/README.md | 5 + app/code/Magento/InventoryApi/composer.json | 10 +- app/code/Magento/InventoryApi/etc/module.xml | 8 +- composer.lock | 297 +++++++++---------- 5 files changed, 192 insertions(+), 164 deletions(-) diff --git a/.gitignore b/.gitignore index 90c60dfa39cad..f4a81c593afa6 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,39 @@ atlassian* !/vendor/.htaccess /generated/* !/generated/.htaccess + +## Sample data +app/code/Magento/BundleSampleData +app/code/Magento/CatalogRuleSampleData +app/code/Magento/CatalogSampleData +app/code/Magento/CmsSampleData +app/code/Magento/ConfigurableSampleData +app/code/Magento/CustomerSampleData +app/code/Magento/DownloadableSampleData +app/code/Magento/GroupedProductSampleData +app/code/Magento/MsrpSampleData +app/code/Magento/OfflineShippingSampleData +app/code/Magento/ProductLinksSampleData +app/code/Magento/ReviewSampleData +app/code/Magento/SalesRuleSampleData +app/code/Magento/SalesSampleData +app/code/Magento/SwatchesSampleData +app/code/Magento/TaxSampleData +app/code/Magento/ThemeSampleData +app/code/Magento/WidgetSampleData +app/code/Magento/WishlistSampleData +app/code/Magento/_InventoryApi/ +dev/tests/functional/tests/app/Magento/BundleSampleData +dev/tests/functional/tests/app/Magento/CatalogSampleData +dev/tests/functional/tests/app/Magento/ConfigurableSampleData +dev/tests/functional/tests/app/Magento/CustomerSampleData +dev/tests/functional/tests/app/Magento/DownloadableSampleData +dev/tests/functional/tests/app/Magento/GroupedProductSampleData +dev/tests/functional/tests/app/Magento/SalesSampleData +dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/sample-data.xml +dev/tests/integration/testsuite/Magento/SampleData/Helper +dev/tests/integration/testsuite/Magento/SampleData/Model/TestLogger.php +dev/tests/integration/testsuite/Magento/SampleData/_files/fixtures +dev/tools/build-sample-data.php +pub/media/catalog +pub/media/wysiwyg diff --git a/app/code/Magento/InventoryApi/README.md b/app/code/Magento/InventoryApi/README.md index e69de29bb2d1d..e10a610def87b 100644 --- a/app/code/Magento/InventoryApi/README.md +++ b/app/code/Magento/InventoryApi/README.md @@ -0,0 +1,5 @@ +# InventoryApi + +**InventoryApi** provides interfaces for inventory management. +See [concept documentation](https://github.com/magento-engcom/magento2/wiki/Technical-Vision.-Catalog-Inventory) +for further information. diff --git a/app/code/Magento/InventoryApi/composer.json b/app/code/Magento/InventoryApi/composer.json index 661e80602ad45..36fb986952cb9 100644 --- a/app/code/Magento/InventoryApi/composer.json +++ b/app/code/Magento/InventoryApi/composer.json @@ -3,16 +3,10 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-user": "100.2.*", - "magento/module-security": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-authorization": "100.2.*" + "magento/framework": "100.2.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.0.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/InventoryApi/etc/module.xml b/app/code/Magento/InventoryApi/etc/module.xml index ef47fefb842cc..9b4ae307339bf 100644 --- a/app/code/Magento/InventoryApi/etc/module.xml +++ b/app/code/Magento/InventoryApi/etc/module.xml @@ -6,11 +6,5 @@ */ --> - - - - - - - + diff --git a/composer.lock b/composer.lock index f4b32154e8370..d89677ac32a6b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,6 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "54e536d6a16773c0efc4d6a7a6e668d4", "content-hash": "83b07861c465af490d6cf0c75adc78fd", "packages": [ { @@ -52,7 +51,7 @@ } ], "description": "Braintree PHP Client Library", - "time": "2017-02-16 19:59:04" + "time": "2017-02-16T19:59:04+00:00" }, { "name": "colinmollenhour/cache-backend-file", @@ -88,7 +87,7 @@ ], "description": "The stock Zend_Cache_Backend_File backend has extremely poor performance for cleaning by tags making it become unusable as the number of cached items increases. This backend makes many changes resulting in a huge performance boost, especially for tag cleaning.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_File", - "time": "2016-05-02 16:24:47" + "time": "2016-05-02T16:24:47+00:00" }, { "name": "colinmollenhour/cache-backend-redis", @@ -124,7 +123,7 @@ ], "description": "Zend_Cache backend using Redis with full support for tags.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_Redis", - "time": "2017-03-25 04:54:24" + "time": "2017-03-25T04:54:24+00:00" }, { "name": "colinmollenhour/credis", @@ -163,7 +162,7 @@ ], "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", "homepage": "https://github.com/colinmollenhour/credis", - "time": "2015-11-28 01:20:04" + "time": "2015-11-28T01:20:04+00:00" }, { "name": "colinmollenhour/php-redis-session-abstract", @@ -200,7 +199,7 @@ ], "description": "A Redis-based session handler with optimistic locking", "homepage": "https://github.com/colinmollenhour/php-redis-session-abstract", - "time": "2017-04-19 14:21:43" + "time": "2017-04-19T14:21:43+00:00" }, { "name": "composer/ca-bundle", @@ -259,7 +258,7 @@ "ssl", "tls" ], - "time": "2017-03-06 11:59:08" + "time": "2017-03-06T11:59:08+00:00" }, { "name": "composer/composer", @@ -336,7 +335,7 @@ "dependency", "package" ], - "time": "2017-03-10 08:29:45" + "time": "2017-03-10T08:29:45+00:00" }, { "name": "composer/semver", @@ -398,7 +397,7 @@ "validation", "versioning" ], - "time": "2016-08-30 16:08:34" + "time": "2016-08-30T16:08:34+00:00" }, { "name": "composer/spdx-licenses", @@ -459,7 +458,7 @@ "spdx", "validator" ], - "time": "2017-04-03 19:08:52" + "time": "2017-04-03T19:08:52+00:00" }, { "name": "container-interop/container-interop", @@ -490,20 +489,20 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14 19:40:03" + "time": "2017-02-14T19:40:03+00:00" }, { "name": "justinrainbow/json-schema", - "version": "5.2.0", + "version": "5.2.1", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "e3c9bccdc38bbd09bcac0131c00f3be58368b416" + "reference": "429be236f296ca249d61c65649cdf2652f4a5e80" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/e3c9bccdc38bbd09bcac0131c00f3be58368b416", - "reference": "e3c9bccdc38bbd09bcac0131c00f3be58368b416", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/429be236f296ca249d61c65649cdf2652f4a5e80", + "reference": "429be236f296ca249d61c65649cdf2652f4a5e80", "shasum": "" }, "require": { @@ -512,7 +511,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^2.1", "json-schema/json-schema-test-suite": "1.2.0", - "phpdocumentor/phpdocumentor": "~2", + "phpdocumentor/phpdocumentor": "^2.7", "phpunit/phpunit": "^4.8.22" }, "bin": [ @@ -557,7 +556,7 @@ "json", "schema" ], - "time": "2017-03-22 22:43:35" + "time": "2017-05-16T21:06:09+00:00" }, { "name": "league/climate", @@ -606,7 +605,7 @@ "php", "terminal" ], - "time": "2015-01-18 14:31:58" + "time": "2015-01-18T14:31:58+00:00" }, { "name": "magento/composer", @@ -642,7 +641,7 @@ "AFL-3.0" ], "description": "Magento composer library helps to instantiate Composer application and run composer commands.", - "time": "2017-04-24 09:57:02" + "time": "2017-04-24T09:57:02+00:00" }, { "name": "magento/magento-composer-installer", @@ -721,7 +720,7 @@ "composer-installer", "magento" ], - "time": "2016-10-06 16:05:07" + "time": "2016-10-06T16:05:07+00:00" }, { "name": "magento/zendframework1", @@ -768,7 +767,7 @@ "ZF1", "framework" ], - "time": "2017-04-24 09:56:59" + "time": "2017-04-24T09:56:59+00:00" }, { "name": "monolog/monolog", @@ -846,7 +845,7 @@ "logging", "psr-3" ], - "time": "2017-03-13 07:08:03" + "time": "2017-03-13T07:08:03+00:00" }, { "name": "oyejorge/less.php", @@ -908,7 +907,7 @@ "php", "stylesheet" ], - "time": "2017-03-28 22:19:25" + "time": "2017-03-28T22:19:25+00:00" }, { "name": "paragonie/random_compat", @@ -956,7 +955,7 @@ "pseudorandom", "random" ], - "time": "2017-03-13 16:27:32" + "time": "2017-03-13T16:27:32+00:00" }, { "name": "pelago/emogrifier", @@ -1012,20 +1011,20 @@ ], "description": "Converts CSS styles into inline style attributes in your HTML code", "homepage": "http://www.pelagodesign.com/sidecar/emogrifier/", - "time": "2015-05-15 11:37:51" + "time": "2015-05-15T11:37:51+00:00" }, { "name": "phpseclib/phpseclib", - "version": "2.0.4", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf" + "reference": "f8dd0e18d2328c447dd4190fecd11ef52680d968" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/ab8028c93c03cc8d9c824efa75dc94f1db2369bf", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/f8dd0e18d2328c447dd4190fecd11ef52680d968", + "reference": "f8dd0e18d2328c447dd4190fecd11ef52680d968", "shasum": "" }, "require": { @@ -1104,7 +1103,7 @@ "x.509", "x509" ], - "time": "2016-10-04 00:57:04" + "time": "2017-05-08T05:58:35+00:00" }, { "name": "psr/container", @@ -1153,7 +1152,7 @@ "container-interop", "psr" ], - "time": "2017-02-14 16:28:37" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/log", @@ -1200,7 +1199,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "ramsey/uuid", @@ -1282,7 +1281,7 @@ "identifier", "uuid" ], - "time": "2017-03-26 20:37:53" + "time": "2017-03-26T20:37:53+00:00" }, { "name": "seld/cli-prompt", @@ -1330,7 +1329,7 @@ "input", "prompt" ], - "time": "2017-03-18 11:32:45" + "time": "2017-03-18T11:32:45+00:00" }, { "name": "seld/jsonlint", @@ -1379,7 +1378,7 @@ "parser", "validator" ], - "time": "2017-03-06 16:42:24" + "time": "2017-03-06T16:42:24+00:00" }, { "name": "seld/phar-utils", @@ -1423,7 +1422,7 @@ "keywords": [ "phra" ], - "time": "2015-10-13 18:44:15" + "time": "2015-10-13T18:44:15+00:00" }, { "name": "sjparkinson/static-review", @@ -1476,7 +1475,7 @@ } ], "description": "An extendable framework for version control hooks.", - "time": "2014-09-22 08:40:36" + "time": "2014-09-22T08:40:36+00:00" }, { "name": "symfony/console", @@ -1537,7 +1536,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-04-26 01:38:53" + "time": "2017-04-26T01:38:53+00:00" }, { "name": "symfony/debug", @@ -1594,7 +1593,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-07-30 07:22:48" + "time": "2016-07-30T07:22:48+00:00" }, { "name": "symfony/event-dispatcher", @@ -1654,7 +1653,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-04-26 16:56:54" + "time": "2017-04-26T16:56:54+00:00" }, { "name": "symfony/filesystem", @@ -1703,7 +1702,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/finder", @@ -1752,7 +1751,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1811,7 +1810,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/process", @@ -1860,7 +1859,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:07:15" + "time": "2017-04-12T14:07:15+00:00" }, { "name": "tedivm/jshrink", @@ -1906,7 +1905,7 @@ "javascript", "minifier" ], - "time": "2015-07-04 07:35:09" + "time": "2015-07-04T07:35:09+00:00" }, { "name": "tubalmartin/cssmin", @@ -1954,7 +1953,7 @@ "minify", "yui" ], - "time": "2017-04-04 14:33:00" + "time": "2017-04-04T14:33:00+00:00" }, { "name": "zendframework/zend-captcha", @@ -2011,7 +2010,7 @@ "captcha", "zf2" ], - "time": "2017-02-23 08:09:44" + "time": "2017-02-23T08:09:44+00:00" }, { "name": "zendframework/zend-code", @@ -2064,7 +2063,7 @@ "code", "zf2" ], - "time": "2016-10-24 13:23:32" + "time": "2016-10-24T13:23:32+00:00" }, { "name": "zendframework/zend-config", @@ -2120,7 +2119,7 @@ "config", "zf2" ], - "time": "2016-02-04 23:01:10" + "time": "2016-02-04T23:01:10+00:00" }, { "name": "zendframework/zend-console", @@ -2172,7 +2171,7 @@ "console", "zf2" ], - "time": "2016-02-09 17:15:12" + "time": "2016-02-09T17:15:12+00:00" }, { "name": "zendframework/zend-crypt", @@ -2222,7 +2221,7 @@ "crypt", "zf2" ], - "time": "2016-02-03 23:46:30" + "time": "2016-02-03T23:46:30+00:00" }, { "name": "zendframework/zend-db", @@ -2279,7 +2278,7 @@ "db", "zf2" ], - "time": "2016-08-09 19:28:55" + "time": "2016-08-09T19:28:55+00:00" }, { "name": "zendframework/zend-di", @@ -2326,7 +2325,7 @@ "di", "zf2" ], - "time": "2016-04-25 20:58:11" + "time": "2016-04-25T20:58:11+00:00" }, { "name": "zendframework/zend-escaper", @@ -2370,7 +2369,7 @@ "escaper", "zf2" ], - "time": "2016-06-30 19:48:38" + "time": "2016-06-30T19:48:38+00:00" }, { "name": "zendframework/zend-eventmanager", @@ -2417,20 +2416,20 @@ "eventmanager", "zf2" ], - "time": "2016-02-18 20:49:05" + "time": "2016-02-18T20:49:05+00:00" }, { "name": "zendframework/zend-filter", - "version": "2.7.1", + "version": "2.7.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-filter.git", - "reference": "84c50246428efb0a1e52868e162dab3e149d5b80" + "reference": "b8d0ff872f126631bf63a932e33aa2d22d467175" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/84c50246428efb0a1e52868e162dab3e149d5b80", - "reference": "84c50246428efb0a1e52868e162dab3e149d5b80", + "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/b8d0ff872f126631bf63a932e33aa2d22d467175", + "reference": "b8d0ff872f126631bf63a932e33aa2d22d467175", "shasum": "" }, "require": { @@ -2438,10 +2437,10 @@ "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", "pear/archive_tar": "^1.4", - "phpunit/phpunit": "~4.0", - "zendframework/zend-crypt": "^2.6", + "phpunit/phpunit": "^6.0.10 || ^5.7.17", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-crypt": "^2.6 || ^3.0", "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", "zendframework/zend-uri": "^2.5" }, @@ -2477,20 +2476,20 @@ "filter", "zf2" ], - "time": "2016-04-18 18:32:43" + "time": "2017-05-17T20:56:17+00:00" }, { "name": "zendframework/zend-form", - "version": "2.10.1", + "version": "2.10.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-form.git", - "reference": "1ca3ab771abd533d440646ec1cc082fccad976a1" + "reference": "252db729887844025772bb8045f8df605850ed9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-form/zipball/1ca3ab771abd533d440646ec1cc082fccad976a1", - "reference": "1ca3ab771abd533d440646ec1cc082fccad976a1", + "url": "https://api.github.com/repos/zendframework/zend-form/zipball/252db729887844025772bb8045f8df605850ed9c", + "reference": "252db729887844025772bb8045f8df605850ed9c", "shasum": "" }, "require": { @@ -2554,7 +2553,7 @@ "form", "zf2" ], - "time": "2017-04-26 21:27:43" + "time": "2017-05-18T14:59:53+00:00" }, { "name": "zendframework/zend-http", @@ -2604,7 +2603,7 @@ "http", "zf2" ], - "time": "2017-01-31 14:41:02" + "time": "2017-01-31T14:41:02+00:00" }, { "name": "zendframework/zend-hydrator", @@ -2662,30 +2661,30 @@ "hydrator", "zf2" ], - "time": "2016-02-18 22:38:26" + "time": "2016-02-18T22:38:26+00:00" }, { "name": "zendframework/zend-i18n", - "version": "2.7.3", + "version": "2.7.4", "source": { "type": "git", "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "b2db0d8246a865c659f93199f90f5fc2cd2f3cd8" + "reference": "d3431e29cc00c2a1c6704e601d4371dbf24f6a31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/b2db0d8246a865c659f93199f90f5fc2cd2f3cd8", - "reference": "b2db0d8246a865c659f93199f90f5fc2cd2f3cd8", + "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/d3431e29cc00c2a1c6704e601d4371dbf24f6a31", + "reference": "d3431e29cc00c2a1c6704e601d4371dbf24f6a31", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", + "php": "^7.0 || ^5.6", "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", + "phpunit/phpunit": "^6.0.8 || ^5.7.15", "zendframework/zend-cache": "^2.6.1", + "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-config": "^2.6", "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", "zendframework/zend-filter": "^2.6.1", @@ -2729,31 +2728,31 @@ "i18n", "zf2" ], - "time": "2016-06-07 21:08:30" + "time": "2017-05-17T17:00:12+00:00" }, { "name": "zendframework/zend-inputfilter", - "version": "2.7.3", + "version": "2.7.4", "source": { "type": "git", "url": "https://github.com/zendframework/zend-inputfilter.git", - "reference": "0cf1bdcd8858a8583965310a7dae63ad75bd1237" + "reference": "699ab4916e0aa73104e1f9ff068ef6d33c5f5fe4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-inputfilter/zipball/0cf1bdcd8858a8583965310a7dae63ad75bd1237", - "reference": "0cf1bdcd8858a8583965310a7dae63ad75bd1237", + "url": "https://api.github.com/repos/zendframework/zend-inputfilter/zipball/699ab4916e0aa73104e1f9ff068ef6d33c5f5fe4", + "reference": "699ab4916e0aa73104e1f9ff068ef6d33c5f5fe4", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", + "php": "^7.0 || ^5.6", "zendframework/zend-filter": "^2.6", "zendframework/zend-stdlib": "^2.7 || ^3.0", "zendframework/zend-validator": "^2.6" }, "require-dev": { - "phpunit/phpunit": "^4.8", - "squizlabs/php_codesniffer": "^2.6.2", + "phpunit/phpunit": "^6.0.8 || ^5.7.15", + "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" }, "suggest": { @@ -2784,7 +2783,7 @@ "inputfilter", "zf2" ], - "time": "2016-08-18 18:40:34" + "time": "2017-05-18T14:20:56+00:00" }, { "name": "zendframework/zend-json", @@ -2839,7 +2838,7 @@ "json", "zf2" ], - "time": "2016-02-04 21:20:26" + "time": "2016-02-04T21:20:26+00:00" }, { "name": "zendframework/zend-loader", @@ -2883,20 +2882,20 @@ "loader", "zf2" ], - "time": "2015-06-03 14:05:47" + "time": "2015-06-03T14:05:47+00:00" }, { "name": "zendframework/zend-log", - "version": "2.9.1", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-log.git", - "reference": "115d75db1f8fb29efbf1b9a49cb91c662b7195dc" + "reference": "bf7489578d092d6ff7508117d1d920a4764fbd6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-log/zipball/115d75db1f8fb29efbf1b9a49cb91c662b7195dc", - "reference": "115d75db1f8fb29efbf1b9a49cb91c662b7195dc", + "url": "https://api.github.com/repos/zendframework/zend-log/zipball/bf7489578d092d6ff7508117d1d920a4764fbd6a", + "reference": "bf7489578d092d6ff7508117d1d920a4764fbd6a", "shasum": "" }, "require": { @@ -2909,9 +2908,9 @@ "psr/log-implementation": "1.0.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~1.7.0", "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "~4.0", + "phpunit/phpunit": "^5.7.15 || ^6.0.8", + "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-db": "^2.6", "zendframework/zend-escaper": "^2.5", "zendframework/zend-filter": "^2.5", @@ -2954,7 +2953,7 @@ "logging", "zf2" ], - "time": "2016-08-11 13:44:10" + "time": "2017-05-17T16:03:26+00:00" }, { "name": "zendframework/zend-math", @@ -3004,7 +3003,7 @@ "math", "zf2" ], - "time": "2016-04-07 16:29:53" + "time": "2016-04-07T16:29:53+00:00" }, { "name": "zendframework/zend-modulemanager", @@ -3063,7 +3062,7 @@ "modulemanager", "zf2" ], - "time": "2016-05-16 21:21:11" + "time": "2016-05-16T21:21:11+00:00" }, { "name": "zendframework/zend-mvc", @@ -3150,7 +3149,7 @@ "mvc", "zf2" ], - "time": "2016-02-23 15:24:59" + "time": "2016-02-23T15:24:59+00:00" }, { "name": "zendframework/zend-serializer", @@ -3207,7 +3206,7 @@ "serializer", "zf2" ], - "time": "2016-06-21 17:01:55" + "time": "2016-06-21T17:01:55+00:00" }, { "name": "zendframework/zend-server", @@ -3253,7 +3252,7 @@ "server", "zf2" ], - "time": "2016-06-20 22:27:55" + "time": "2016-06-20T22:27:55+00:00" }, { "name": "zendframework/zend-servicemanager", @@ -3305,7 +3304,7 @@ "servicemanager", "zf2" ], - "time": "2016-12-19 19:14:29" + "time": "2016-12-19T19:14:29+00:00" }, { "name": "zendframework/zend-session", @@ -3371,7 +3370,7 @@ "session", "zf2" ], - "time": "2016-07-05 18:32:50" + "time": "2016-07-05T18:32:50+00:00" }, { "name": "zendframework/zend-soap", @@ -3423,7 +3422,7 @@ "soap", "zf2" ], - "time": "2016-04-21 16:06:27" + "time": "2016-04-21T16:06:27+00:00" }, { "name": "zendframework/zend-stdlib", @@ -3482,7 +3481,7 @@ "stdlib", "zf2" ], - "time": "2016-04-12 21:17:31" + "time": "2016-04-12T21:17:31+00:00" }, { "name": "zendframework/zend-text", @@ -3529,7 +3528,7 @@ "text", "zf2" ], - "time": "2016-02-08 19:03:52" + "time": "2016-02-08T19:03:52+00:00" }, { "name": "zendframework/zend-uri", @@ -3576,20 +3575,20 @@ "uri", "zf2" ], - "time": "2016-02-17 22:38:51" + "time": "2016-02-17T22:38:51+00:00" }, { "name": "zendframework/zend-validator", - "version": "2.9.0", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-validator.git", - "reference": "b71641582297eab52753b72cd4eb45a5ded4485c" + "reference": "c9a8160a0191e34bb98ac1ecd4e453391c424bb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/b71641582297eab52753b72cd4eb45a5ded4485c", - "reference": "b71641582297eab52753b72cd4eb45a5ded4485c", + "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/c9a8160a0191e34bb98ac1ecd4e453391c424bb3", + "reference": "c9a8160a0191e34bb98ac1ecd4e453391c424bb3", "shasum": "" }, "require": { @@ -3647,7 +3646,7 @@ "validator", "zf2" ], - "time": "2017-03-17 10:15:50" + "time": "2017-05-17T22:06:13+00:00" }, { "name": "zendframework/zend-view", @@ -3734,7 +3733,7 @@ "view", "zf2" ], - "time": "2017-03-21 15:05:56" + "time": "2017-03-21T15:05:56+00:00" } ], "packages-dev": [ @@ -3790,7 +3789,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -3860,7 +3859,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2017-03-31 12:59:38" + "time": "2017-03-31T12:59:38+00:00" }, { "name": "ircmaxell/password-compat", @@ -3902,7 +3901,7 @@ "hashing", "password" ], - "time": "2014-11-20 16:49:30" + "time": "2014-11-20T16:49:30+00:00" }, { "name": "lusitanian/oauth", @@ -3969,7 +3968,7 @@ "oauth", "security" ], - "time": "2016-07-12 22:15:40" + "time": "2016-07-12T22:15:40+00:00" }, { "name": "pdepend/pdepend", @@ -4009,7 +4008,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2017-01-19 14:23:36" + "time": "2017-01-19T14:23:36+00:00" }, { "name": "phpmd/phpmd", @@ -4075,7 +4074,7 @@ "phpmd", "pmd" ], - "time": "2017-01-20 14:41:10" + "time": "2017-01-20T14:41:10+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4137,7 +4136,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4182,7 +4181,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2013-10-10T15:34:57+00:00" }, { "name": "phpunit/php-text-template", @@ -4223,7 +4222,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -4272,7 +4271,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", @@ -4321,7 +4320,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27 10:12:30" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", @@ -4395,7 +4394,7 @@ "testing", "xunit" ], - "time": "2014-05-02 07:13:40" + "time": "2014-05-02T07:13:40+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -4451,7 +4450,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", @@ -4515,27 +4514,27 @@ "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "3c7d21999e815cdfac70c6c7d79d3a9cb1bc7bc2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3c7d21999e815cdfac70c6c7d79d3a9cb1bc7bc2", + "reference": "3c7d21999e815cdfac70c6c7d79d3a9cb1bc7bc2", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -4567,7 +4566,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2017-05-18T13:44:30+00:00" }, { "name": "sebastian/environment", @@ -4617,7 +4616,7 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", @@ -4684,7 +4683,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/finder-facade", @@ -4723,7 +4722,7 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2016-02-17 07:02:23" + "time": "2016-02-17T07:02:23+00:00" }, { "name": "sebastian/phpcpd", @@ -4774,7 +4773,7 @@ ], "description": "Copy/Paste Detector (CPD) for PHP code.", "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2016-04-17 19:32:49" + "time": "2016-04-17T19:32:49+00:00" }, { "name": "sebastian/recursion-context", @@ -4827,7 +4826,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03 07:41:43" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", @@ -4862,7 +4861,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -4937,7 +4936,7 @@ "phpcs", "standards" ], - "time": "2014-05-01 03:07:07" + "time": "2014-05-01T03:07:07+00:00" }, { "name": "symfony/config", @@ -4993,7 +4992,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/dependency-injection", @@ -5053,7 +5052,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-01-28 00:04:57" + "time": "2017-01-28T00:04:57+00:00" }, { "name": "symfony/polyfill-php54", @@ -5111,7 +5110,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/polyfill-php55", @@ -5167,7 +5166,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/polyfill-php70", @@ -5226,7 +5225,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/polyfill-xml", @@ -5284,7 +5283,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/stopwatch", @@ -5333,7 +5332,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/yaml", @@ -5382,7 +5381,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-05-01 14:31:55" + "time": "2017-05-01T14:31:55+00:00" }, { "name": "theseer/fdomdocument", @@ -5422,7 +5421,7 @@ ], "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2017-04-21 14:50:31" + "time": "2017-04-21T14:50:31+00:00" } ], "aliases": [], From 4a96bade07b31aebd75a69b58a8ecd24691aca7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20R=C3=B6ttig?= Date: Sat, 20 May 2017 14:07:33 +0200 Subject: [PATCH 0041/1004] magento-engcom/magento2#25 Add new Inventory Module --- app/code/Magento/Inventory/LICENSE.txt | 48 +++++++++++++++++++++ app/code/Magento/Inventory/LICENSE_AFL.txt | 48 +++++++++++++++++++++ app/code/Magento/Inventory/README.md | 5 +++ app/code/Magento/Inventory/composer.json | 22 ++++++++++ app/code/Magento/Inventory/etc/module.xml | 14 ++++++ app/code/Magento/Inventory/registration.php | 11 +++++ 6 files changed, 148 insertions(+) create mode 100644 app/code/Magento/Inventory/LICENSE.txt create mode 100644 app/code/Magento/Inventory/LICENSE_AFL.txt create mode 100644 app/code/Magento/Inventory/README.md create mode 100644 app/code/Magento/Inventory/composer.json create mode 100644 app/code/Magento/Inventory/etc/module.xml create mode 100644 app/code/Magento/Inventory/registration.php diff --git a/app/code/Magento/Inventory/LICENSE.txt b/app/code/Magento/Inventory/LICENSE.txt new file mode 100644 index 0000000000000..49525fd99da9c --- /dev/null +++ b/app/code/Magento/Inventory/LICENSE.txt @@ -0,0 +1,48 @@ + +Open Software License ("OSL") v. 3.0 + +This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Open Software License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. \ No newline at end of file diff --git a/app/code/Magento/Inventory/LICENSE_AFL.txt b/app/code/Magento/Inventory/LICENSE_AFL.txt new file mode 100644 index 0000000000000..f39d641b18a19 --- /dev/null +++ b/app/code/Magento/Inventory/LICENSE_AFL.txt @@ -0,0 +1,48 @@ + +Academic Free License ("AFL") v. 3.0 + +This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: + +Licensed under the Academic Free License version 3.0 + + 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: + + 1. to reproduce the Original Work in copies, either alone or as part of a collective work; + + 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; + + 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License; + + 4. to perform the Original Work publicly; and + + 5. to display the Original Work publicly. + + 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. + + 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. + + 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. + + 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). + + 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. + + 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. + + 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. + + 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). + + 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. + + 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. + + 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. + + 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. + + 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + + 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. + + 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process. diff --git a/app/code/Magento/Inventory/README.md b/app/code/Magento/Inventory/README.md new file mode 100644 index 0000000000000..2defd616b65fb --- /dev/null +++ b/app/code/Magento/Inventory/README.md @@ -0,0 +1,5 @@ +# Inventory + +**Inventory** provides implementation for inventory management. +See [concept documentation](https://github.com/magento-engcom/magento2/wiki/Technical-Vision.-Catalog-Inventory) +for further information. diff --git a/app/code/Magento/Inventory/composer.json b/app/code/Magento/Inventory/composer.json new file mode 100644 index 0000000000000..dd85f89e58ecf --- /dev/null +++ b/app/code/Magento/Inventory/composer.json @@ -0,0 +1,22 @@ +{ + "name": "magento/module-inventory", + "description": "N/A", + "require": { + "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", + "magento/framework": "100.2.*" + }, + "type": "magento2-module", + "version": "100.0.0-dev", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\InventoryApi\\": "" + } + } +} diff --git a/app/code/Magento/Inventory/etc/module.xml b/app/code/Magento/Inventory/etc/module.xml new file mode 100644 index 0000000000000..2ef165277a57f --- /dev/null +++ b/app/code/Magento/Inventory/etc/module.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/app/code/Magento/Inventory/registration.php b/app/code/Magento/Inventory/registration.php new file mode 100644 index 0000000000000..55b1734a5250d --- /dev/null +++ b/app/code/Magento/Inventory/registration.php @@ -0,0 +1,11 @@ + Date: Sat, 20 May 2017 14:18:01 +0200 Subject: [PATCH 0042/1004] magento-engcom/magento2#25: Update dependencies between inventory and inventory-api module --- app/code/Magento/Inventory/composer.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Inventory/composer.json b/app/code/Magento/Inventory/composer.json index dd85f89e58ecf..2d2c539770841 100644 --- a/app/code/Magento/Inventory/composer.json +++ b/app/code/Magento/Inventory/composer.json @@ -3,7 +3,8 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*" + "magento/framework": "100.2.*", + "magento/module-inventory-api": "100.0.*" }, "type": "magento2-module", "version": "100.0.0-dev", @@ -16,7 +17,7 @@ "registration.php" ], "psr-4": { - "Magento\\InventoryApi\\": "" + "Magento\\Inventory\\": "" } } } From 930a5206e82f974325c521368e6257fcde9c55f9 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 14:43:38 +0200 Subject: [PATCH 0043/1004] magento-engcom/magento2#25 remove chagnes from .gitignore file --- .gitignore | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/.gitignore b/.gitignore index f4a81c593afa6..90c60dfa39cad 100644 --- a/.gitignore +++ b/.gitignore @@ -65,39 +65,3 @@ atlassian* !/vendor/.htaccess /generated/* !/generated/.htaccess - -## Sample data -app/code/Magento/BundleSampleData -app/code/Magento/CatalogRuleSampleData -app/code/Magento/CatalogSampleData -app/code/Magento/CmsSampleData -app/code/Magento/ConfigurableSampleData -app/code/Magento/CustomerSampleData -app/code/Magento/DownloadableSampleData -app/code/Magento/GroupedProductSampleData -app/code/Magento/MsrpSampleData -app/code/Magento/OfflineShippingSampleData -app/code/Magento/ProductLinksSampleData -app/code/Magento/ReviewSampleData -app/code/Magento/SalesRuleSampleData -app/code/Magento/SalesSampleData -app/code/Magento/SwatchesSampleData -app/code/Magento/TaxSampleData -app/code/Magento/ThemeSampleData -app/code/Magento/WidgetSampleData -app/code/Magento/WishlistSampleData -app/code/Magento/_InventoryApi/ -dev/tests/functional/tests/app/Magento/BundleSampleData -dev/tests/functional/tests/app/Magento/CatalogSampleData -dev/tests/functional/tests/app/Magento/ConfigurableSampleData -dev/tests/functional/tests/app/Magento/CustomerSampleData -dev/tests/functional/tests/app/Magento/DownloadableSampleData -dev/tests/functional/tests/app/Magento/GroupedProductSampleData -dev/tests/functional/tests/app/Magento/SalesSampleData -dev/tests/functional/testsuites/Magento/Mtf/TestSuite/InjectableTests/sample-data.xml -dev/tests/integration/testsuite/Magento/SampleData/Helper -dev/tests/integration/testsuite/Magento/SampleData/Model/TestLogger.php -dev/tests/integration/testsuite/Magento/SampleData/_files/fixtures -dev/tools/build-sample-data.php -pub/media/catalog -pub/media/wysiwyg From e16e339fa705ff599a11eb544fe752f7bd563129 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 14:45:19 +0200 Subject: [PATCH 0044/1004] magento-engcom/magento2#24: Implement web API route configuration --- app/code/Magento/Inventory/etc/acl.xml | 18 ++++++++++++ app/code/Magento/Inventory/etc/webapi.xml | 34 +++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 app/code/Magento/Inventory/etc/acl.xml create mode 100644 app/code/Magento/Inventory/etc/webapi.xml diff --git a/app/code/Magento/Inventory/etc/acl.xml b/app/code/Magento/Inventory/etc/acl.xml new file mode 100644 index 0000000000000..6ee353447968e --- /dev/null +++ b/app/code/Magento/Inventory/etc/acl.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/app/code/Magento/Inventory/etc/webapi.xml b/app/code/Magento/Inventory/etc/webapi.xml new file mode 100644 index 0000000000000..746582646932a --- /dev/null +++ b/app/code/Magento/Inventory/etc/webapi.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 2b0a551b155c494cdbfb284ccbb0445d8ab2aec1 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Sat, 20 May 2017 15:05:47 +0200 Subject: [PATCH 0045/1004] magento-engcom/magento2#25: Source API Implementation --- .../Magento/InventoryApi/Api/Data/SourceInterface.php | 9 +++++++-- .../Api/Data/SourceSearchResultsInterface.php | 5 ++++- .../InventoryApi/Api/SourceRepositoryInterface.php | 5 ++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php index dd8a864b3088b..acc63d213b421 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php @@ -1,11 +1,16 @@ Date: Sat, 20 May 2017 15:11:33 +0200 Subject: [PATCH 0046/1004] magento-engcom/magento2#24: Move ACL and WebApi routes to InterfaceApi module --- app/code/Magento/{Inventory => InventoryApi}/etc/acl.xml | 0 app/code/Magento/{Inventory => InventoryApi}/etc/webapi.xml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename app/code/Magento/{Inventory => InventoryApi}/etc/acl.xml (100%) rename app/code/Magento/{Inventory => InventoryApi}/etc/webapi.xml (100%) diff --git a/app/code/Magento/Inventory/etc/acl.xml b/app/code/Magento/InventoryApi/etc/acl.xml similarity index 100% rename from app/code/Magento/Inventory/etc/acl.xml rename to app/code/Magento/InventoryApi/etc/acl.xml diff --git a/app/code/Magento/Inventory/etc/webapi.xml b/app/code/Magento/InventoryApi/etc/webapi.xml similarity index 100% rename from app/code/Magento/Inventory/etc/webapi.xml rename to app/code/Magento/InventoryApi/etc/webapi.xml From 2acced57c147b8edf1fa7cb250a08b35b04ac95d Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 15:13:55 +0200 Subject: [PATCH 0047/1004] magento-engcom/magento2#25: Remove \Magento\InventoryApi\Api\Data\SourceExtensionInterface as it will be autogenerated --- .../Api/Data/SourceExtensionInterface.php | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 app/code/Magento/InventoryApi/Api/Data/SourceExtensionInterface.php diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceExtensionInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceExtensionInterface.php deleted file mode 100644 index 82c05acac2e1c..0000000000000 --- a/app/code/Magento/InventoryApi/Api/Data/SourceExtensionInterface.php +++ /dev/null @@ -1,11 +0,0 @@ - Date: Sat, 20 May 2017 15:25:00 +0200 Subject: [PATCH 0048/1004] magento-engcom/magento2#25: Source API Implementation --- .../Api/Data/SourceSearchResultsInterface.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php index 1cd94bedb6aa5..2a24ead8fe56a 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php @@ -5,10 +5,25 @@ */ namespace Magento\InventoryApi\Api\Data; +use Magento\Framework\Api\SearchResultsInterface; + /** * @api */ -interface SourceSearchResultsInterface +interface SourceSearchResultsInterface extends SearchResultsInterface { + /** + * Get sources list. + * + * @return \Magento\InventoryApi\Api\Data\SourceInterface[] + */ + public function getItems(); -} \ No newline at end of file + /** + * Set sources list. + * + * @param \Magento\InventoryApi\Api\Data\SourceInterface[] $items + * @return $this + */ + public function setItems(array $items); +} From bb10b2ae5db1ea5424773dd45bef7c7c46b04afc Mon Sep 17 00:00:00 2001 From: Nils Date: Sat, 20 May 2017 15:58:44 +0200 Subject: [PATCH 0049/1004] magento-engcom/magento2#7 Add missing empty interface class --- .../Api/Data/SourceCarrierLinkInterface.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php new file mode 100644 index 0000000000000..57ada1c5788a2 --- /dev/null +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -0,0 +1,15 @@ + Date: Sat, 20 May 2017 16:09:33 +0200 Subject: [PATCH 0050/1004] Filled SourceCarrierLinkInterface with some methods --- .../Api/Data/SourceCarrierLinkInterface.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index 57ada1c5788a2..465601115393f 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -9,7 +9,24 @@ namespace Magento\InventoryApi\Api\Data; +use Magento\Shipping\Model\Carrier\CarrierInterface; + interface SourceCarrierLinkInterface { + /** + * @param SourceInterface $source + * @return void + */ + public function setSource(SourceInterface $source); + + /** + * @param CarrierInterface $carrier + * @return void + */ + public function setCarrier(CarrierInterface $carrier); + /** + * @return $this + */ + public function getSourceCarrierLink(); } \ No newline at end of file From 4999f0d961b1e655d0182f5af9605824892845a9 Mon Sep 17 00:00:00 2001 From: Thomas Kreidenhuber Date: Sat, 20 May 2017 16:09:39 +0200 Subject: [PATCH 0051/1004] magento-engcom/magento2#25 Implemented Resourcemodel, Collection and part of the businessmodel for source --- .../Inventory/Model/Resource/Source.php | 27 + .../Model/Resource/Source/Collection.php | 31 ++ app/code/Magento/Inventory/Model/Source.php | 465 ++++++++++++++++++ 3 files changed, 523 insertions(+) create mode 100644 app/code/Magento/Inventory/Model/Resource/Source.php create mode 100644 app/code/Magento/Inventory/Model/Resource/Source/Collection.php create mode 100644 app/code/Magento/Inventory/Model/Source.php diff --git a/app/code/Magento/Inventory/Model/Resource/Source.php b/app/code/Magento/Inventory/Model/Resource/Source.php new file mode 100644 index 0000000000000..5eeae65abdf7f --- /dev/null +++ b/app/code/Magento/Inventory/Model/Resource/Source.php @@ -0,0 +1,27 @@ +_init(InstallSchema::TABLE_NAME_SOURCE, SourceInterface::SOURCE_ID); + } +} \ No newline at end of file diff --git a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php new file mode 100644 index 0000000000000..f1f8170a8bd3b --- /dev/null +++ b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php @@ -0,0 +1,31 @@ +_init(SourceModel::class, ResourceSource::class); + } + + /** + * Id field name getter + * + * @return string + */ + public function getIdFieldName() + { + return SourceInterface::SOURCE_ID; + } +} \ No newline at end of file diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php new file mode 100644 index 0000000000000..3a3092e116c44 --- /dev/null +++ b/app/code/Magento/Inventory/Model/Source.php @@ -0,0 +1,465 @@ +_init('Magento\Inventory\Model\Resource\Source'); + } + + /** + * Get source id. + * + * @return int|null + */ + public function getSourceId() + { + return $this->getData(SourceInterface::SOURCE_ID); + } + + /** + * Set source id. + * + * @param int $sourceId + * + * @return $this + */ + public function setSourceId($sourceId) + { + $this->setData(SourceInterface::SOURCE_ID, $sourceId); + return $this; + } + + /** + * Get source name. + * + * @return string + */ + public function getName() + { + return $this->getData(SourceInterface::NAME); + } + + /** + * Set source name. + * + * @param string $name + * + * @return $this + */ + public function setName($name) + { + $this->setData(SourceInterface::NAME, $name); + return $this; + } + + /** + * Get source email + * + * @return string + */ + public function getEmail() + { + return $this->getData(SourceInterface::EMAIL); + } + + /** + * Set source email + * + * @param string $email + * + * @return $this + */ + public function setEmail($email) + { + $this->setData(SourceInterface::EMAIL, $email); + return $this; + } + + /** + * Get source contact name. + * + * @return string + */ + public function getContactName() + { + return $this->getData(SourceInterface::CONTACT_NAME); + } + + /** + * Set source contact name. + * + * @param string $contactName + * + * @return $this + */ + public function setContactName($contactName) + { + $this->setData(SourceInterface::CONTACT_NAME, $contactName); + return $this; + } + + /** + * Check if source is enabled. + * + * @return bool + */ + public function getIsActive() + { + return $this->getData(SourceInterface::IS_ACTIVE); + } + + /** + * Enable or disable source. + * + * @param bool $active + * + * @return $this + */ + public function setIsActive($active) + { + $this->setData(SourceInterface::IS_ACTIVE, $active); + return $this; + } + + /** + * Get source description. + * + * @return string + */ + public function getDescription() + { + return $this->getData(SourceInterface::DESCRIPTION); + } + + /** + * Set source description. + * + * @param string $description + * + * @return $this + */ + public function setDescription($description) + { + $this->setData(SourceInterface::DESCRIPTION, $description); + return $this; + } + + /** + * Get source latitude. + * + * @return float + */ + public function getLatitude() + { + return $this->getData(SourceInterface::LATITUDE); + } + + /** + * Set source latitude. + * + * @param float $latitude + * + * @return $this + */ + public function setLatitude($latitude) + { + $this->setData(SourceInterface::LATITUDE, $latitude); + return $this; + } + + /** + * Get source longitude. + * + * @return int + */ + public function getLongitude() + { + return $this->getData(SourceInterface::LONGITUDE); + } + + /** + * Set source longitude. + * + * @param int $longitude + * + * @return $this + */ + public function setLongitude($longitude) + { + $this->setData(SourceInterface::LONGITUDE, $longitude); + return $this; + } + + /** + * Get source country id. + * + * @return string + */ + public function getCountryId() + { + return $this->getData(SourceInterface::COUNTRY_ID); + } + + /** + * Set source country id. + * + * @param string $countryId + * + * @return $this + */ + public function setCountryId($countryId) + { + $this->setData(SourceInterface::COUNTRY_ID, $countryId); + return $this; + } + + /** + * Get region id if source has registered region. + * + * @return int + */ + public function getRegionId() + { + return $this->getData(SourceInterface::REGION_ID); + } + + /** + * Set region id if source has registered region. + * + * @param int $regionId + * + * @return $this + */ + public function setRegionId($regionId) + { + $this->setData(SourceInterface::REGION_ID, $regionId); + return $this; + } + + /** + * Get region title if source has custom region + * + * @return string + */ + public function getRegion() + { + return $this->getData(SourceInterface::REGION); + } + + /** + * Set source region title. + * + * @param string $region + * + * @return $this + */ + public function setRegion($region) + { + $this->setData(SourceInterface::REGION, $region); + return $this; + } + + /** + * Get source city. + * + * @return string + */ + public function getCity() + { + return $this->getData(SourceInterface::CITY); + } + + /** + * Set source city. + * + * @param string $city + * + * @return $this + */ + public function setCity($city) + { + $this->setData(SourceInterface::CITY, $city); + return $this; + } + + /** + * Get source street name. + * + * @return string + */ + public function getStreet() + { + return $this->getData(SourceInterface::STREET); + } + + /** + * Set source street name. + * + * @param string $street + * + * @return $this + */ + public function setStreet($street) + { + $this->setData(SourceInterface::STREET, $street); + return $this; + } + + /** + * Get source post code. + * + * @return string + */ + public function getPostcode() + { + return $this->getData(SourceInterface::POSTCODE); + } + + /** + * Set source post code. + * + * @param string $postcode + * + * @return $this + */ + public function setPostcode($postcode) + { + $this->setData(SourceInterface::POSTCODE, $postcode); + return $this; + } + + /** + * Get source phone number. + * + * @return string + */ + public function getPhone() + { + return $this->getData(SourceInterface::PHONE); + } + + /** + * Set source phone number. + * + * @param string $phone + * + * @return $this + */ + public function setPhone($phone) + { + $this->setData(SourceInterface::PHONE, $phone); + return $this; + } + + /** + * Get source fax. + * + * @return string + */ + public function getFax() + { + return $this->getData(SourceInterface::FAX); + } + + /** + * Set source fax. + * + * @param string $fax + * + * @return $this + */ + public function setFax($fax) + { + $this->setData(SourceInterface::FAX, $fax); + return $this; + } + + /** + * Get source priority + * + * @return int + */ + public function getPriority() + { + return $this->getData(SourceInterface::PRIORITY); + } + + /** + * Set source priority + * + * @param int $priority + * + * @return $this + */ + public function setPriority($priority) + { + $this->setData(SourceInterface::PRIORITY, $priority); + return $this; + } + + /** + * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] + */ + public function getCarrierLinks() + { + // TODO: Implement getCarrierLinks() method. + } + + /** + * @param \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] $carrierLinks + * + * @return $this + */ + public function setCarrierLinks($carrierLinks) + { + // TODO: Implement setCarrierLinks() method. + } + + /** + * Retrieve existing extension attributes object or create a new one. + * + * @return \Magento\InventoryApi\Api\Data\SourceExtensionInterface|null + */ + public function getExtensionAttributes() + { + // TODO: Implement getExtensionAttributes() method. + } + + /** + * Set an extension attributes object. + * + * @param \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes + * + * @return $this + */ + public function setExtensionAttributes( + \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes + ) { + // TODO: Implement setExtensionAttributes() method. + } +} \ No newline at end of file From 17a3cde3c921e0372938cde2165621200cb9cb4f Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 16:16:10 +0200 Subject: [PATCH 0052/1004] magento-engcom/magento2#25: Implement repository model for inventory sources --- .../Inventory/Model/SourceRepository.php | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 app/code/Magento/Inventory/Model/SourceRepository.php diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php new file mode 100644 index 0000000000000..76ec8e07f2936 --- /dev/null +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -0,0 +1,135 @@ +resource = $resource; + $this->sourceFactory = $sourceFactory; + $this->collectionProcessor = $collectionProcessor; + $this->collectionFactory = $collectionFactory; + $this->sourceSearchResultsFactory = $sourceSearchResultsFactory; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + } + + /** + * Save Source data. + * + * @param SourceInterface $source + * @return SourceInterface + * + * @throws CouldNotSaveException + */ + public function save(SourceInterface $source) + { + try { + $this->resource->save($source); + } catch (\Exception $exception) { + throw new CouldNotSaveException(__($exception->getMessage())); + } + return $source; + } + + /** + * Load Source data by given sourceId. + * + * @param int $sourceId + * @return SourceInterface + */ + public function get($sourceId) + { + + } + + /** + * Load source data collection by given search criteria + * + * @param SearchCriteriaInterface $searchCriteria + * @return SourceSearchResultsInterface + */ + public function getList(SearchCriteriaInterface $searchCriteria = null) + { + /** @var \Magento\Inventory\Model\Resource\Source\Collection $collection */ + $collection = $this->collectionFactory->create(); + $this->collectionProcessor->process($searchCriteria, $collection); + + /** @var SourceInterface[] $sources */ + $sources = []; + /** @var SourceInterface $source */ + foreach ($collection->getItems() as $source) { + $addresses[] = $source; + } + + /** @var SourceSearchResultsInterface $searchResults */ + $searchResults = $this->sourceSearchResultsFactory->create(); + $searchResults->setItems($sources); + $searchResults->setSearchCriteria($searchCriteria); + $searchResults->setTotalCount($collection->getSize()); + return $searchResults; + } +} From 8e26b843b75bc83d096c06a4a8337aa8b81383c1 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 16:40:28 +0200 Subject: [PATCH 0053/1004] magento-engcom/magento2#25: Implement get() method in SourceRepository --- app/code/Magento/Inventory/Model/SourceRepository.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 76ec8e07f2936..8759f466da9c0 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -9,6 +9,7 @@ use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; +use Magento\Framework\Model\AbstractModel; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; use Magento\InventoryApi\Api\SourceRepositoryInterface; @@ -103,7 +104,10 @@ public function save(SourceInterface $source) */ public function get($sourceId) { - + /** @var SourceInterface|AbstractModel $model */ + $model = $this->sourceFactory->create(); + $this->resource->load($model, SourceInterface::SOURCE_ID, $sourceId); + return $model; } /** From 8eaeb062b323d7622d64788041c2770b81147af5 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 16:52:54 +0200 Subject: [PATCH 0054/1004] magento-engcom/magento2#25: Change protected properties to private --- .../Magento/Inventory/Model/SourceRepository.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 8759f466da9c0..535e681036a21 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -26,32 +26,32 @@ class SourceRepository implements SourceRepositoryInterface /** * @var ResourceSource */ - protected $resource; + private $resource; /** * @var SourceFactory */ - protected $sourceFactory; + private $sourceFactory; /** * @var CollectionProcessorInterface */ - protected $collectionProcessor; + private $collectionProcessor; /** * @var CollectionFactory */ - protected $collectionFactory; + private $collectionFactory; /** * @var SourceSearchResultsFactory */ - protected $sourceSearchResultsFactory; + private $sourceSearchResultsFactory; /** * @var SearchCriteriaBuilder */ - protected $searchCriteriaBuilder; + private $searchCriteriaBuilder; /** * SourceRepository constructor. From fce8cc468ecf5c360bbdb46b2acc4405a39a5979 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Sat, 20 May 2017 16:53:41 +0200 Subject: [PATCH 0055/1004] magento-engcom/magento2#25: Source API Implementation - fixed code style issues --- .../Inventory/Model/Resource/Source.php | 2 +- .../Model/Resource/Source/Collection.php | 8 +++- app/code/Magento/Inventory/Model/Source.php | 47 +++++-------------- .../Api/Data/SourceCarrierLinkInterface.php | 13 ++++- 4 files changed, 32 insertions(+), 38 deletions(-) diff --git a/app/code/Magento/Inventory/Model/Resource/Source.php b/app/code/Magento/Inventory/Model/Resource/Source.php index 5eeae65abdf7f..e955eecadf16e 100644 --- a/app/code/Magento/Inventory/Model/Resource/Source.php +++ b/app/code/Magento/Inventory/Model/Resource/Source.php @@ -24,4 +24,4 @@ protected function _construct() { $this->_init(InstallSchema::TABLE_NAME_SOURCE, SourceInterface::SOURCE_ID); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php index f1f8170a8bd3b..0c5c6dd069a49 100644 --- a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php @@ -1,4 +1,10 @@ _init('Magento\Inventory\Model\Resource\Source'); + $this->_init(\Magento\Inventory\Model\Resource\Source::class); } /** @@ -45,7 +44,6 @@ public function getSourceId() * Set source id. * * @param int $sourceId - * * @return $this */ public function setSourceId($sourceId) @@ -68,7 +66,6 @@ public function getName() * Set source name. * * @param string $name - * * @return $this */ public function setName($name) @@ -78,7 +75,7 @@ public function setName($name) } /** - * Get source email + * Get source email. * * @return string */ @@ -90,8 +87,7 @@ public function getEmail() /** * Set source email * - * @param string $email - * + * @param string $email. * @return $this */ public function setEmail($email) @@ -102,7 +98,6 @@ public function setEmail($email) /** * Get source contact name. - * * @return string */ public function getContactName() @@ -114,7 +109,6 @@ public function getContactName() * Set source contact name. * * @param string $contactName - * * @return $this */ public function setContactName($contactName) @@ -137,7 +131,6 @@ public function getIsActive() * Enable or disable source. * * @param bool $active - * * @return $this */ public function setIsActive($active) @@ -160,7 +153,6 @@ public function getDescription() * Set source description. * * @param string $description - * * @return $this */ public function setDescription($description) @@ -183,7 +175,6 @@ public function getLatitude() * Set source latitude. * * @param float $latitude - * * @return $this */ public function setLatitude($latitude) @@ -206,7 +197,6 @@ public function getLongitude() * Set source longitude. * * @param int $longitude - * * @return $this */ public function setLongitude($longitude) @@ -229,7 +219,6 @@ public function getCountryId() * Set source country id. * * @param string $countryId - * * @return $this */ public function setCountryId($countryId) @@ -252,7 +241,6 @@ public function getRegionId() * Set region id if source has registered region. * * @param int $regionId - * * @return $this */ public function setRegionId($regionId) @@ -262,7 +250,7 @@ public function setRegionId($regionId) } /** - * Get region title if source has custom region + * Get region title if source has custom region. * * @return string */ @@ -275,7 +263,6 @@ public function getRegion() * Set source region title. * * @param string $region - * * @return $this */ public function setRegion($region) @@ -298,7 +285,6 @@ public function getCity() * Set source city. * * @param string $city - * * @return $this */ public function setCity($city) @@ -321,7 +307,6 @@ public function getStreet() * Set source street name. * * @param string $street - * * @return $this */ public function setStreet($street) @@ -344,7 +329,6 @@ public function getPostcode() * Set source post code. * * @param string $postcode - * * @return $this */ public function setPostcode($postcode) @@ -367,7 +351,6 @@ public function getPhone() * Set source phone number. * * @param string $phone - * * @return $this */ public function setPhone($phone) @@ -390,7 +373,6 @@ public function getFax() * Set source fax. * * @param string $fax - * * @return $this */ public function setFax($fax) @@ -400,7 +382,7 @@ public function setFax($fax) } /** - * Get source priority + * Get source priority. * * @return int */ @@ -410,10 +392,9 @@ public function getPriority() } /** - * Set source priority + * Set source priority. * * @param int $priority - * * @return $this */ public function setPriority($priority) @@ -422,8 +403,7 @@ public function setPriority($priority) return $this; } - /** - * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] + /** @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] */ public function getCarrierLinks() { @@ -432,7 +412,6 @@ public function getCarrierLinks() /** * @param \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] $carrierLinks - * * @return $this */ public function setCarrierLinks($carrierLinks) @@ -447,7 +426,7 @@ public function setCarrierLinks($carrierLinks) */ public function getExtensionAttributes() { - // TODO: Implement getExtensionAttributes() method. + return $this->_getExtensionAttributes(); } /** @@ -460,6 +439,6 @@ public function getExtensionAttributes() public function setExtensionAttributes( \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes ) { - // TODO: Implement setExtensionAttributes() method. + return $this->_setExtensionAttributes($extensionAttributes); } -} \ No newline at end of file +} diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index 465601115393f..7b56bf08ccf5d 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -8,25 +8,34 @@ namespace Magento\InventoryApi\Api\Data; - use Magento\Shipping\Model\Carrier\CarrierInterface; +/** + * Linkage interface between sources and carrier. + * @api + */ interface SourceCarrierLinkInterface { /** + * Set source. + * * @param SourceInterface $source * @return void */ public function setSource(SourceInterface $source); /** + * Set carrier. + * * @param CarrierInterface $carrier * @return void */ public function setCarrier(CarrierInterface $carrier); /** + * Get link. + * * @return $this */ public function getSourceCarrierLink(); -} \ No newline at end of file +} From de622ffbbb8c110bd3e84c0207a0e22ec63d00ca Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 17:13:31 +0200 Subject: [PATCH 0056/1004] magento-engcom/magento2#25: Update docblock for method in order to follow the inherit doc from interface --- .../Inventory/Model/Resource/Source.php | 7 +- .../Model/Resource/Source/Collection.php | 20 +- app/code/Magento/Inventory/Model/Source.php | 201 ++++-------------- .../Inventory/Model/SourceRepository.php | 18 +- .../CollectionProcessorInterface.php | 2 +- 5 files changed, 62 insertions(+), 186 deletions(-) diff --git a/app/code/Magento/Inventory/Model/Resource/Source.php b/app/code/Magento/Inventory/Model/Resource/Source.php index 5eeae65abdf7f..8870f20abbffe 100644 --- a/app/code/Magento/Inventory/Model/Resource/Source.php +++ b/app/code/Magento/Inventory/Model/Resource/Source.php @@ -13,12 +13,7 @@ class Source extends AbstractDb { /** - * Initialize resource model - * - * @return void - * - * @codingStandardsIgnore - * @codeCoverageIgnore + * @inheritdoc */ protected function _construct() { diff --git a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php index f1f8170a8bd3b..de45b3c231d62 100644 --- a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php @@ -1,18 +1,24 @@ Date: Sat, 20 May 2017 17:18:44 +0200 Subject: [PATCH 0057/1004] magento-engcom/magento2#25: Update interfaces in order to use USE statements --- .../Inventory/Model/SourceRepository.php | 16 ++++++------- .../Api/Data/SourceCarrierLinkInterface.php | 11 +++++---- .../Api/SourceRepositoryInterface.php | 23 ++++++++++++------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 585662e9b688a..2a7614508a959 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -10,6 +10,7 @@ use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Model\AbstractModel; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; @@ -49,11 +50,6 @@ class SourceRepository implements SourceRepositoryInterface */ private $sourceSearchResultsFactory; - /** - * @var SearchCriteriaBuilder - */ - private $searchCriteriaBuilder; - /** * SourceRepository constructor. * @param ResourceSource $resource @@ -61,22 +57,19 @@ class SourceRepository implements SourceRepositoryInterface * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $collectionFactory * @param SourceSearchResultsFactory $sourceSearchResultsFactory - * @param SearchCriteriaBuilder $searchCriteriaBuilder */ public function __construct( ResourceSource $resource, SourceFactory $sourceFactory, CollectionProcessorInterface $collectionProcessor, CollectionFactory $collectionFactory, - SourceSearchResultsFactory $sourceSearchResultsFactory, - SearchCriteriaBuilder $searchCriteriaBuilder + SourceSearchResultsFactory $sourceSearchResultsFactory ) { $this->resource = $resource; $this->sourceFactory = $sourceFactory; $this->collectionProcessor = $collectionProcessor; $this->collectionFactory = $collectionFactory; $this->sourceSearchResultsFactory = $sourceSearchResultsFactory; - $this->searchCriteriaBuilder = $searchCriteriaBuilder; } /** @@ -100,6 +93,11 @@ public function get($sourceId) /** @var SourceInterface|AbstractModel $model */ $model = $this->sourceFactory->create(); $this->resource->load($model, SourceInterface::SOURCE_ID, $sourceId); + + if (!$model->getId()) { + NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); + } + return $model; } diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index 465601115393f..506ffaa6f8911 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -1,16 +1,17 @@ Date: Sat, 20 May 2017 17:24:23 +0200 Subject: [PATCH 0058/1004] Wip --- .../Magento/Inventory/Setup/InstallSchema.php | 216 ++++++++++++++++++ .../Api/Data/SourceCarrierLinkInterface.php | 3 - 2 files changed, 216 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/Inventory/Setup/InstallSchema.php diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php new file mode 100644 index 0000000000000..467d276e09111 --- /dev/null +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -0,0 +1,216 @@ +startSetup(); + + $tableNameSourceEntity = $installer->getTable(InstallSchema::TABLE_NAME_SOURCE); + if (!$installer->getConnection()->isTableExists($tableNameSourceEntity)) { + + $table = $installer->getConnection()->newTable($tableNameSourceEntity); + + $options = [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_PRIMARY => true + ]; + $table->addColumn(SourceInterface::SOURCE_ID, Table::TYPE_INTEGER, null, $options, 'Source ID'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::NAME, Table::TYPE_TEXT, null, $options, 'Source Name'); + + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::CONTACT_NAME, Table::TYPE_TEXT, null, $options, 'Contact Name'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::EMAIL, Table::TYPE_TEXT, null, $options, 'Email'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_DEFAULT => 1 + ]; + $table->addColumn(SourceInterface::IS_ACTIVE, + Table::TYPE_SMALLINT, + null, + $options, + 'Defines Is Source Active'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::DESCRIPTION, Table::TYPE_TEXT, null, $options, 'Description'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::LATITUDE, Table::TYPE_TEXT, null, $options, 'Latitude'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::LONGITUDE, Table::TYPE_TEXT, null, $options, 'Longitude'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_DEFAULT => 1 + ]; + + $table->addColumn(SourceInterface::COUNTRY_ID, Table::TYPE_SMALLINT, null, $options, 'Country Id'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_DEFAULT => 1 + ]; + + $table->addColumn(SourceInterface::REGION_ID, Table::TYPE_SMALLINT, null, $options, 'Region Id'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::REGION, Table::TYPE_TEXT, null, $options, 'Region'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::CITY, Table::TYPE_TEXT, null, $options, 'City'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::STREET, Table::TYPE_TEXT, null, $options, 'Street'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::POSTCODE, Table::TYPE_TEXT, null, $options, 'Postcode'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::PHONE, Table::TYPE_TEXT, null, $options, 'Phone'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + $table->addColumn(SourceInterface::FAX, Table::TYPE_TEXT, null, $options, 'Fax'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_DEFAULT => 1 + ]; + + $table->addColumn(SourceInterface::PRIORITY, Table::TYPE_SMALLINT, null, $options, 'Priority'); + + + $table->setComment('Inventory Source Entity Table')->setOption('type', 'InnoDB')->setOption('charset', + 'utf8'); + $installer->getConnection()->createTable($table); + } + + $tableNamePipelineEntity = $installer->getTable(InstallSchema::TABLE_NAME_SOURCE); + if (!$installer->getConnection()->isTableExists($tableNamePipelineEntity)) { + + $table = $installer->getConnection()->newTable($tableNameSourceEntity); + + $options = [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + ]; + $table->addColumn('source_carrier_link_id', + Table::TYPE_INTEGER, + null, + $options, + 'Source ID' + ); + + $options = [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_PRIMARY => true + ]; + $table->addColumn(SourceInterface::SOURCE_ID, Table::TYPE_INTEGER, null, $options, 'Source ID'); + + $options = [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ]; + + $table->addColumn( + + Table::TYPE_TEXT, + null, + $options, + 'Source Name' + ); + + } + + + $setup->endSetup(); + } +} diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index 465601115393f..d4e562329ff34 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -8,9 +8,6 @@ namespace Magento\InventoryApi\Api\Data; - -use Magento\Shipping\Model\Carrier\CarrierInterface; - interface SourceCarrierLinkInterface { /** From 7d0c54bffbbb5b7c14423037a056bff722f0f885 Mon Sep 17 00:00:00 2001 From: Thomas Kreidenhuber Date: Sat, 20 May 2017 17:35:11 +0200 Subject: [PATCH 0059/1004] magento-engcom/magento2#25 Implemented Resourcemodel, Collection and part of the businessmodel for sourcecarrierlink, updated carrierlink-interface, implemented part of source-businessmodel --- .../Model/Resource/Source/Collection.php | 5 ++ .../Model/Resource/SourceCarrierLink.php | 27 ++++++ .../Resource/SourceCarrierLink/Collection.php | 36 ++++++++ app/code/Magento/Inventory/Model/Source.php | 10 ++- .../Inventory/Model/SourceCarrierLink.php | 86 +++++++++++++++++++ .../Api/Data/SourceCarrierLinkInterface.php | 65 ++++++++++---- 6 files changed, 210 insertions(+), 19 deletions(-) create mode 100644 app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php create mode 100644 app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php create mode 100644 app/code/Magento/Inventory/Model/SourceCarrierLink.php diff --git a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php index f1f8170a8bd3b..5740517edb9e0 100644 --- a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php @@ -1,4 +1,9 @@ _init(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK, 'source_carrier_link_id'); + } +} \ No newline at end of file diff --git a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php b/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php new file mode 100644 index 0000000000000..504845bd0012a --- /dev/null +++ b/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php @@ -0,0 +1,36 @@ +_init(SourceCarrierLinkModel::class, ResourceSourceCarrierLink::class); + } + + /** + * Id field name getter + * + * @return string + */ + public function getIdFieldName() + { + return 'source_carrier_link_id'; + } +} \ No newline at end of file diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index 3a3092e116c44..abdec00652084 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -427,7 +427,7 @@ public function setPriority($priority) */ public function getCarrierLinks() { - // TODO: Implement getCarrierLinks() method. + return $this->getData(SourceInterface::PRIORITY); } /** @@ -437,7 +437,8 @@ public function getCarrierLinks() */ public function setCarrierLinks($carrierLinks) { - // TODO: Implement setCarrierLinks() method. + $this->setData(SourceInterface::CARRIER_LINKS, $carrierLinks); + return $this; } /** @@ -447,7 +448,7 @@ public function setCarrierLinks($carrierLinks) */ public function getExtensionAttributes() { - // TODO: Implement getExtensionAttributes() method. + return $this->getData(SourceInterface::EXTENSION_ATTRIBUTES_KEY); } /** @@ -460,6 +461,7 @@ public function getExtensionAttributes() public function setExtensionAttributes( \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes ) { - // TODO: Implement setExtensionAttributes() method. + $this->setData(SourceInterface::EXTENSION_ATTRIBUTES_KEY, $extensionAttributes); + return $this; } } \ No newline at end of file diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php new file mode 100644 index 0000000000000..1c66cc1d8b67e --- /dev/null +++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php @@ -0,0 +1,86 @@ +_init('Magento\Inventory\Model\Resource\SourceCarrierLink'); + } + + + /** + * @inheritDoc + */ + public function getCarrierCode() + { + $this->getData(SourceCarrierLinkInterface::CARRIER_CODE); + } + + /** + * @inheritDoc + */ + public function setCarrierCode($carrierCode) + { + $this->setData(SourceCarrierLinkInterface::CARRIER_CODE, $carrierCode); + return $this; + } + + /** + * @inheritDoc + */ + public function getPosition() + { + $this->getData(SourceCarrierLinkInterface::POSITION); + } + + /** + * @inheritDoc + */ + public function setPosition($position) + { + $this->setData(SourceCarrierLinkInterface::POSITION, $position); + return $this; + } + + /** + * @inheritDoc + */ + public function getExtensionAttributes() + { + $this->getData(SourceCarrierLinkInterface::EXTENSION_ATTRIBUTES_KEY); + } + + /** + * @inheritDoc + */ + public function setExtensionAttributes( + \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface $extensionAttributes + ) { + $this->getData(SourceCarrierLinkInterface::EXTENSION_ATTRIBUTES_KEY); + return $this; + } +} \ No newline at end of file diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index 465601115393f..4a976ee33eb9c 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -1,32 +1,67 @@ Date: Sat, 20 May 2017 18:33:38 +0200 Subject: [PATCH 0060/1004] magento-engcom/magento2#25: Source API Implementation - Created stub for api-functional test for SourceRepository --- .../InventoryApi/Api/SourceRepositoryTest.php | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php new file mode 100644 index 0000000000000..60c76d462f3eb --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -0,0 +1,55 @@ + Date: Sat, 20 May 2017 18:36:31 +0200 Subject: [PATCH 0061/1004] magento-engcom/magento2#25: Implement SourceSearchResults --- .../Inventory/Model/SourceSearchResults.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/code/Magento/Inventory/Model/SourceSearchResults.php diff --git a/app/code/Magento/Inventory/Model/SourceSearchResults.php b/app/code/Magento/Inventory/Model/SourceSearchResults.php new file mode 100644 index 0000000000000..f8fec226556f0 --- /dev/null +++ b/app/code/Magento/Inventory/Model/SourceSearchResults.php @@ -0,0 +1,17 @@ + Date: Sat, 20 May 2017 18:36:58 +0200 Subject: [PATCH 0062/1004] magento-engcom/magento2#25: Add di.xml and define preferences for interfaces --- app/code/Magento/Inventory/etc/di.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/code/Magento/Inventory/etc/di.xml diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml new file mode 100644 index 0000000000000..a4a5bf0b172f4 --- /dev/null +++ b/app/code/Magento/Inventory/etc/di.xml @@ -0,0 +1,12 @@ + + + + + + + From afe210bd9288864c1584133a264f8715e06c3ae3 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 18:37:31 +0200 Subject: [PATCH 0063/1004] magento-engcom/magento2#25: Implement unit tests for SourceRepository --- .../Inventory/Model/SourceRepository.php | 4 +- .../Test/Unit/Model/SourceRepositoryTest.php | 195 ++++++++++++++++++ 2 files changed, 197 insertions(+), 2 deletions(-) create mode 100644 app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 2a7614508a959..b790530cf22a7 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -6,7 +6,6 @@ namespace Magento\Inventory\Model; -use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; @@ -15,6 +14,7 @@ use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; use Magento\InventoryApi\Api\SourceRepositoryInterface; +use Magento\Inventory\Model\SourceSearchResultsFactory; use Magento\Inventory\Model\Resource\Source as ResourceSource; use Magento\Inventory\Model\Resource\Source\CollectionFactory; use Magento\Inventory\Model\SourceFactory; @@ -94,7 +94,7 @@ public function get($sourceId) $model = $this->sourceFactory->create(); $this->resource->load($model, SourceInterface::SOURCE_ID, $sourceId); - if (!$model->getId()) { + if (!$model->getSourceId()) { NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); } diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php new file mode 100644 index 0000000000000..f2b0d29d91465 --- /dev/null +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -0,0 +1,195 @@ +resource = $this->getMock( + \Magento\Inventory\Model\Resource\Source::class, + [], + [], + '', + false + ); + + $this->sourceFactory = $this->getMock( + \Magento\Inventory\Model\SourceFactory::class, + ['create'], + [], + '', + false + ); + + $this->collectionProcessor = $this->getMockBuilder( + \Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface::class + )->getMockForAbstractClass(); + + $this->collectionFactory = $this->getMock( + \Magento\Inventory\Model\Resource\Source\CollectionFactory::class, + ['create'], + [], + '', + false + ); + + $this->sourceSearchResultsFactory = $this->getMock( + \Magento\Inventory\Model\SourceSearchResultsFactory::class, + ['create'], + [], + '', + false + ); + + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->sourceRepository = $objectManager->getObject( + \Magento\Inventory\Model\SourceRepository::class, + [ + 'resource' => $this->resource, + 'sourceFactory' => $this->sourceFactory, + 'collectionProcessor' => $this->collectionProcessor, + 'collectionFactory' => $this->collectionFactory, + 'sourceSearchResultsFactory' => $this->sourceSearchResultsFactory, + ] + ); + } + + public function testSaveSuccessful() + { + /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ + $sourceModel = $this->getMockForAbstractClass( + \Magento\Inventory\Model\Source::class, + [], + '', + false + ); + + $result = $this->sourceRepository->save($sourceModel); + + $this->assertSame($sourceModel, $result); + } + + public function testSaveErrorExpectsException() + { + /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ + $sourceModel = $this->getMockForAbstractClass( + \Magento\Inventory\Model\Source::class, + [], + '', + false + ); + + $this->setExpectedException(\Magento\Framework\Exception\CouldNotSaveException::class); + + $this->resource->expects($this->atLeastOnce()) + ->method('save') + ->will($this->throwException(new \Exception('Some unit test Exception'))); + + $this->sourceRepository->save($sourceModel); + } + + public function testGetSuccessfull() + { + $sourceId = 345; + + /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ + $sourceModel = $this->getMockForAbstractClass( + \Magento\Inventory\Model\Source::class, + ['getSourceId'], + '', + false + ); + + $sourceModel->expects($this->atLeastOnce()) + ->method('getSourceId') + ->will($this->returnValue($sourceId)); + + $this->sourceFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($sourceModel)); + + $this->resource->expects($this->once()) + ->method('load') + ->with( + $sourceModel, + SourceInterface::SOURCE_ID, + $sourceId + ); + + $result = $this->sourceRepository->get($sourceId); + + $this->assertSame($sourceModel, $result); + } + + public function testGetErrorExpectsException() + { + $sourceId = 345; + + /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ + $sourceModel = $this->getMockForAbstractClass( + \Magento\Inventory\Model\Source::class, + ['getSourceId'], + '', + false + ); + + $sourceModel->expects($this->atLeastOnce()) + ->method('getSourceId') + ->will($this->returnValue(null)); + + $this->sourceFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($sourceModel)); + + $this->resource->expects($this->once()) + ->method('load') + ->with( + $sourceModel, + SourceInterface::SOURCE_ID, + $sourceId + ); + + $this->setExpectedException(\Magento\Framework\Exception\NoSuchEntityException::class); + + $this->sourceRepository->get($sourceId); + } +} From b7072f7fc6b6c99978e6ccb159aaf5dae1f278c2 Mon Sep 17 00:00:00 2001 From: Thomas Kreidenhuber Date: Sat, 20 May 2017 18:38:15 +0200 Subject: [PATCH 0064/1004] magento-engcom/magento2#25 added unit tests for source and sourcecarrierlink models --- .../Test/Unit/Model/SourceCarrierLinkTest.php | 48 +++++++ .../Inventory/Test/Unit/Model/SourceTest.php | 132 ++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php create mode 100644 app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php new file mode 100644 index 0000000000000..9b41f88d60893 --- /dev/null +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php @@ -0,0 +1,48 @@ +objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->sourceCarrierLink = $this->objectManager->getObject(SourceCarrierLink::class); + } + + + public function testCarrierCode() + { + $this->sourceCarrierLink->setCarrierCode(SourceCarrierLinkTest::TEST_STRING); + $this->assertEquals($this->source->getCarrierCode(), SourceCarrierLinkTest::TEST_STRING); + } + + public function testPosition() + { + $this->sourceCarrierLink->setPosition(SourceCarrierLinkTest::TEST_POSITION); + $this->assertEquals($this->source->getName(), SourceCarrierLinkTest::TEST_POSITION); + } +} \ No newline at end of file diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php new file mode 100644 index 0000000000000..cf85437186a39 --- /dev/null +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php @@ -0,0 +1,132 @@ +objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->source = $this->objectManager->getObject(Source::class); + } + + + public function testSourceId() + { + $this->source->setSourceId(SourceTest::TEST_ID); + $this->assertEquals($this->source->getSourceId(), SourceTest::TEST_ID); + } + + public function testName() + { + $this->source->setName(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getName(), SourceTest::TEST_STRING); + } + + public function testEmail() + { + $this->source->setEmail(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getEmail(), SourceTest::TEST_STRING); + } + + public function testContactName() + { + $this->source->setContactName(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getContactName(), SourceTest::TEST_STRING); + } + + public function testIsActive() + { + $this->source->setIsActive(SourceTest::TEST_IS_ACTIVE); + $this->assertEquals($this->source->getIsActive(), SourceTest::TEST_IS_ACTIVE); + } + + public function testDescription() + { + $this->source->setDescription(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getDescription(), SourceTest::TEST_IS_ACTIVE); + } + + public function testLatitude() + { + $this->source->setLatitude(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getLatitude(), SourceTest::TEST_IS_ACTIVE); + } + + public function testCountryId() + { + $this->source->setCountryId(SourceTest::TEST_ID); + $this->assertEquals($this->source->getCountryId(), SourceTest::TEST_ID); + } + + public function testRegion() + { + $this->source->setRegion(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getRegion(), SourceTest::TEST_ID); + } + + public function testStreet() + { + $this->source->setStreet(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getStreet(), SourceTest::TEST_ID); + } + + public function testPhone() + { + $this->source->setPhone(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getPhone(), SourceTest::TEST_ID); + } + + public function testFax() + { + $this->source->setFax(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getFax(), SourceTest::TEST_ID); + } + + public function testPriority() + { + $this->source->setPriority(SourceTest::TEST_STRING); + $this->assertEquals($this->source->setPriority(), SourceTest::TEST_ID); + } + + public function testCarrierLinkds() + { + $carrierLink1 = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) + ->disableOriginalConstructor() + ->getMock(); + + $carrierLink2 = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) + ->disableOriginalConstructor() + ->getMock(); + + $carrierLinks = [$carrierLink1, $carrierLink2]; + + $this->source->setCarrierLinks($carrierLinks); + $this->assertEquals($this->source->getCarrierLinks(), $carrierLinks); + } + +} \ No newline at end of file From 34eb6a23e95c3fa7f4ea5482b81cb91608c1797c Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Sat, 20 May 2017 18:40:39 +0200 Subject: [PATCH 0065/1004] magento-engcom/magento2#25: Source API Implementation - Created stub for api-functional test for SourceRepository --- .../Magento/InventoryApi/Api/SourceRepositoryTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index 60c76d462f3eb..ee6f0893ea030 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -19,6 +19,7 @@ class SourceRepositoryTest extends WebapiAbstract public function testCreateSource() { //TODO: Implement testCreateSource + $this->fail(__METHOD__ . " is not implemented yet."); } /** @@ -27,6 +28,7 @@ public function testCreateSource() public function testGetSource() { //TODO: Implement testGetSource + $this->fail(__METHOD__ . " is not implemented yet."); } /** @@ -35,6 +37,7 @@ public function testGetSource() public function testGetSourcesList() { //TODO: Implement testGetSourcesList + $this->fail(__METHOD__ . " is not implemented yet."); } /** @@ -43,6 +46,7 @@ public function testGetSourcesList() public function testUpdateSource() { //TODO: Implement testUpdateSource + $this->fail(__METHOD__ . " is not implemented yet."); } /** @@ -51,5 +55,6 @@ public function testUpdateSource() public function testUpdateSourceWithoutCarriers() { //TODO: Implement testUpdateSourceWithoutCarriers + $this->fail(__METHOD__ . " is not implemented yet."); } } From 1fc9560034289945b956037a19ccdacd38f55b71 Mon Sep 17 00:00:00 2001 From: Thomas Kreidenhuber Date: Sat, 20 May 2017 18:50:12 +0200 Subject: [PATCH 0066/1004] magento-engcom/magento2#25 added fixed typo in test and added di configuration --- app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php | 2 +- app/code/Magento/Inventory/etc/di.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php index cf85437186a39..872bde0a4d7cd 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php @@ -113,7 +113,7 @@ public function testPriority() $this->assertEquals($this->source->setPriority(), SourceTest::TEST_ID); } - public function testCarrierLinkds() + public function testCarrierLinks() { $carrierLink1 = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) ->disableOriginalConstructor() diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index a4a5bf0b172f4..f5685c7eb7592 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -8,5 +8,6 @@ + From 0b46fdbb9719fbd5776e47cfd8ccaf5653af6966 Mon Sep 17 00:00:00 2001 From: Thomas Kreidenhuber Date: Sat, 20 May 2017 18:58:28 +0200 Subject: [PATCH 0067/1004] magento-engcom/magento2#25 fixed unit tests for source and sourcecarrierlink --- .../Test/Unit/Model/SourceCarrierLinkTest.php | 4 ++-- .../Inventory/Test/Unit/Model/SourceTest.php | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php index 9b41f88d60893..73afe482fd85c 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php @@ -37,12 +37,12 @@ protected function setUp() public function testCarrierCode() { $this->sourceCarrierLink->setCarrierCode(SourceCarrierLinkTest::TEST_STRING); - $this->assertEquals($this->source->getCarrierCode(), SourceCarrierLinkTest::TEST_STRING); + $this->assertEquals($this->sourceCarrierLink->getCarrierCode(), SourceCarrierLinkTest::TEST_STRING); } public function testPosition() { $this->sourceCarrierLink->setPosition(SourceCarrierLinkTest::TEST_POSITION); - $this->assertEquals($this->source->getName(), SourceCarrierLinkTest::TEST_POSITION); + $this->assertEquals($this->sourceCarrierLink->getPosition(), SourceCarrierLinkTest::TEST_POSITION); } } \ No newline at end of file diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php index 872bde0a4d7cd..c003252645c05 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php @@ -68,13 +68,13 @@ public function testIsActive() public function testDescription() { $this->source->setDescription(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getDescription(), SourceTest::TEST_IS_ACTIVE); + $this->assertEquals($this->source->getDescription(), SourceTest::TEST_STRING); } public function testLatitude() { $this->source->setLatitude(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getLatitude(), SourceTest::TEST_IS_ACTIVE); + $this->assertEquals($this->source->getLatitude(), SourceTest::TEST_STRING); } public function testCountryId() @@ -86,40 +86,40 @@ public function testCountryId() public function testRegion() { $this->source->setRegion(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getRegion(), SourceTest::TEST_ID); + $this->assertEquals($this->source->getRegion(), SourceTest::TEST_STRING); } public function testStreet() { $this->source->setStreet(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getStreet(), SourceTest::TEST_ID); + $this->assertEquals($this->source->getStreet(), SourceTest::TEST_STRING); } public function testPhone() { $this->source->setPhone(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getPhone(), SourceTest::TEST_ID); + $this->assertEquals($this->source->getPhone(), SourceTest::TEST_STRING); } public function testFax() { $this->source->setFax(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getFax(), SourceTest::TEST_ID); + $this->assertEquals($this->source->getFax(), SourceTest::TEST_STRING); } public function testPriority() { $this->source->setPriority(SourceTest::TEST_STRING); - $this->assertEquals($this->source->setPriority(), SourceTest::TEST_ID); + $this->assertEquals($this->source->getPriority(), SourceTest::TEST_STRING); } public function testCarrierLinks() { - $carrierLink1 = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) + $carrierLink1 = $this->getMock(\Magento\Customer\Model\Customer::class) ->disableOriginalConstructor() ->getMock(); - $carrierLink2 = $this->getMockBuilder(\Magento\Customer\Model\Customer::class) + $carrierLink2 = $this->getMock(\Magento\Customer\Model\Customer::class) ->disableOriginalConstructor() ->getMock(); From 79130595f10112b8fc88c441d4ccae7f4342ec17 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 19:25:08 +0200 Subject: [PATCH 0068/1004] magento-engcom/magento2#25: Implement rests for SourceRepository --- .../Inventory/Model/SourceRepository.php | 4 +- .../Test/Unit/Model/SourceRepositoryTest.php | 86 +++++++++++++++++-- .../Inventory/Test/Unit/Model/SourceTest.php | 22 +++-- 3 files changed, 97 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index b790530cf22a7..ad6fb0a3b0e80 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -95,7 +95,7 @@ public function get($sourceId) $this->resource->load($model, SourceInterface::SOURCE_ID, $sourceId); if (!$model->getSourceId()) { - NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); + throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); } return $model; @@ -114,7 +114,7 @@ public function getList(SearchCriteriaInterface $searchCriteria = null) $sources = []; /** @var SourceInterface $source */ foreach ($collection->getItems() as $source) { - $addresses[] = $source; + $sources[] = $source; } /** @var SourceSearchResultsInterface $searchResults */ diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index f2b0d29d91465..72e2fcf1c5ada 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -96,9 +96,10 @@ protected function setUp() public function testSaveSuccessful() { /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMockForAbstractClass( + $sourceModel = $this->getMock( \Magento\Inventory\Model\Source::class, [], + [], '', false ); @@ -111,9 +112,10 @@ public function testSaveSuccessful() public function testSaveErrorExpectsException() { /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMockForAbstractClass( + $sourceModel = $this->getMock( \Magento\Inventory\Model\Source::class, [], + [], '', false ); @@ -132,9 +134,10 @@ public function testGetSuccessfull() $sourceId = 345; /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMockForAbstractClass( + $sourceModel = $this->getMock( \Magento\Inventory\Model\Source::class, - ['getSourceId'], + [], + [], '', false ); @@ -165,9 +168,10 @@ public function testGetErrorExpectsException() $sourceId = 345; /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMockForAbstractClass( + $sourceModel = $this->getMock( \Magento\Inventory\Model\Source::class, - ['getSourceId'], + [], + [], '', false ); @@ -192,4 +196,74 @@ public function testGetErrorExpectsException() $this->sourceRepository->get($sourceId); } + + public function testGetList() + { + /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel1 */ + $sourceModel1 = $this->getMock( + \Magento\Inventory\Model\Source::class, + [], + [], + '', + false + ); + + /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel2 */ + $sourceModel2 = $this->getMock( + \Magento\Inventory\Model\Source::class, + [], + [], + '', + false + ); + + $searchCriteria = $this->getMock( + \Magento\Framework\Api\SearchCriteriaInterface::class, + [], + [], + '', + false + ); + + $collection = $this->getMock( + \Magento\Inventory\Model\Resource\Source\Collection::class, + [], + [], + '', + false + ); + + $this->collectionFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($collection)); + + $sources = [ + $sourceModel1, + $sourceModel2 + ]; + + $collection->expects($this->atLeastOnce()) + ->method('getItems') + ->will($this->returnValue($sources)); + + $searchResults = $this->getMock( + \Magento\Inventory\Model\SourceSearchResults::class, + [], + [], + '', + false + ); + + $this->sourceSearchResultsFactory->expects($this->once()) + ->method('create') + ->will($this->returnValue($searchResults)); + + $searchResults->expects($this->once()) + ->method('setItems') + ->with($sources); + + $result = $this->sourceRepository->getList($searchCriteria); + + $this->assertSame($searchResults, $result); + } } diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php index c003252645c05..4d8dbbcec7601 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php @@ -115,13 +115,21 @@ public function testPriority() public function testCarrierLinks() { - $carrierLink1 = $this->getMock(\Magento\Customer\Model\Customer::class) - ->disableOriginalConstructor() - ->getMock(); - - $carrierLink2 = $this->getMock(\Magento\Customer\Model\Customer::class) - ->disableOriginalConstructor() - ->getMock(); + $carrierLink1 = $this->getMock( + \Magento\Inventory\Model\SourceCarrierLink::class, + [], + [], + '', + false + ); + + $carrierLink2 = $this->getMock( + \Magento\Inventory\Model\SourceCarrierLink::class, + [], + [], + '', + false + ); $carrierLinks = [$carrierLink1, $carrierLink2]; From 2443c2bcec24a615ea7637e3b4006238567d65d6 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 19:29:18 +0200 Subject: [PATCH 0069/1004] magento-engcom/magento2#25: Fix unit tests --- app/code/Magento/Inventory/Model/Source.php | 2 +- app/code/Magento/Inventory/Model/SourceCarrierLink.php | 4 ++-- .../Inventory/Test/Unit/Model/SourceCarrierLinkTest.php | 1 - app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index 8ed5f0f2caf68..bc507b56a82a9 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -322,7 +322,7 @@ public function setPriority($priority) */ public function getCarrierLinks() { - return $this->getData(SourceInterface::PRIORITY); + return $this->getData(SourceInterface::CARRIER_LINKS); } /** diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php index f0284bb021487..eabd31651a977 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php @@ -37,7 +37,7 @@ protected function _construct() */ public function getCarrierCode() { - $this->getData(SourceCarrierLinkInterface::CARRIER_CODE); + return $this->getData(SourceCarrierLinkInterface::CARRIER_CODE); } /** @@ -54,7 +54,7 @@ public function setCarrierCode($carrierCode) */ public function getPosition() { - $this->getData(SourceCarrierLinkInterface::POSITION); + return $this->getData(SourceCarrierLinkInterface::POSITION); } /** diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php index 73afe482fd85c..352ca93113a38 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php @@ -33,7 +33,6 @@ protected function setUp() $this->sourceCarrierLink = $this->objectManager->getObject(SourceCarrierLink::class); } - public function testCarrierCode() { $this->sourceCarrierLink->setCarrierCode(SourceCarrierLinkTest::TEST_STRING); diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php index 4d8dbbcec7601..f9631c32f0828 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php @@ -134,7 +134,7 @@ public function testCarrierLinks() $carrierLinks = [$carrierLink1, $carrierLink2]; $this->source->setCarrierLinks($carrierLinks); - $this->assertEquals($this->source->getCarrierLinks(), $carrierLinks); + $this->assertEquals($carrierLinks, $this->source->getCarrierLinks()); } } \ No newline at end of file From b4a7aedfe503288dae4d7bc4f3f62d36ecdb7b27 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sat, 20 May 2017 19:34:09 +0200 Subject: [PATCH 0070/1004] magento-engcom/magento2#25: Code styles --- .../Api/SearchCriteria/CollectionProcessorInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessorInterface.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessorInterface.php index b32a036eb8207..28fe58f6390d5 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessorInterface.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessorInterface.php @@ -21,5 +21,5 @@ interface CollectionProcessorInterface * @throws \InvalidArgumentException * @return void */ - public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $collection); + public function process(SearchCriteriaInterface $searchCriteria, AbstractDb $collection); } From c2af5e57a61801cb22929d2bd5c78826c8b2634c Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Sat, 20 May 2017 20:41:54 +0200 Subject: [PATCH 0071/1004] magento-engcom/magento2#25: Source API Implementation - code style fixes --- .../Inventory/Model/Resource/Source/Collection.php | 6 +----- .../Inventory/Model/Resource/SourceCarrierLink.php | 6 +----- .../Model/Resource/SourceCarrierLink/Collection.php | 7 ++----- app/code/Magento/Inventory/Model/Source.php | 6 +++--- .../Magento/Inventory/Model/SourceCarrierLink.php | 12 +++++------- .../Magento/Inventory/Model/SourceRepository.php | 9 +-------- .../Magento/Inventory/Model/SourceSearchResults.php | 1 + .../Test/Unit/Model/SourceCarrierLinkTest.php | 3 +-- .../Test/Unit/Model/SourceRepositoryTest.php | 7 ++++++- .../Magento/Inventory/Test/Unit/Model/SourceTest.php | 3 +-- .../Api/Data/SourceCarrierLinkInterface.php | 4 +--- .../InventoryApi/Api/Data/SourceInterface.php | 6 +++--- app/code/Magento/InventoryApi/etc/acl.xml | 4 ++-- app/code/Magento/InventoryApi/etc/webapi.xml | 8 ++++---- 14 files changed, 32 insertions(+), 50 deletions(-) diff --git a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php index 0b4ca170dae16..4c90692895494 100644 --- a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php @@ -10,10 +10,6 @@ use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Inventory\Model\Source as SourceModel; -/** - * Class Collection - * @package Magento\Inventory\Model\Resource\Source - */ class Collection extends AbstractCollection { /** @@ -31,4 +27,4 @@ public function getIdFieldName() { return SourceInterface::SOURCE_ID; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php index b0f81b2a9721e..5c927aa985b09 100644 --- a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php @@ -8,7 +8,6 @@ use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Inventory\Setup\InstallSchema; -use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; class SourceCarrierLink extends AbstractDb { @@ -16,12 +15,9 @@ class SourceCarrierLink extends AbstractDb * Initialize resource model * * @return void - * - * @codingStandardsIgnore - * @codeCoverageIgnore */ protected function _construct() { $this->_init(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK, 'source_carrier_link_id'); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php b/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php index 504845bd0012a..aec2ab9577af3 100644 --- a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php +++ b/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php @@ -3,10 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Inventory\Model\Resource\SourceCarrierLink; use Magento\Inventory\Model\Resource\SourceCarrierLink as ResourceSourceCarrierLink; -use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Inventory\Model\SourceCarrierLink as SourceCarrierLinkModel; @@ -15,9 +15,6 @@ class Collection extends AbstractCollection /** * Initialize resource model * @return void - * - * @codingStandardsIgnore - * @codeCoverageIgnore */ protected function _construct() { @@ -33,4 +30,4 @@ public function getIdFieldName() { return 'source_carrier_link_id'; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index bc507b56a82a9..c7226302e786d 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -6,14 +6,14 @@ namespace Magento\Inventory\Model; -use Magento\Framework\Model\AbstractModel; +use Magento\Framework\Model\AbstractExtensibleModel; use \Magento\InventoryApi\Api\Data\SourceInterface; /** * Class Source * @package Magento\Inventory\Model */ -class Source extends AbstractModel implements SourceInterface +class Source extends AbstractExtensibleModel implements SourceInterface { /** * @inheritdoc @@ -350,4 +350,4 @@ public function setExtensionAttributes( ) { return $this->_setExtensionAttributes($extensionAttributes); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php index eabd31651a977..5a7606340f259 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php @@ -6,19 +6,18 @@ namespace Magento\Inventory\Model; -use Magento\Framework\Model\AbstractModel; +use Magento\Framework\Model\AbstractExtensibleModel; use \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; -class SourceCarrierLink extends AbstractModel implements SourceCarrierLinkInterface +class SourceCarrierLink extends AbstractExtensibleModel implements SourceCarrierLinkInterface { - /** * Name of the resource collection model * * @codingStandardsIgnore * @var string */ - protected $_collectionName = 'Magento\Inventory\Model\Resource\SourceCarrierLink\Collection'; + protected $_collectionName = \Magento\Inventory\Model\Resource\SourceCarrierLink\Collection::class; /** * Initialize resource model @@ -28,9 +27,8 @@ class SourceCarrierLink extends AbstractModel implements SourceCarrierLinkInterf */ protected function _construct() { - $this->_init('Magento\Inventory\Model\Resource\SourceCarrierLink'); + $this->_init(\Magento\Inventory\Model\Resource\SourceCarrierLink::class); } - /** * @inheritDoc @@ -82,4 +80,4 @@ public function setExtensionAttributes( ) { return $this->_setExtensionAttributes($extensionAttributes); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index ad6fb0a3b0e80..607b202d4c299 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -110,16 +110,9 @@ public function getList(SearchCriteriaInterface $searchCriteria = null) $collection = $this->collectionFactory->create(); $this->collectionProcessor->process($searchCriteria, $collection); - /** @var SourceInterface[] $sources */ - $sources = []; - /** @var SourceInterface $source */ - foreach ($collection->getItems() as $source) { - $sources[] = $source; - } - /** @var SourceSearchResultsInterface $searchResults */ $searchResults = $this->sourceSearchResultsFactory->create(); - $searchResults->setItems($sources); + $searchResults->setItems($collection->getItems()); $searchResults->setSearchCriteria($searchCriteria); $searchResults->setTotalCount($collection->getSize()); return $searchResults; diff --git a/app/code/Magento/Inventory/Model/SourceSearchResults.php b/app/code/Magento/Inventory/Model/SourceSearchResults.php index f8fec226556f0..685ed663b25c1 100644 --- a/app/code/Magento/Inventory/Model/SourceSearchResults.php +++ b/app/code/Magento/Inventory/Model/SourceSearchResults.php @@ -14,4 +14,5 @@ */ class SourceSearchResults extends SearchResults implements SourceSearchResultsInterface { + } diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php index 352ca93113a38..fe6ff139cbc17 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php @@ -6,7 +6,6 @@ namespace Magento\Inventory\Test\Unit\Model; -use \Magento\Inventory\Model\Source; use \Magento\Inventory\Model\SourceCarrierLink; class SourceCarrierLinkTest extends \PHPUnit_Framework_TestCase @@ -44,4 +43,4 @@ public function testPosition() $this->sourceCarrierLink->setPosition(SourceCarrierLinkTest::TEST_POSITION); $this->assertEquals($this->sourceCarrierLink->getPosition(), SourceCarrierLinkTest::TEST_POSITION); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 72e2fcf1c5ada..3e06272ef7281 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -3,7 +3,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Inventory\Test\Unit\Model; + use Magento\InventoryApi\Api\Data\SourceInterface; /** @@ -120,6 +122,9 @@ public function testSaveErrorExpectsException() false ); + $this->resource->expects($this->atLeastOnce()) + ->method('save'); + $this->setExpectedException(\Magento\Framework\Exception\CouldNotSaveException::class); $this->resource->expects($this->atLeastOnce()) @@ -129,7 +134,7 @@ public function testSaveErrorExpectsException() $this->sourceRepository->save($sourceModel); } - public function testGetSuccessfull() + public function testGetSuccessful() { $sourceId = 345; diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php index f9631c32f0828..a9c7fcd2d651c 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php @@ -7,7 +7,6 @@ namespace Magento\Inventory\Test\Unit\Model; use \Magento\Inventory\Model\Source; -use \Magento\Inventory\Model\SourceCarrierLink; class SourceTest extends \PHPUnit_Framework_TestCase { @@ -137,4 +136,4 @@ public function testCarrierLinks() $this->assertEquals($carrierLinks, $this->source->getCarrierLinks()); } -} \ No newline at end of file +} diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index 4a976ee33eb9c..ad84cda34323c 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -9,7 +9,6 @@ interface SourceCarrierLinkInterface extends ExtensibleDataInterface { - /**#@+ * Constants for keys of data array. Identical to the name of the getter in snake case */ @@ -17,7 +16,6 @@ interface SourceCarrierLinkInterface extends ExtensibleDataInterface const POSITION = 'position'; /**#@-*/ - /** * Get carrier code. * @@ -64,4 +62,4 @@ public function getExtensionAttributes(); public function setExtensionAttributes( \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface $extensionAttributes ); -} \ No newline at end of file +} diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php index acc63d213b421..70cef91a7dd08 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php @@ -143,14 +143,14 @@ public function setLatitude($latitude); /** * Get source longitude. * - * @return int + * @return float */ public function getLongitude(); /** * Set source longitude. * - * @param int $longitude + * @param float $longitude * @return $this */ public function setLongitude($longitude); @@ -317,4 +317,4 @@ public function getExtensionAttributes(); public function setExtensionAttributes( \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes ); -} \ No newline at end of file +} diff --git a/app/code/Magento/InventoryApi/etc/acl.xml b/app/code/Magento/InventoryApi/etc/acl.xml index 6ee353447968e..b353c2a552442 100644 --- a/app/code/Magento/InventoryApi/etc/acl.xml +++ b/app/code/Magento/InventoryApi/etc/acl.xml @@ -9,8 +9,8 @@ - - + + diff --git a/app/code/Magento/InventoryApi/etc/webapi.xml b/app/code/Magento/InventoryApi/etc/webapi.xml index 746582646932a..6c413af4829cd 100644 --- a/app/code/Magento/InventoryApi/etc/webapi.xml +++ b/app/code/Magento/InventoryApi/etc/webapi.xml @@ -10,25 +10,25 @@ - + - + - + - + From df90ef39753e4f409a9479fc532d4c7c864cf59f Mon Sep 17 00:00:00 2001 From: Thomas Kreidenhuber Date: Sun, 21 May 2017 09:49:11 +0200 Subject: [PATCH 0072/1004] magento-engcom/magento2#25 added missing unit tests in sourcetest --- .../Inventory/Test/Unit/Model/SourceTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php index c003252645c05..2e069b2f112b4 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php @@ -77,6 +77,12 @@ public function testLatitude() $this->assertEquals($this->source->getLatitude(), SourceTest::TEST_STRING); } + public function testLongitude() + { + $this->source->setLongitude(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getLongitude(), SourceTest::TEST_STRING); + } + public function testCountryId() { $this->source->setCountryId(SourceTest::TEST_ID); @@ -89,6 +95,12 @@ public function testRegion() $this->assertEquals($this->source->getRegion(), SourceTest::TEST_STRING); } + public function testCity() + { + $this->source->setCity(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getCity(), SourceTest::TEST_STRING); + } + public function testStreet() { $this->source->setStreet(SourceTest::TEST_STRING); @@ -101,6 +113,12 @@ public function testPhone() $this->assertEquals($this->source->getPhone(), SourceTest::TEST_STRING); } + public function testPostcode() + { + $this->source->setPostcode(SourceTest::TEST_STRING); + $this->assertEquals($this->source->getPostcode(), SourceTest::TEST_STRING); + } + public function testFax() { $this->source->setFax(SourceTest::TEST_STRING); From ffa755ac7c60b246b42d603b2c021681b024d426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20R=C3=B6ttig?= Date: Sun, 21 May 2017 10:01:29 +0200 Subject: [PATCH 0073/1004] magento-engcom/magento2#3 added grid for sources --- .../Controller/Adminhtml/Sources/Index.php | 21 +++++ .../Magentoinventorysource/PageActions.php | 27 +++++++ .../Magento/Inventory/Source.php | 17 ++++ .../Magento/Inventory/etc/adminhtml/menu.xml | 6 ++ .../Inventory/etc/adminhtml/routes.xml | 14 ++++ .../layout/inventory_sources_index.xml | 11 +++ .../ui_component/magento_inventory_source.xml | 79 +++++++++++++++++++ app/code/Magento/InventoryApi/etc/acl.xml | 18 ----- 8 files changed, 175 insertions(+), 18 deletions(-) create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php create mode 100644 app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php create mode 100644 app/code/Magento/Inventory/Ui/Component/Listing/DataProviders/Magento/Inventory/Source.php create mode 100644 app/code/Magento/Inventory/etc/adminhtml/menu.xml create mode 100644 app/code/Magento/Inventory/etc/adminhtml/routes.xml create mode 100644 app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml create mode 100644 app/code/Magento/Inventory/view/adminhtml/ui_component/magento_inventory_source.xml delete mode 100644 app/code/Magento/InventoryApi/etc/acl.xml diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php new file mode 100644 index 0000000000000..3023551901d91 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php @@ -0,0 +1,21 @@ +resultPageFactory = $resultPageFactory; + parent::__construct($context); + } + + public function execute() + { + return $this->resultPageFactory->create(); + } +} diff --git a/app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php b/app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php new file mode 100644 index 0000000000000..0e98a6cf4a8da --- /dev/null +++ b/app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php @@ -0,0 +1,27 @@ +getData("name"); + $id = "X"; + if(isset($item["source_id"])) + { + $id = $item["source_id"]; + } + $item[$name]["view"] = [ + "href"=>$this->getContext()->getUrl( + "magento_inventory_source/page/edit",["source_id"=>$id]), + "label"=>__("Edit") + ]; + } + } + + return $dataSource; + } + +} diff --git a/app/code/Magento/Inventory/Ui/Component/Listing/DataProviders/Magento/Inventory/Source.php b/app/code/Magento/Inventory/Ui/Component/Listing/DataProviders/Magento/Inventory/Source.php new file mode 100644 index 0000000000000..ae95f5f305423 --- /dev/null +++ b/app/code/Magento/Inventory/Ui/Component/Listing/DataProviders/Magento/Inventory/Source.php @@ -0,0 +1,17 @@ +collection = $collectionFactory->create(); + } +} diff --git a/app/code/Magento/Inventory/etc/adminhtml/menu.xml b/app/code/Magento/Inventory/etc/adminhtml/menu.xml new file mode 100644 index 0000000000000..87ff2237ffa9a --- /dev/null +++ b/app/code/Magento/Inventory/etc/adminhtml/menu.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/code/Magento/Inventory/etc/adminhtml/routes.xml b/app/code/Magento/Inventory/etc/adminhtml/routes.xml new file mode 100644 index 0000000000000..b3c812662a0d7 --- /dev/null +++ b/app/code/Magento/Inventory/etc/adminhtml/routes.xml @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml new file mode 100644 index 0000000000000..dae858f604e08 --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/magento_inventory_source.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/magento_inventory_source.xml new file mode 100644 index 0000000000000..d01685591afce --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/magento_inventory_source.xml @@ -0,0 +1,79 @@ + + ++ + + magento_inventory_source.magento_inventory_source_data_source + magento_inventory_source.magento_inventory_source_data_source + + magento_inventory_source_columns + + + add + Add New + primary + */Page/new + + + + + + Magento\Inventory\Ui\Component\Listing\DataProviders\Magento\Inventory\Source + magento_inventory_source_data_source + source_id + id + + + + + source_id + + + + + + + Magento_Ui/js/grid/provider + + + + + + + + + + + false + 55 + source_id + 10 + + + + + + + textRange + asc + ID + + + + + + + false + 107 + source_id + 200 + + + + + diff --git a/app/code/Magento/InventoryApi/etc/acl.xml b/app/code/Magento/InventoryApi/etc/acl.xml deleted file mode 100644 index 6ee353447968e..0000000000000 --- a/app/code/Magento/InventoryApi/etc/acl.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - From fc4dcba456b8df4d2dd289b84ac75151d8515d0e Mon Sep 17 00:00:00 2001 From: Nils Date: Sun, 21 May 2017 10:34:57 +0200 Subject: [PATCH 0074/1004] Remove obsolete DocBloc --- app/code/Magento/Inventory/Model/SourceSearchResults.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/code/Magento/Inventory/Model/SourceSearchResults.php b/app/code/Magento/Inventory/Model/SourceSearchResults.php index 685ed663b25c1..ed3ebe129d326 100644 --- a/app/code/Magento/Inventory/Model/SourceSearchResults.php +++ b/app/code/Magento/Inventory/Model/SourceSearchResults.php @@ -10,7 +10,6 @@ /** * Class SourceSearchResults - * @package Magento\Inventory\Model */ class SourceSearchResults extends SearchResults implements SourceSearchResultsInterface { From c5f9131dbdb6c3b47d51c0169fcb379d909f00d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20R=C3=B6ttig?= Date: Sun, 21 May 2017 11:10:17 +0200 Subject: [PATCH 0075/1004] magento-engcom/magento2#3 rename ui grid to listing add doc --- .../Magentoinventorysource/PageActions.php | 35 ++++++++++++++----- .../layout/inventory_sources_index.xml | 9 +++-- ...ource.xml => inventory_source_listing.xml} | 14 ++++---- 3 files changed, 40 insertions(+), 18 deletions(-) rename app/code/Magento/Inventory/view/adminhtml/ui_component/{magento_inventory_source.xml => inventory_source_listing.xml} (85%) diff --git a/app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php b/app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php index 0e98a6cf4a8da..0209b27f7e44b 100644 --- a/app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php +++ b/app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php @@ -1,27 +1,44 @@ getData("name"); $id = "X"; - if(isset($item["source_id"])) - { - $id = $item["source_id"]; + + if (isset($item[SourceInterface::SOURCE_ID])) { + $id = $item[SourceInterface::SOURCE_ID]; } + + $href = $this->getContext()->getUrl( + "magento_inventory_source/page/edit", + [SourceInterface::SOURCE_ID => $id] + ); + $item[$name]["view"] = [ - "href"=>$this->getContext()->getUrl( - "magento_inventory_source/page/edit",["source_id"=>$id]), - "label"=>__("Edit") + "href" => $href, + "label" => __("Edit") ]; } } - return $dataSource; - } - + } } diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml index dae858f604e08..1553f7df01373 100644 --- a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml @@ -1,11 +1,16 @@ - + - + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/magento_inventory_source.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml similarity index 85% rename from app/code/Magento/Inventory/view/adminhtml/ui_component/magento_inventory_source.xml rename to app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml index d01685591afce..d27b9124da590 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/magento_inventory_source.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml @@ -8,10 +8,10 @@ - magento_inventory_source.magento_inventory_source_data_source - magento_inventory_source.magento_inventory_source_data_source + inventory_source_listing.inventory_source_listing_data_source + inventory_source_listing.inventory_source_listing_data_source - magento_inventory_source_columns + inventory_source_listing_columns add @@ -21,10 +21,10 @@ - + Magento\Inventory\Ui\Component\Listing\DataProviders\Magento\Inventory\Source - magento_inventory_source_data_source + inventory_source_listing_data_source source_id id @@ -45,7 +45,7 @@ - + @@ -56,7 +56,7 @@ - + textRange From d2bc7b7f336f2e9e4454287c066bf6fa4919f7d8 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sun, 21 May 2017 11:14:28 +0200 Subject: [PATCH 0076/1004] magento-engcom/magento2#25: WIP api-functional tests --- .../InventoryApi/Api/SourceRepositoryTest.php | 117 +++++++++++++++++- 1 file changed, 115 insertions(+), 2 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index ee6f0893ea030..5d93f34f9ee76 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -5,7 +5,11 @@ */ namespace Magento\InventoryApi\Api; +use Magento\Directory\Api\CountryInformationAcquirerInterface; +use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; +use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\TestFramework\TestCase\WebapiAbstract; +use Magento\TestFramework\Helper\Bootstrap; class SourceRepositoryTest extends WebapiAbstract { @@ -13,13 +17,122 @@ class SourceRepositoryTest extends WebapiAbstract const SERVICE_NAME = 'inventoryApiSourceRepositoryV1'; const RESOURCE_PATH = '/V1/inventory/source/'; + /** + * @var \Magento\InventoryApi\Api\Data\SourceInterfaceFactory + */ + private $sourceFactory; + + /** + * @var CountryInformationAcquirerInterface + */ + private $countryInformationAcquirer; + + /** + * @var \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterfaceFactory + */ + private $sourceCarrierLinkFactory; + + /** + * Execute per test initialization. + */ + public function setUp() + { + $this->sourceFactory = Bootstrap::getObjectManager() + ->create(\Magento\InventoryApi\Api\Data\SourceInterfaceFactory::class); + $this->countryInformationAcquirer = Bootstrap::getObjectManager() + ->create(CountryInformationAcquirerInterface::class); + $this->sourceCarrierLinkFactory = Bootstrap::getObjectManager() + ->create(\Magento\InventoryApi\Api\Data\SourceCarrierLinkInterfaceFactory::class); + } + /** * Create new Inventory Source using Web API and verify it's integrity. */ public function testCreateSource() { - //TODO: Implement testCreateSource - $this->fail(__METHOD__ . " is not implemented yet."); + $country = $this->countryInformationAcquirer->getCountryInfo('DE'); + + $name = 'Source name'; + $description = 'Some description for source'; + $city = 'Exampletown'; + $street = 'Some Street 455'; + $postcode = 54321; + $contactName = 'Contact Name'; + $email = 'example.guy@test.com'; + $fax = '0120002020033'; + $phone = '0120002020044'; + $latitude = 51.343479; + $longitude = 12.387772; + $isActive = true; + $priority = 40; + + $carrierCode1 = 'CAR-1'; + $carrierCode2 = 'CAR-2'; + + /** @var SourceCarrierLinkInterface $carrierLink1 */ + $carrierLink1 = $this->sourceCarrierLinkFactory->create(); + $carrierLink1->setPosition(1) + ->setCarrierCode($carrierCode1); + + /** @var SourceCarrierLinkInterface $carrierLink2*/ + $carrierLink2 = $this->sourceCarrierLinkFactory->create(); + $carrierLink2->setPosition(2) + ->setCarrierCode($carrierCode2); + + /** @var \Magento\InventoryApi\Api\Data\SourceInterface $sourceDataObject */ + $sourceDataObject = $this->sourceFactory->create(); + $sourceDataObject->setName($name) + ->setDescription($description) + ->setCity($city) + ->setPostcode($postcode) + ->setContactName($contactName) + ->setCountryId($country->getId()) + ->setEmail($email) + ->setFax($fax) + ->setPhone($phone) + ->setLatitude($latitude) + ->setLongitude($longitude) + ->setIsActive($isActive) + ->setPriority($priority) + ->setStreet($street) + ->setCarrierLinks([ + $carrierLink1, + $carrierLink2 + ]); + + $regions = $country->getAvailableRegions(); + if ($regions) { + $region = $regions[0]; + $sourceDataObject->setRegion($region->getName()); + $sourceDataObject->setRegionId($region->getId()); + } + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Save', + ], + ]; + + + $requestData = [ + 'source' => [ + SourceInterface::CITY => $sourceDataObject->getCity(), + SourceInterface::CONTACT_NAME => $sourceDataObject->getContactName(), + SourceInterface::COUNTRY_ID => $sourceDataObject->getCountryId(), + SourceInterface::DESCRIPTION => $sourceDataObject->getDescription(), + SourceInterface::NAME => $sourceDataObject->getName(), + SourceInterface::EMAIL => $sourceDataObject->getEmail(), + ], + ]; + + $result = $this->_webApiCall($serviceInfo, $requestData); + var_dump($result); } /** From 771b143733f6b6981df86dc61e4836f86b176559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20R=C3=B6ttig?= Date: Sun, 21 May 2017 12:10:27 +0200 Subject: [PATCH 0077/1004] magento-engcom/magento2#3 Add edit action and grid element --- .../Controller/Adminhtml/Sources/Edit.php | 39 +++++++++++++++++++ .../Controller/Adminhtml/Sources/Index.php | 25 ++++++++++-- .../SourceActions.php} | 10 ++--- .../layout/inventory_sources_edit.xml | 14 +++++++ .../ui_component/inventory_source_listing.xml | 20 +++++++++- 5 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Sources/Edit.php rename app/code/Magento/Inventory/Ui/Component/Listing/{Column/Magentoinventorysource/PageActions.php => Columns/SourceActions.php} (76%) create mode 100644 app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Edit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Edit.php new file mode 100644 index 0000000000000..f9db914ed656a --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Edit.php @@ -0,0 +1,39 @@ +resultPageFactory = $resultPageFactory; + parent::__construct($context); + } + + /** + * @return \Magento\Framework\View\Result\Page + */ + public function execute() + { + return $this->resultPageFactory->create(); + } +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php index 3023551901d91..5715766a854e2 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php @@ -1,11 +1,25 @@ resultPageFactory = $resultPageFactory; parent::__construct($context); } - + + /** + * @return \Magento\Framework\View\Result\Page + */ public function execute() { return $this->resultPageFactory->create(); diff --git a/app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php b/app/code/Magento/Inventory/Ui/Component/Listing/Columns/SourceActions.php similarity index 76% rename from app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php rename to app/code/Magento/Inventory/Ui/Component/Listing/Columns/SourceActions.php index 0209b27f7e44b..2dcfe789a8aa1 100644 --- a/app/code/Magento/Inventory/Ui/Component/Listing/Column/Magentoinventorysource/PageActions.php +++ b/app/code/Magento/Inventory/Ui/Component/Listing/Columns/SourceActions.php @@ -4,18 +4,18 @@ * See COPYING.txt for license details. */ -namespace Magento\Inventory\Ui\Component\Listing\Column\Magentoinventorysource; +namespace Magento\Inventory\Ui\Component\Listing\Columns; use Magento\InventoryApi\Api\Data\SourceInterface; /** - * Class PageActions + * Class SourceActions */ -class PageActions extends \Magento\Ui\Component\Listing\Columns\Column +class SourceActions extends \Magento\Ui\Component\Listing\Columns\Column { /** - * Add new edit action for the ui grid. + * Add new edit action for the ui grid. */ public function prepareDataSource(array $dataSource) { @@ -29,7 +29,7 @@ public function prepareDataSource(array $dataSource) } $href = $this->getContext()->getUrl( - "magento_inventory_source/page/edit", + "inventory/sources/edit", [SourceInterface::SOURCE_ID => $id] ); diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml new file mode 100644 index 0000000000000..4f7d677aaee92 --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml index d27b9124da590..aa08caa4b6fb0 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml @@ -43,6 +43,24 @@ + + true + + + + + + + + Delete selected items? + Delete items + + + delete + + + + @@ -65,7 +83,7 @@ - + false From d9aefacf083b28733a6f19efa6242211fd44c675 Mon Sep 17 00:00:00 2001 From: Thomas Kreidenhuber Date: Sun, 21 May 2017 12:55:59 +0200 Subject: [PATCH 0078/1004] magento-engcom/magento2#25 made changes from codereview in pull request --- .../Model/Resource/Source/Collection.php | 8 - app/code/Magento/Inventory/Model/Source.php | 11 +- .../Inventory/Model/SourceCarrierLink.php | 8 - .../Inventory/Model/SourceRepository.php | 41 +- .../Inventory/Model/SourceSearchResults.php | 4 - .../Magento/Inventory/Setup/InstallSchema.php | 365 ++++++++++-------- .../Test/Unit/Model/SourceCarrierLinkTest.php | 7 +- .../Test/Unit/Model/SourceRepositoryTest.php | 1 - .../Inventory/Test/Unit/Model/SourceTest.php | 7 +- .../InventoryApi/Api/Data/SourceInterface.php | 2 +- .../Api/SourceRepositoryInterface.php | 2 +- 11 files changed, 255 insertions(+), 201 deletions(-) diff --git a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php index 4c90692895494..d149d175115e7 100644 --- a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/Resource/Source/Collection.php @@ -19,12 +19,4 @@ protected function _construct() { $this->_init(SourceModel::class, ResourceSource::class); } - - /** - * @inheritdoc - */ - public function getIdFieldName() - { - return SourceInterface::SOURCE_ID; - } } diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index c7226302e786d..b027936da91cc 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -10,16 +10,13 @@ use \Magento\InventoryApi\Api\Data\SourceInterface; /** - * Class Source - * @package Magento\Inventory\Model + * Class Source, + * provides implementation of the SourceInterface which adds the possibilty + * for a Merchant to map existing physical sources to some particular sales channels + * this model holds the information like name and description of this physical sources */ class Source extends AbstractExtensibleModel implements SourceInterface { - /** - * @inheritdoc - */ - protected $_collectionName = \Magento\Inventory\Model\Resource\Source\Collection::class; - /** * @inheritdoc */ diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php index 5a7606340f259..2b5473103521f 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php @@ -11,14 +11,6 @@ class SourceCarrierLink extends AbstractExtensibleModel implements SourceCarrierLinkInterface { - /** - * Name of the resource collection model - * - * @codingStandardsIgnore - * @var string - */ - protected $_collectionName = \Magento\Inventory\Model\Resource\SourceCarrierLink\Collection::class; - /** * Initialize resource model * diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 607b202d4c299..27bef7ff55840 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -17,11 +17,14 @@ use Magento\Inventory\Model\SourceSearchResultsFactory; use Magento\Inventory\Model\Resource\Source as ResourceSource; use Magento\Inventory\Model\Resource\Source\CollectionFactory; -use Magento\Inventory\Model\SourceFactory; +use Magento\Inventory\Model\SourceFactoryInterface; +use \Psr\Log\LoggerInterface; /** * Class SourceRepository - * @package Magento\Inventory\Model + * + * Provides implementation of CQRS for sourcemodel + * */ class SourceRepository implements SourceRepositoryInterface { @@ -31,7 +34,7 @@ class SourceRepository implements SourceRepositoryInterface private $resource; /** - * @var SourceFactory + * @var SourceFactoryInterface */ private $sourceFactory; @@ -50,26 +53,34 @@ class SourceRepository implements SourceRepositoryInterface */ private $sourceSearchResultsFactory; + /** + * @var LoggerInterface + */ + private $logger; + /** * SourceRepository constructor. * @param ResourceSource $resource - * @param SourceFactory $sourceFactory + * @param SourceFactoryInterface $sourceFactory * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $collectionFactory * @param SourceSearchResultsFactory $sourceSearchResultsFactory + * @param LoggerInterface $logger */ public function __construct( ResourceSource $resource, - SourceFactory $sourceFactory, + SourceFactoryInterface $sourceFactory, CollectionProcessorInterface $collectionProcessor, CollectionFactory $collectionFactory, - SourceSearchResultsFactory $sourceSearchResultsFactory + SourceSearchResultsFactory $sourceSearchResultsFactory, + LoggerInterface $logger ) { $this->resource = $resource; $this->sourceFactory = $sourceFactory; $this->collectionProcessor = $collectionProcessor; $this->collectionFactory = $collectionFactory; $this->sourceSearchResultsFactory = $sourceSearchResultsFactory; + $this->logger = $logger; } /** @@ -80,9 +91,9 @@ public function save(SourceInterface $source) try { $this->resource->save($source); } catch (\Exception $exception) { - throw new CouldNotSaveException(__($exception->getMessage())); + $this->logger->error($exception->getMessage()); + throw new CouldNotSaveException(__('Could not save source')); } - return $source; } /** @@ -91,14 +102,14 @@ public function save(SourceInterface $source) public function get($sourceId) { /** @var SourceInterface|AbstractModel $model */ - $model = $this->sourceFactory->create(); - $this->resource->load($model, SourceInterface::SOURCE_ID, $sourceId); + $source = $this->sourceFactory->create(); + $this->resource->load($source, SourceInterface::SOURCE_ID, $sourceId); - if (!$model->getSourceId()) { + if (!$source->getSourceId()) { throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); } - return $model; + return $source; } /** @@ -108,7 +119,11 @@ public function getList(SearchCriteriaInterface $searchCriteria = null) { /** @var \Magento\Inventory\Model\Resource\Source\Collection $collection */ $collection = $this->collectionFactory->create(); - $this->collectionProcessor->process($searchCriteria, $collection); + + // if there is a searchCriteria defined, use it to add its creterias to the collection + if (!is_null($searchCriteria)) { + $this->collectionProcessor->process($searchCriteria, $collection); + } /** @var SourceSearchResultsInterface $searchResults */ $searchResults = $this->sourceSearchResultsFactory->create(); diff --git a/app/code/Magento/Inventory/Model/SourceSearchResults.php b/app/code/Magento/Inventory/Model/SourceSearchResults.php index 685ed663b25c1..e41ad207c8e48 100644 --- a/app/code/Magento/Inventory/Model/SourceSearchResults.php +++ b/app/code/Magento/Inventory/Model/SourceSearchResults.php @@ -8,10 +8,6 @@ use Magento\Framework\Api\SearchResults; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; -/** - * Class SourceSearchResults - * @package Magento\Inventory\Model - */ class SourceSearchResults extends SearchResults implements SourceSearchResultsInterface { diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index 18636d89597fb..ae8a3c878d28a 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -7,20 +7,25 @@ use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; use Magento\InventoryApi\Api\Data\SourceInterface; +use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; -/** - * Class InstallSchema - * @package Magento\Inventory\Setup - */ class InstallSchema implements InstallSchemaInterface { /** - * + * Constant for table names of the model \Magento\Inventory\Model\Source */ const TABLE_NAME_SOURCE = 'inventory_source'; + + /** + * Constant for table name of \Magento\Inventory\Model\SourceCarrierLink + */ const TABLE_NAME_SOURCE_CARRIER_LINK = 'inventory_source_carrier_link'; + /** + * Constant for decimal precision for latitude and longitude + */ + const DECIMAL_PLACES = 8; /** * Option keys for column options @@ -32,8 +37,12 @@ class InstallSchema implements InstallSchemaInterface const OPTION_DEFAULT = 'default'; const OPTION_TYPE = 'type'; const OPTION_LENGTH = 'length'; + const OPTION_SCALE = 'scale'; + const OPTION_PRECISION = 'precision'; /** + * Generates needed database structure for source and sourcecarrierlink implementation from this module + * * @param SchemaSetupInterface $setup * @param ModuleContextInterface $context */ @@ -44,123 +53,165 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $tableNameSourceEntity = $installer->getTable(InstallSchema::TABLE_NAME_SOURCE); if (!$installer->getConnection()->isTableExists($tableNameSourceEntity)) { - $table = $installer->getConnection()->newTable($tableNameSourceEntity); - $options = [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true - ]; - $table->addColumn(SourceInterface::SOURCE_ID, Table::TYPE_INTEGER, null, $options, 'Source ID'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::NAME, Table::TYPE_TEXT, 255, $options, 'Source Name'); - - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::CONTACT_NAME, Table::TYPE_TEXT, 255, $options, 'Contact Name'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::EMAIL, Table::TYPE_TEXT, 255, $options, 'Email'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_DEFAULT => 1 - ]; - $table->addColumn(SourceInterface::IS_ACTIVE, - Table::TYPE_SMALLINT, + $table->addColumn( + SourceInterface::SOURCE_ID, + Table::TYPE_INTEGER, null, - $options, - 'Defines Is Source Active'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::DESCRIPTION, Table::TYPE_TEXT, 255, $options, 'Description'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::LATITUDE, Table::TYPE_TEXT, 255, $options, 'Latitude'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::LONGITUDE, Table::TYPE_TEXT, 255, $options, 'Longitude'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true - ]; - - $table->addColumn(SourceInterface::COUNTRY_ID, Table::TYPE_SMALLINT, null, $options, 'Country Id'); - - $options = [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true - ]; - - $table->addColumn(SourceInterface::REGION_ID, Table::TYPE_SMALLINT, null, $options, 'Region Id'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::REGION, Table::TYPE_TEXT, 255, $options, 'Region'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::CITY, Table::TYPE_TEXT, 255, $options, 'City'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::STREET, Table::TYPE_TEXT, 255, $options, 'Street'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::POSTCODE, Table::TYPE_TEXT, 255, $options, 'Postcode'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::PHONE, Table::TYPE_TEXT, 255, $options, 'Phone'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn(SourceInterface::FAX, Table::TYPE_TEXT, 255, $options, 'Fax'); - - $options = [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true, - ]; - - $table->addColumn(SourceInterface::PRIORITY, Table::TYPE_SMALLINT, null, $options, 'Priority'); - - + [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_PRIMARY => true + ], + 'Source ID' + ) + ->addColumn( + SourceInterface::NAME, + Table::TYPE_TEXT, + 255, [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Source Name' + ) + ->addColumn( + SourceInterface::CONTACT_NAME, + Table::TYPE_TEXT, + 255, [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Contact Name' + ) + ->addColumn( + SourceInterface::EMAIL, + Table::TYPE_TEXT, + 255, [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Email' + ) + ->addColumn( + SourceInterface::IS_ACTIVE, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_DEFAULT => 1 + ], + 'Defines Is Source Active' + ) + ->addColumn( + SourceInterface::DESCRIPTION, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Description' + ) + ->addColumn( + SourceInterface::LATITUDE, + Table::TYPE_DECIMAL, null, + [ + InstallSchema::OPTION_PRECISION => InstallSchema::DECIMAL_PLACES, + InstallSchema::OPTION_SCALE => InstallSchema::DECIMAL_PLACES, + InstallSchema::OPTION_NULLABLE => true + ], 'Latitude' + ) + ->addColumn( + SourceInterface::LONGITUDE, + Table::TYPE_DECIMAL, null, + [ + InstallSchema::OPTION_PRECISION => InstallSchema::DECIMAL_PLACES, + InstallSchema::OPTION_SCALE => InstallSchema::DECIMAL_PLACES, + InstallSchema::OPTION_NULLABLE => true + ], 'Longitude' + ) + ->addColumn( + SourceInterface::COUNTRY_ID, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true + ], 'Country Id' + )->addColumn( + SourceInterface::REGION_ID, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => true, + InstallSchema::OPTION_UNSIGNED => true + ], 'Region Id' + )->addColumn( + SourceInterface::REGION, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], 'Region' + ) + ->addColumn( + SourceInterface::CITY, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], 'City' + ) + ->addColumn( + SourceInterface::STREET, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], 'Street' + ) + ->addColumn( + SourceInterface::POSTCODE, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], 'Postcode' + ) + ->addColumn( + SourceInterface::PHONE, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], 'Phone' + ) + ->addColumn( + SourceInterface::FAX, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], 'Fax' + ) + ->addColumn( + SourceInterface::PRIORITY, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => true, + InstallSchema::OPTION_UNSIGNED => true, + ], 'Priority' + ); $table->setComment('Inventory Source Entity Table')->setOption('type', 'InnoDB')->setOption('charset', 'utf8'); $installer->getConnection()->createTable($table); @@ -170,38 +221,43 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con if (!$installer->getConnection()->isTableExists($tableNameCarrierLinkEntity)) { $table = $installer->getConnection()->newTable($tableNameCarrierLinkEntity); - - $options = [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true - ]; - $table->addColumn('source_carrier_link_id', - Table::TYPE_INTEGER, - null, - $options, - 'Source Carrier Link ID' - ); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - ]; - $table->addColumn(SourceInterface::SOURCE_ID, Table::TYPE_INTEGER, null, $options, 'Source ID'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ]; - $table->addColumn('carrier_code', Table::TYPE_TEXT, 255, $options, 'Carrier Code'); - - $options = [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - ]; - - $table->addColumn('position', Table::TYPE_SMALLINT, null, $options, 'Position'); + $table->addColumn( + 'source_carrier_link_id', + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_PRIMARY => true + ], + 'Source Carrier Link ID' + ) + ->addColumn( + SourceInterface::SOURCE_ID, + Table::TYPE_INTEGER, null, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + ], 'Source ID' + ) + ->addColumn( + SourceCarrierLinkInterface::CARRIER_CODE, + Table::TYPE_TEXT, 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], 'Carrier Code' + ) + ->addColumn( + 'position', Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + ], + 'Position' + ); // Add foreign key for Pipeline ID field $foreignKeyName = $installer->getConnection()->getForeignKeyName( @@ -218,11 +274,12 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con Table::ACTION_CASCADE ); - $table->setComment('Inventory Source Carrier Link Entity Table')->setOption('type', 'InnoDB')->setOption('charset', - 'utf8'); + $table->setComment('Inventory Source Carrier Link Entity Table')->setOption('type', 'InnoDB')->setOption( + 'charset', + 'utf8' + ); $installer->getConnection()->createTable($table); } - $setup->endSetup(); } } diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php index fe6ff139cbc17..259eee69c31a8 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php @@ -8,6 +8,9 @@ use \Magento\Inventory\Model\SourceCarrierLink; +/** + * Class SourceCarrierLinkTest + */ class SourceCarrierLinkTest extends \PHPUnit_Framework_TestCase { /** @@ -19,12 +22,12 @@ class SourceCarrierLinkTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ - protected $objectManager; + private $objectManager; /** * @var SourceCarrierLink */ - protected $sourceCarrierLink; + private $sourceCarrierLink; protected function setUp() { diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 3e06272ef7281..0caa923e7b885 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -10,7 +10,6 @@ /** * Class SourceRepositoryTest - * @package Magento\Inventory\Test\Unit\Model */ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase { diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php index 252cb6c309d08..f78c2e66d9344 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php @@ -8,6 +8,9 @@ use \Magento\Inventory\Model\Source; +/** + * Class SourceTest + */ class SourceTest extends \PHPUnit_Framework_TestCase { /** @@ -20,12 +23,12 @@ class SourceTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager */ - protected $objectManager; + private $objectManager; /** * @var Source */ - protected $source; + private $source; protected function setUp() { diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php index 70cef91a7dd08..75ac289b5f24c 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php @@ -165,7 +165,7 @@ public function getCountryId(); /** * Set source country id. * - * @param string $countryId + * @param int $countryId * @return $this */ public function setCountryId($countryId); diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index 7859e32297fbb..ffd97d5837a1f 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -20,7 +20,7 @@ interface SourceRepositoryInterface * Save Source data. * * @param SourceInterface $source - * @return SourceInterface + * @return void * * @throws CouldNotSaveException */ From f0d8ee85c33ca4c1d999fa72b7ecb82708a32b0e Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sun, 21 May 2017 13:09:55 +0200 Subject: [PATCH 0079/1004] magento-engcom/magento2#25: Implement first api functional test for creating sources --- .../Inventory/Model/SourceRepository.php | 18 +-- .../Api/SourceRepositoryInterface.php | 11 +- .../InventoryApi/Api/SourceRepositoryTest.php | 120 +++++++++++++----- 3 files changed, 102 insertions(+), 47 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 607b202d4c299..1ae30036c51db 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -12,12 +12,12 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Model\AbstractModel; use Magento\InventoryApi\Api\Data\SourceInterface; +use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; +use Magento\InventoryApi\Api\Data\SourceSearchResultsInterfaceFactory; use Magento\InventoryApi\Api\SourceRepositoryInterface; -use Magento\Inventory\Model\SourceSearchResultsFactory; use Magento\Inventory\Model\Resource\Source as ResourceSource; use Magento\Inventory\Model\Resource\Source\CollectionFactory; -use Magento\Inventory\Model\SourceFactory; /** * Class SourceRepository @@ -31,7 +31,7 @@ class SourceRepository implements SourceRepositoryInterface private $resource; /** - * @var SourceFactory + * @var SourceInterfaceFactory */ private $sourceFactory; @@ -46,24 +46,24 @@ class SourceRepository implements SourceRepositoryInterface private $collectionFactory; /** - * @var SourceSearchResultsFactory + * @var SourceSearchResultsInterfaceFactory */ private $sourceSearchResultsFactory; /** * SourceRepository constructor. * @param ResourceSource $resource - * @param SourceFactory $sourceFactory + * @param SourceInterfaceFactory $sourceFactory * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $collectionFactory - * @param SourceSearchResultsFactory $sourceSearchResultsFactory + * @param SourceSearchResultsInterfaceFactory $sourceSearchResultsFactory */ public function __construct( ResourceSource $resource, - SourceFactory $sourceFactory, + SourceInterfaceFactory $sourceFactory, CollectionProcessorInterface $collectionProcessor, CollectionFactory $collectionFactory, - SourceSearchResultsFactory $sourceSearchResultsFactory + SourceSearchResultsInterfaceFactory $sourceSearchResultsFactory ) { $this->resource = $resource; $this->sourceFactory = $sourceFactory; @@ -92,7 +92,7 @@ public function get($sourceId) { /** @var SourceInterface|AbstractModel $model */ $model = $this->sourceFactory->create(); - $this->resource->load($model, SourceInterface::SOURCE_ID, $sourceId); + $this->resource->load($model, $sourceId, SourceInterface::SOURCE_ID); if (!$model->getSourceId()) { throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index 7859e32297fbb..2048dd215db19 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -9,7 +9,6 @@ use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\InventoryApi\Api\Data\SourceInterface; -use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; /** * @api @@ -19,8 +18,8 @@ interface SourceRepositoryInterface /** * Save Source data. * - * @param SourceInterface $source - * @return SourceInterface + * @param \Magento\InventoryApi\Api\Data\SourceInterface $source + * @return \Magento\InventoryApi\Api\Data\SourceInterface * * @throws CouldNotSaveException */ @@ -30,7 +29,7 @@ public function save(SourceInterface $source); * Load Source data by given sourceId. * * @param int $sourceId - * @return SourceInterface + * @return \Magento\InventoryApi\Api\Data\SourceInterface * @throws NoSuchEntityException */ public function get($sourceId); @@ -38,8 +37,8 @@ public function get($sourceId); /** * Load Source data collection by given search criteria * - * @param SearchCriteriaInterface $searchCriteria - * @return SourceSearchResultsInterface + * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria + * @return \Magento\InventoryApi\Api\Data\SourceSearchResultsInterface */ public function getList(SearchCriteriaInterface $searchCriteria = null); } diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index 5d93f34f9ee76..8a4f3a46b5824 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -7,7 +7,9 @@ use Magento\Directory\Api\CountryInformationAcquirerInterface; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; +use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterfaceFactory; use Magento\InventoryApi\Api\Data\SourceInterface; +use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; use Magento\TestFramework\TestCase\WebapiAbstract; use Magento\TestFramework\Helper\Bootstrap; @@ -18,7 +20,7 @@ class SourceRepositoryTest extends WebapiAbstract const RESOURCE_PATH = '/V1/inventory/source/'; /** - * @var \Magento\InventoryApi\Api\Data\SourceInterfaceFactory + * @var SourceInterfaceFactory */ private $sourceFactory; @@ -28,21 +30,31 @@ class SourceRepositoryTest extends WebapiAbstract private $countryInformationAcquirer; /** - * @var \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterfaceFactory + * @var SourceCarrierLinkInterfaceFactory */ private $sourceCarrierLinkFactory; + /** + * @var SourceRepositoryInterface + */ + private $sourceRepository; + /** * Execute per test initialization. */ public function setUp() { $this->sourceFactory = Bootstrap::getObjectManager() - ->create(\Magento\InventoryApi\Api\Data\SourceInterfaceFactory::class); + ->create(SourceInterfaceFactory::class); + $this->countryInformationAcquirer = Bootstrap::getObjectManager() ->create(CountryInformationAcquirerInterface::class); + $this->sourceCarrierLinkFactory = Bootstrap::getObjectManager() - ->create(\Magento\InventoryApi\Api\Data\SourceCarrierLinkInterfaceFactory::class); + ->create(SourceCarrierLinkInterfaceFactory::class); + + $this->sourceRepository = Bootstrap::getObjectManager() + ->create(SourceRepositoryInterface::class); } /** @@ -51,6 +63,8 @@ public function setUp() public function testCreateSource() { $country = $this->countryInformationAcquirer->getCountryInfo('DE'); + $regions = $country->getAvailableRegions(); + $region = $regions[0]; $name = 'Source name'; $description = 'Some description for source'; @@ -69,44 +83,39 @@ public function testCreateSource() $carrierCode1 = 'CAR-1'; $carrierCode2 = 'CAR-2'; - /** @var SourceCarrierLinkInterface $carrierLink1 */ - $carrierLink1 = $this->sourceCarrierLinkFactory->create(); - $carrierLink1->setPosition(1) + /** @var SourceCarrierLinkInterface $expectedCarrierLink1 */ + $expectedCarrierLink1 = $this->sourceCarrierLinkFactory->create(); + $expectedCarrierLink1->setPosition(1) ->setCarrierCode($carrierCode1); - /** @var SourceCarrierLinkInterface $carrierLink2*/ - $carrierLink2 = $this->sourceCarrierLinkFactory->create(); - $carrierLink2->setPosition(2) + /** @var SourceCarrierLinkInterface $expectedCarrierLink2 */ + $expectedCarrierLink2 = $this->sourceCarrierLinkFactory->create(); + $expectedCarrierLink2->setPosition(2) ->setCarrierCode($carrierCode2); - /** @var \Magento\InventoryApi\Api\Data\SourceInterface $sourceDataObject */ - $sourceDataObject = $this->sourceFactory->create(); - $sourceDataObject->setName($name) - ->setDescription($description) + /** @var \Magento\InventoryApi\Api\Data\SourceInterface $expectedSource */ + $expectedSource = $this->sourceFactory->create(); + $expectedSource->setName($name) ->setCity($city) ->setPostcode($postcode) ->setContactName($contactName) ->setCountryId($country->getId()) + ->setDescription($description) ->setEmail($email) + ->setStreet($street) ->setFax($fax) ->setPhone($phone) + ->setRegion($region->getName()) + ->setRegionId($region->getId()) ->setLatitude($latitude) ->setLongitude($longitude) ->setIsActive($isActive) ->setPriority($priority) - ->setStreet($street) ->setCarrierLinks([ - $carrierLink1, - $carrierLink2 + $expectedCarrierLink1, + $expectedCarrierLink2 ]); - $regions = $country->getAvailableRegions(); - if ($regions) { - $region = $regions[0]; - $sourceDataObject->setRegion($region->getName()); - $sourceDataObject->setRegionId($region->getId()); - } - $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH, @@ -119,20 +128,67 @@ public function testCreateSource() ], ]; - $requestData = [ 'source' => [ - SourceInterface::CITY => $sourceDataObject->getCity(), - SourceInterface::CONTACT_NAME => $sourceDataObject->getContactName(), - SourceInterface::COUNTRY_ID => $sourceDataObject->getCountryId(), - SourceInterface::DESCRIPTION => $sourceDataObject->getDescription(), - SourceInterface::NAME => $sourceDataObject->getName(), - SourceInterface::EMAIL => $sourceDataObject->getEmail(), + SourceInterface::NAME => $expectedSource->getName(), + SourceInterface::CITY => $expectedSource->getCity(), + SourceInterface::POSTCODE => $expectedSource->getPostcode(), + SourceInterface::CONTACT_NAME => $expectedSource->getContactName(), + SourceInterface::COUNTRY_ID => $expectedSource->getCountryId(), + SourceInterface::DESCRIPTION => $expectedSource->getDescription(), + SourceInterface::EMAIL => $expectedSource->getEmail(), + SourceInterface::STREET => $expectedSource->getStreet(), + SourceInterface::FAX => $expectedSource->getFax(), + SourceInterface::PHONE => $expectedSource->getPhone(), + SourceInterface::REGION => $expectedSource->getRegion(), + SourceInterface::REGION_ID => $expectedSource->getRegionId(), + SourceInterface::LATITUDE => $expectedSource->getLatitude(), + SourceInterface::LONGITUDE => $expectedSource->getLongitude(), + SourceInterface::IS_ACTIVE => $expectedSource->getIsActive(), + SourceInterface::PRIORITY => $expectedSource->getPriority(), + SourceInterface::CARRIER_LINKS => [ + [ + SourceCarrierLinkInterface::CARRIER_CODE => $expectedCarrierLink1->getCarrierCode(), + SourceCarrierLinkInterface::POSITION => $expectedCarrierLink1->getPosition(), + ], + [ + SourceCarrierLinkInterface::CARRIER_CODE => $expectedCarrierLink2->getCarrierCode(), + SourceCarrierLinkInterface::POSITION => $expectedCarrierLink2->getPosition(), + ] + ] ], ]; $result = $this->_webApiCall($serviceInfo, $requestData); - var_dump($result); + $this->assertNotNull($result['source_id']); + + $createdSource = $this->sourceRepository->get($result['source_id']); + $this->assertEquals($expectedSource->getName(), $createdSource->getName()); + $this->assertEquals($expectedSource->getCity(), $createdSource->getCity()); + $this->assertEquals($expectedSource->getPostcode(), $createdSource->getPostcode()); + $this->assertEquals($expectedSource->getContactName(), $createdSource->getContactName()); + $this->assertEquals($expectedSource->getCountryId(), $createdSource->getCountryId()); + $this->assertEquals($expectedSource->getDescription(), $createdSource->getDescription()); + $this->assertEquals($expectedSource->getEmail(), $createdSource->getEmail()); + $this->assertEquals($expectedSource->getStreet(), $createdSource->getStreet()); + $this->assertEquals($expectedSource->getFax(), $createdSource->getFax()); + $this->assertEquals($expectedSource->getPhone(), $createdSource->getPhone()); + $this->assertEquals($expectedSource->getRegion(), $createdSource->getRegion()); + $this->assertEquals($expectedSource->getRegionId(), $createdSource->getRegionId()); + $this->assertEquals($expectedSource->getLatitude(), $createdSource->getLatitude()); + $this->assertEquals($expectedSource->getLongitude(), $createdSource->getLongitude()); + $this->assertEquals($expectedSource->getIsActive(), $createdSource->getIsActive()); + $this->assertEquals($expectedSource->getPriority(), $createdSource->getPriority()); + + $createdCarrierLinks = $createdSource->getCarrierLinks(); + + $createdCarrierLink1 = $createdCarrierLinks[0]; + $this->assertEquals($expectedCarrierLink1->getCarrierCode(), $createdCarrierLink1->getCarrierCode()); + $this->assertEquals($expectedCarrierLink1->getPosition(), $createdCarrierLink1->getPosition()); + + $createdCarrierLink2 = $createdCarrierLinks[1]; + $this->assertEquals($expectedCarrierLink2->getCarrierCode(), $createdCarrierLink2->getCarrierCode()); + $this->assertEquals($expectedCarrierLink2->getPosition(), $createdCarrierLink2->getPosition()); } /** From 757b40a609430f3aa6a1e15d3a92d749e80dcb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20R=C3=B6ttig?= Date: Sun, 21 May 2017 13:37:49 +0200 Subject: [PATCH 0080/1004] magento-engcom/magento2#3 Add filter and search --- .../Inventory/Model/Source/IsActive.php | 7 ++++ .../ui_component/inventory_source_listing.xml | 39 ++++++++++++------- 2 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 app/code/Magento/Inventory/Model/Source/IsActive.php diff --git a/app/code/Magento/Inventory/Model/Source/IsActive.php b/app/code/Magento/Inventory/Model/Source/IsActive.php new file mode 100644 index 0000000000000..478451af6d7ec --- /dev/null +++ b/app/code/Magento/Inventory/Model/Source/IsActive.php @@ -0,0 +1,7 @@ + + + @@ -64,32 +66,39 @@ - + - false - 55 source_id - 10 - - - textRange - asc - ID - - + + textRange + + asc + + + + + true + text + + + + + + true + text + + - + + - false - 107 source_id - 200 From a437a2049d46b6feb4c10d3c3321957a4a4b2039 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sun, 21 May 2017 15:11:40 +0200 Subject: [PATCH 0081/1004] magento-engcom/magento2#25: WIP api functional tests --- .../Inventory/Model/SourceRepository.php | 1 + .../Magento/Inventory/Setup/InstallSchema.php | 371 +++++++++--------- .../Test/Unit/Model/SourceRepositoryTest.php | 3 +- .../Api/SourceRepositoryInterface.php | 2 +- .../InventoryApi/Api/SourceRepositoryTest.php | 121 +++--- 5 files changed, 253 insertions(+), 245 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index ec9d0133367ed..1f771a66dc661 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -89,6 +89,7 @@ public function save(SourceInterface $source) { try { $this->resource->save($source); + return $source->getSourceId(); } catch (\Exception $exception) { $this->logger->error($exception->getMessage()); throw new CouldNotSaveException(__('Could not save source')); diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index ae8a3c878d28a..9cddd740c29d9 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -25,7 +25,8 @@ class InstallSchema implements InstallSchemaInterface /** * Constant for decimal precision for latitude and longitude */ - const DECIMAL_PLACES = 8; + const LATLON_PRECISION = 10; + const LATLON_SCALE = 6; /** * Option keys for column options @@ -63,157 +64,161 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con InstallSchema::OPTION_IDENTITY => true, InstallSchema::OPTION_UNSIGNED => true, InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true + InstallSchema::OPTION_PRIMARY => true ], 'Source ID' - ) - ->addColumn( - SourceInterface::NAME, - Table::TYPE_TEXT, - 255, [ + )->addColumn( + SourceInterface::NAME, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Source Name' + )->addColumn( + SourceInterface::CONTACT_NAME, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Contact Name' + )->addColumn( + SourceInterface::EMAIL, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Email' + )->addColumn( + SourceInterface::IS_ACTIVE, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_DEFAULT => 1 + ], + 'Defines Is Source Active' + )->addColumn( + SourceInterface::DESCRIPTION, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Description' + )->addColumn( + SourceInterface::LATITUDE, + Table::TYPE_DECIMAL, + null, + [ + InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION, + InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, + InstallSchema::OPTION_NULLABLE => true + ], + 'Latitude' + )->addColumn( + SourceInterface::LONGITUDE, + Table::TYPE_DECIMAL, + null, + [ + InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION, + InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, + InstallSchema::OPTION_NULLABLE => true + ], + 'Longitude' + )->addColumn( + SourceInterface::COUNTRY_ID, + Table::TYPE_TEXT, + 2, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Country Id' + )->addColumn( + SourceInterface::REGION_ID, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => true, + InstallSchema::OPTION_UNSIGNED => true + ], + 'Region Id' + )->addColumn( + SourceInterface::REGION, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Region' + )->addColumn( + SourceInterface::CITY, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'City' + )->addColumn( + SourceInterface::STREET, + Table::TYPE_TEXT, + 255, + [ InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' + InstallSchema::OPTION_DEFAULT => '' ], - 'Source Name' - ) - ->addColumn( - SourceInterface::CONTACT_NAME, - Table::TYPE_TEXT, - 255, [ + 'Street' + )->addColumn( + SourceInterface::POSTCODE, + Table::TYPE_TEXT, + 255, + [ InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' + InstallSchema::OPTION_DEFAULT => '' ], - 'Contact Name' - ) - ->addColumn( - SourceInterface::EMAIL, - Table::TYPE_TEXT, - 255, [ + 'Postcode' + )->addColumn( + SourceInterface::PHONE, + Table::TYPE_TEXT, + 255, + [ InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' + InstallSchema::OPTION_DEFAULT => '' + ], + 'Phone' + )->addColumn( + SourceInterface::FAX, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Fax' + )->addColumn( + SourceInterface::PRIORITY, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => true, + InstallSchema::OPTION_UNSIGNED => true, ], - 'Email' - ) - ->addColumn( - SourceInterface::IS_ACTIVE, - Table::TYPE_SMALLINT, - null, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_DEFAULT => 1 - ], - 'Defines Is Source Active' - ) - ->addColumn( - SourceInterface::DESCRIPTION, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Description' - ) - ->addColumn( - SourceInterface::LATITUDE, - Table::TYPE_DECIMAL, null, - [ - InstallSchema::OPTION_PRECISION => InstallSchema::DECIMAL_PLACES, - InstallSchema::OPTION_SCALE => InstallSchema::DECIMAL_PLACES, - InstallSchema::OPTION_NULLABLE => true - ], 'Latitude' - ) - ->addColumn( - SourceInterface::LONGITUDE, - Table::TYPE_DECIMAL, null, - [ - InstallSchema::OPTION_PRECISION => InstallSchema::DECIMAL_PLACES, - InstallSchema::OPTION_SCALE => InstallSchema::DECIMAL_PLACES, - InstallSchema::OPTION_NULLABLE => true - ], 'Longitude' - ) - ->addColumn( - SourceInterface::COUNTRY_ID, - Table::TYPE_SMALLINT, - null, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true - ], 'Country Id' - )->addColumn( - SourceInterface::REGION_ID, - Table::TYPE_SMALLINT, - null, - [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true - ], 'Region Id' - )->addColumn( - SourceInterface::REGION, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], 'Region' - ) - ->addColumn( - SourceInterface::CITY, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], 'City' - ) - ->addColumn( - SourceInterface::STREET, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], 'Street' - ) - ->addColumn( - SourceInterface::POSTCODE, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], 'Postcode' - ) - ->addColumn( - SourceInterface::PHONE, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], 'Phone' - ) - ->addColumn( - SourceInterface::FAX, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], 'Fax' - ) - ->addColumn( - SourceInterface::PRIORITY, - Table::TYPE_SMALLINT, - null, - [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true, - ], 'Priority' - ); - $table->setComment('Inventory Source Entity Table')->setOption('type', 'InnoDB')->setOption('charset', - 'utf8'); + 'Priority' + ); + + $table->setComment('Inventory Source Entity Table') + ->setOption('type', 'InnoDB') + ->setOption('charset', 'utf8'); $installer->getConnection()->createTable($table); } @@ -222,42 +227,41 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $table = $installer->getConnection()->newTable($tableNameCarrierLinkEntity); $table->addColumn( - 'source_carrier_link_id', - Table::TYPE_INTEGER, - null, - [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true - ], - 'Source Carrier Link ID' - ) - ->addColumn( - SourceInterface::SOURCE_ID, - Table::TYPE_INTEGER, null, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - ], 'Source ID' - ) - ->addColumn( - SourceCarrierLinkInterface::CARRIER_CODE, - Table::TYPE_TEXT, 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], 'Carrier Code' - ) - ->addColumn( - 'position', Table::TYPE_SMALLINT, - null, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - ], - 'Position' - ); + 'source_carrier_link_id', + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_PRIMARY => true + ], + 'Source Carrier Link ID' + )->addColumn( + SourceInterface::SOURCE_ID, + Table::TYPE_INTEGER, null, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + ], + 'Source ID' + )->addColumn( + SourceCarrierLinkInterface::CARRIER_CODE, + Table::TYPE_TEXT, 255, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_DEFAULT => '' + ], + 'Carrier Code' + )->addColumn( + 'position', Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + ], + 'Position' + ); // Add foreign key for Pipeline ID field $foreignKeyName = $installer->getConnection()->getForeignKeyName( @@ -274,10 +278,9 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con Table::ACTION_CASCADE ); - $table->setComment('Inventory Source Carrier Link Entity Table')->setOption('type', 'InnoDB')->setOption( - 'charset', - 'utf8' - ); + $table->setComment('Inventory Source Carrier Link Entity Table') + ->setOption('type', 'InnoDB') + ->setOption('charset', 'utf8'); $installer->getConnection()->createTable($table); } $setup->endSetup(); diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 0caa923e7b885..d3bfae4e7c929 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -106,8 +106,7 @@ public function testSaveSuccessful() ); $result = $this->sourceRepository->save($sourceModel); - - $this->assertSame($sourceModel, $result); + $this->assertNotNull($result); } public function testSaveErrorExpectsException() diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index a1307fed80dc9..29df169d2cc21 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -19,7 +19,7 @@ interface SourceRepositoryInterface * Save Source data. * * @param \Magento\InventoryApi\Api\Data\SourceInterface $source - * @return void + * @return int * * @throws CouldNotSaveException */ diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index 8a4f3a46b5824..b9e43f36baa28 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -6,6 +6,8 @@ namespace Magento\InventoryApi\Api; use Magento\Directory\Api\CountryInformationAcquirerInterface; +use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Framework\Api\SortOrderBuilder; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterfaceFactory; use Magento\InventoryApi\Api\Data\SourceInterface; @@ -39,6 +41,16 @@ class SourceRepositoryTest extends WebapiAbstract */ private $sourceRepository; + /** + * @var SearchCriteriaBuilder + */ + private $searchCriteriaBuilder; + + /** + * @var SortOrderBuilder + */ + private $sortOrderBuilder; + /** * Execute per test initialization. */ @@ -55,6 +67,12 @@ public function setUp() $this->sourceRepository = Bootstrap::getObjectManager() ->create(SourceRepositoryInterface::class); + + $this->searchCriteriaBuilder = Bootstrap::getObjectManager() + ->create(SearchCriteriaBuilder::class); + + $this->sortOrderBuilder = Bootstrap::getObjectManager() + ->create(SortOrderBuilder::class); } /** @@ -70,7 +88,7 @@ public function testCreateSource() $description = 'Some description for source'; $city = 'Exampletown'; $street = 'Some Street 455'; - $postcode = 54321; + $postcode = '54321'; $contactName = 'Contact Name'; $email = 'example.guy@test.com'; $fax = '0120002020033'; @@ -129,66 +147,53 @@ public function testCreateSource() ]; $requestData = [ - 'source' => [ - SourceInterface::NAME => $expectedSource->getName(), - SourceInterface::CITY => $expectedSource->getCity(), - SourceInterface::POSTCODE => $expectedSource->getPostcode(), - SourceInterface::CONTACT_NAME => $expectedSource->getContactName(), - SourceInterface::COUNTRY_ID => $expectedSource->getCountryId(), - SourceInterface::DESCRIPTION => $expectedSource->getDescription(), - SourceInterface::EMAIL => $expectedSource->getEmail(), - SourceInterface::STREET => $expectedSource->getStreet(), - SourceInterface::FAX => $expectedSource->getFax(), - SourceInterface::PHONE => $expectedSource->getPhone(), - SourceInterface::REGION => $expectedSource->getRegion(), - SourceInterface::REGION_ID => $expectedSource->getRegionId(), - SourceInterface::LATITUDE => $expectedSource->getLatitude(), - SourceInterface::LONGITUDE => $expectedSource->getLongitude(), - SourceInterface::IS_ACTIVE => $expectedSource->getIsActive(), - SourceInterface::PRIORITY => $expectedSource->getPriority(), - SourceInterface::CARRIER_LINKS => [ - [ - SourceCarrierLinkInterface::CARRIER_CODE => $expectedCarrierLink1->getCarrierCode(), - SourceCarrierLinkInterface::POSITION => $expectedCarrierLink1->getPosition(), - ], - [ - SourceCarrierLinkInterface::CARRIER_CODE => $expectedCarrierLink2->getCarrierCode(), - SourceCarrierLinkInterface::POSITION => $expectedCarrierLink2->getPosition(), - ] - ] - ], + 'source' => $this->formSourceToArray($expectedSource) ]; $result = $this->_webApiCall($serviceInfo, $requestData); - $this->assertNotNull($result['source_id']); - - $createdSource = $this->sourceRepository->get($result['source_id']); - $this->assertEquals($expectedSource->getName(), $createdSource->getName()); - $this->assertEquals($expectedSource->getCity(), $createdSource->getCity()); - $this->assertEquals($expectedSource->getPostcode(), $createdSource->getPostcode()); - $this->assertEquals($expectedSource->getContactName(), $createdSource->getContactName()); - $this->assertEquals($expectedSource->getCountryId(), $createdSource->getCountryId()); - $this->assertEquals($expectedSource->getDescription(), $createdSource->getDescription()); - $this->assertEquals($expectedSource->getEmail(), $createdSource->getEmail()); - $this->assertEquals($expectedSource->getStreet(), $createdSource->getStreet()); - $this->assertEquals($expectedSource->getFax(), $createdSource->getFax()); - $this->assertEquals($expectedSource->getPhone(), $createdSource->getPhone()); - $this->assertEquals($expectedSource->getRegion(), $createdSource->getRegion()); - $this->assertEquals($expectedSource->getRegionId(), $createdSource->getRegionId()); - $this->assertEquals($expectedSource->getLatitude(), $createdSource->getLatitude()); - $this->assertEquals($expectedSource->getLongitude(), $createdSource->getLongitude()); - $this->assertEquals($expectedSource->getIsActive(), $createdSource->getIsActive()); - $this->assertEquals($expectedSource->getPriority(), $createdSource->getPriority()); - - $createdCarrierLinks = $createdSource->getCarrierLinks(); - - $createdCarrierLink1 = $createdCarrierLinks[0]; - $this->assertEquals($expectedCarrierLink1->getCarrierCode(), $createdCarrierLink1->getCarrierCode()); - $this->assertEquals($expectedCarrierLink1->getPosition(), $createdCarrierLink1->getPosition()); - - $createdCarrierLink2 = $createdCarrierLinks[1]; - $this->assertEquals($expectedCarrierLink2->getCarrierCode(), $createdCarrierLink2->getCarrierCode()); - $this->assertEquals($expectedCarrierLink2->getPosition(), $createdCarrierLink2->getPosition()); + $this->assertNotNull($result); + + $createdSource = $this->sourceRepository->get($result); + $this->assertSame($this->formSourceToArray($expectedSource), $this->formSourceToArray($createdSource)); + } + + /** + * @param SourceInterface $source + * @return array + */ + private function formSourceToArray(SourceInterface $source) + { + $result = [ + SourceInterface::NAME => $source->getName(), + SourceInterface::CITY => $source->getCity(), + SourceInterface::POSTCODE => $source->getPostcode(), + SourceInterface::CONTACT_NAME => $source->getContactName(), + SourceInterface::COUNTRY_ID => $source->getCountryId(), + SourceInterface::DESCRIPTION => $source->getDescription(), + SourceInterface::EMAIL => $source->getEmail(), + SourceInterface::STREET => $source->getStreet(), + SourceInterface::FAX => $source->getFax(), + SourceInterface::PHONE => $source->getPhone(), + SourceInterface::REGION => $source->getRegion(), + SourceInterface::REGION_ID => $source->getRegionId(), + SourceInterface::LATITUDE => $source->getLatitude(), + SourceInterface::LONGITUDE => $source->getLongitude(), + SourceInterface::IS_ACTIVE => $source->getIsActive(), + SourceInterface::PRIORITY => $source->getPriority(), + SourceInterface::CARRIER_LINKS => [] + ]; + + $carrierLinks = $source->getCarrierLinks(); + if ($carrierLinks) { + foreach ($carrierLinks as $carrierLink) { + $result[SourceInterface::CARRIER_LINKS][] = [ + SourceCarrierLinkInterface::CARRIER_CODE => $carrierLink->getCarrierCode(), + SourceCarrierLinkInterface::POSITION => $carrierLink->getPosition(), + ]; + } + } + + return $result; } /** From 42e3cce6b36866263f499c3cee32d3f976558de6 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Wed, 24 May 2017 11:47:03 +0200 Subject: [PATCH 0082/1004] magento-engcom/magento2#25: Source API Implementation - Fixes according to test results --- .../Inventory/Model/SourceRepository.php | 11 +++++--- .../Test/Unit/Model/SourceRepositoryTest.php | 26 ++++++++++++------- .../Api/SourceRepositoryInterface.php | 26 ++++++++----------- 3 files changed, 34 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 27bef7ff55840..1a66b8965f67c 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -12,13 +12,14 @@ use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Model\AbstractModel; use Magento\InventoryApi\Api\Data\SourceInterface; +use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; use Magento\InventoryApi\Api\SourceRepositoryInterface; use Magento\Inventory\Model\SourceSearchResultsFactory; use Magento\Inventory\Model\Resource\Source as ResourceSource; use Magento\Inventory\Model\Resource\Source\CollectionFactory; use Magento\Inventory\Model\SourceFactoryInterface; -use \Psr\Log\LoggerInterface; +use Psr\Log\LoggerInterface; /** * Class SourceRepository @@ -34,7 +35,7 @@ class SourceRepository implements SourceRepositoryInterface private $resource; /** - * @var SourceFactoryInterface + * @var SourceInterfaceFactory */ private $sourceFactory; @@ -61,7 +62,7 @@ class SourceRepository implements SourceRepositoryInterface /** * SourceRepository constructor. * @param ResourceSource $resource - * @param SourceFactoryInterface $sourceFactory + * @param SourceInterfaceFactory $sourceFactory * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $collectionFactory * @param SourceSearchResultsFactory $sourceSearchResultsFactory @@ -69,7 +70,7 @@ class SourceRepository implements SourceRepositoryInterface */ public function __construct( ResourceSource $resource, - SourceFactoryInterface $sourceFactory, + SourceInterfaceFactory $sourceFactory, CollectionProcessorInterface $collectionProcessor, CollectionFactory $collectionFactory, SourceSearchResultsFactory $sourceSearchResultsFactory, @@ -94,6 +95,8 @@ public function save(SourceInterface $source) $this->logger->error($exception->getMessage()); throw new CouldNotSaveException(__('Could not save source')); } + + return $source; } /** diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 0caa923e7b885..10a0e967ce52b 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -38,6 +38,11 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase */ private $sourceSearchResultsFactory; + /** + * @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $loggerMock; + /** * @var \Magento\Inventory\Model\SourceRepository|\PHPUnit_Framework_MockObject_MockObject */ @@ -54,7 +59,7 @@ protected function setUp() ); $this->sourceFactory = $this->getMock( - \Magento\Inventory\Model\SourceFactory::class, + \Magento\InventoryApi\Api\Data\SourceInterfaceFactory::class, ['create'], [], '', @@ -81,6 +86,10 @@ protected function setUp() false ); + $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->sourceRepository = $objectManager->getObject( \Magento\Inventory\Model\SourceRepository::class, @@ -90,6 +99,7 @@ protected function setUp() 'collectionProcessor' => $this->collectionProcessor, 'collectionFactory' => $this->collectionFactory, 'sourceSearchResultsFactory' => $this->sourceSearchResultsFactory, + 'logger' => $this->loggerMock, ] ); } @@ -97,17 +107,13 @@ protected function setUp() public function testSaveSuccessful() { /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMock( - \Magento\Inventory\Model\Source::class, - [], - [], - '', - false - ); + $sourceModelMock = $this->getMockBuilder(\Magento\Inventory\Model\Source::class) + ->disableOriginalConstructor() + ->getMock(); - $result = $this->sourceRepository->save($sourceModel); + $result = $this->sourceRepository->save($sourceModelMock); - $this->assertSame($sourceModel, $result); + $this->assertSame($sourceModelMock, $result); } public function testSaveErrorExpectsException() diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index ffd97d5837a1f..3bc8947a4cec0 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -5,12 +5,6 @@ */ namespace Magento\InventoryApi\Api; -use Magento\Framework\Api\SearchCriteriaInterface; -use Magento\Framework\Exception\CouldNotSaveException; -use Magento\Framework\Exception\NoSuchEntityException; -use Magento\InventoryApi\Api\Data\SourceInterface; -use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; - /** * @api */ @@ -19,27 +13,29 @@ interface SourceRepositoryInterface /** * Save Source data. * - * @param SourceInterface $source - * @return void + * @param \Magento\InventoryApi\Api\Data\SourceInterface $source + * @return int * - * @throws CouldNotSaveException + * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function save(SourceInterface $source); + public function save(\Magento\InventoryApi\Api\Data\SourceInterface $source); /** * Load Source data by given sourceId. * * @param int $sourceId - * @return SourceInterface - * @throws NoSuchEntityException + * @return \Magento\InventoryApi\Api\Data\SourceInterface + * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function get($sourceId); /** * Load Source data collection by given search criteria * - * @param SearchCriteriaInterface $searchCriteria - * @return SourceSearchResultsInterface + * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria + * @return \Magento\InventoryApi\Api\Data\SourceSearchResultsInterface */ - public function getList(SearchCriteriaInterface $searchCriteria = null); + public function getList( + \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null + ); } From c12bdeacd36440ef1a3e0de302e01233ba3bd62d Mon Sep 17 00:00:00 2001 From: Evgeni Obukhovsky Date: Wed, 24 May 2017 23:00:11 +0300 Subject: [PATCH 0083/1004] make sales emails' transport variable changeable from observer --- .../Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php | 3 ++- .../Sales/Model/Order/Email/Sender/CreditmemoSender.php | 3 ++- .../Sales/Model/Order/Email/Sender/InvoiceCommentSender.php | 3 ++- .../Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php | 3 ++- .../Sales/Model/Order/Email/Sender/OrderCommentSender.php | 3 ++- .../Sales/Model/Order/Email/Sender/ShipmentCommentSender.php | 3 ++- .../Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php | 3 ++- .../Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php | 3 ++- .../Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php | 3 ++- 9 files changed, 18 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php index 510bc54dc05b3..85a607b1b2aa6 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php @@ -71,13 +71,14 @@ public function send(Creditmemo $creditmemo, $notify = true, $comment = '') 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManager->dispatch( 'email_creditmemo_comment_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); return $this->checkAndSend($order, $notify); } diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php index a4ecd2aa7d000..b0fb8958515c9 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php @@ -113,13 +113,14 @@ public function send(Creditmemo $creditmemo, $forceSyncMode = false) 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManager->dispatch( 'email_creditmemo_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); if ($this->checkAndSend($order)) { $creditmemo->setEmailSent(true); diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php index 8f6401ff1cb88..76b572705c14f 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php @@ -71,13 +71,14 @@ public function send(Invoice $invoice, $notify = true, $comment = '') 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManager->dispatch( 'email_invoice_comment_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); return $this->checkAndSend($order, $notify); } diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php index c3083ddae2dd8..c9037beed0a01 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php @@ -113,13 +113,14 @@ public function send(Invoice $invoice, $forceSyncMode = false) 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order) ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManager->dispatch( 'email_invoice_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); if ($this->checkAndSend($order)) { $invoice->setEmailSent(true); diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php index c8c1eb10d4864..586bfc49bfc37 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php @@ -68,13 +68,14 @@ public function send(Order $order, $notify = true, $comment = '') 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManager->dispatch( 'email_order_comment_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); return $this->checkAndSend($order, $notify); } diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php index 80c2ed356061b..1dcb40deac1ee 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php @@ -71,13 +71,14 @@ public function send(Shipment $shipment, $notify = true, $comment = '') 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManager->dispatch( 'email_shipment_comment_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); return $this->checkAndSend($order, $notify); } diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php index ff2311067ba0a..e42dee71377c1 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php @@ -113,13 +113,14 @@ public function send(Shipment $shipment, $forceSyncMode = false) 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order) ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManager->dispatch( 'email_shipment_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); if ($this->checkAndSend($order)) { $shipment->setEmailSent(true); diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php b/app/code/Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php index 5daab1f4d9bd3..1924549280191 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php @@ -106,13 +106,14 @@ public function send( 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManager->dispatch( 'email_invoice_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); if ($this->checkAndSend($order)) { $invoice->setEmailSent(true); diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php b/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php index 7c17a2d2d2f64..31a6c289f0836 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php @@ -106,13 +106,14 @@ public function send( 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order) ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManager->dispatch( 'email_shipment_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); if ($this->checkAndSend($order)) { $shipment->setEmailSent(true); From a42284b41b3aba89df042fa60c7043aaf0821056 Mon Sep 17 00:00:00 2001 From: Evgeni Obukhovsky Date: Wed, 24 May 2017 23:06:24 +0300 Subject: [PATCH 0084/1004] add magento\data\object to use; section --- .../Sales/Model/Order/Creditmemo/Sender/EmailSender.php | 4 +++- .../Model/Order/Email/Sender/CreditmemoCommentSender.php | 3 ++- .../Sales/Model/Order/Email/Sender/CreditmemoSender.php | 3 ++- .../Sales/Model/Order/Email/Sender/InvoiceCommentSender.php | 3 ++- .../Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php | 3 ++- .../Sales/Model/Order/Email/Sender/OrderCommentSender.php | 3 ++- .../Magento/Sales/Model/Order/Email/Sender/OrderSender.php | 3 ++- .../Sales/Model/Order/Email/Sender/ShipmentCommentSender.php | 3 ++- .../Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php | 3 ++- .../Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php | 3 ++- .../Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php | 3 ++- 11 files changed, 23 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php index 435b3aee4d6d7..4428ee9301e9d 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Sender/EmailSender.php @@ -7,6 +7,7 @@ use Magento\Sales\Model\Order\Email\Sender; use Magento\Sales\Model\Order\Creditmemo\SenderInterface; +use Magento\Framework\DataObject; /** * Email notification sender for Creditmemo. @@ -106,13 +107,14 @@ public function send( 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_creditmemo_set_template_vars_before', ['sender' => $this, 'transport' => $transport] ); - $this->templateContainer->setTemplateVars($transport); + $this->templateContainer->setTemplateVars($transport->getData()); if ($this->checkAndSend($order)) { $creditmemo->setEmailSent(true); diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php index 85a607b1b2aa6..7d29fcc56aa01 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoCommentSender.php @@ -12,6 +12,7 @@ use Magento\Sales\Model\Order\Email\NotifySender; use Magento\Sales\Model\Order\Address\Renderer; use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\DataObject; /** * Class CreditmemoCommentSender @@ -71,7 +72,7 @@ public function send(Creditmemo $creditmemo, $notify = true, $comment = '') 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_creditmemo_comment_set_template_vars_before', diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php index b0fb8958515c9..f31a7e3197537 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/CreditmemoSender.php @@ -14,6 +14,7 @@ use Magento\Sales\Model\ResourceModel\Order\Creditmemo as CreditmemoResource; use Magento\Sales\Model\Order\Address\Renderer; use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\DataObject; /** * Class CreditmemoSender @@ -113,7 +114,7 @@ public function send(Creditmemo $creditmemo, $forceSyncMode = false) 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_creditmemo_set_template_vars_before', diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php index 76b572705c14f..202766ae38653 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceCommentSender.php @@ -12,6 +12,7 @@ use Magento\Sales\Model\Order\Invoice; use Magento\Sales\Model\Order\Address\Renderer; use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\DataObject; /** * Class InvoiceCommentSender @@ -71,7 +72,7 @@ public function send(Invoice $invoice, $notify = true, $comment = '') 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_invoice_comment_set_template_vars_before', diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php index c9037beed0a01..d51d2c6f3f32a 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/InvoiceSender.php @@ -14,6 +14,7 @@ use Magento\Sales\Model\ResourceModel\Order\Invoice as InvoiceResource; use Magento\Sales\Model\Order\Address\Renderer; use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\DataObject; /** * Class InvoiceSender @@ -113,7 +114,7 @@ public function send(Invoice $invoice, $forceSyncMode = false) 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order) ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_invoice_set_template_vars_before', diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php index 586bfc49bfc37..f72ac3940a7c2 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderCommentSender.php @@ -11,6 +11,7 @@ use Magento\Sales\Model\Order\Email\NotifySender; use Magento\Sales\Model\Order\Address\Renderer; use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\DataObject; /** * Class OrderCommentSender @@ -68,7 +69,7 @@ public function send(Order $order, $notify = true, $comment = '') 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_order_comment_set_template_vars_before', diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php index e98f400973c6d..2944b8ccef647 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php @@ -13,6 +13,7 @@ use Magento\Sales\Model\ResourceModel\Order as OrderResource; use Magento\Sales\Model\Order\Address\Renderer; use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\DataObject; /** * Class OrderSender @@ -130,7 +131,7 @@ protected function prepareTemplate(Order $order) 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_order_set_template_vars_before', diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php index 1dcb40deac1ee..1353ea6b22dd2 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentCommentSender.php @@ -12,6 +12,7 @@ use Magento\Sales\Model\Order\Shipment; use Magento\Sales\Model\Order\Address\Renderer; use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\DataObject; /** * Class ShipmentCommentSender @@ -71,7 +72,7 @@ public function send(Shipment $shipment, $notify = true, $comment = '') 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_shipment_comment_set_template_vars_before', diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php index e42dee71377c1..faad7255e6475 100644 --- a/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php +++ b/app/code/Magento/Sales/Model/Order/Email/Sender/ShipmentSender.php @@ -14,6 +14,7 @@ use Magento\Sales\Model\ResourceModel\Order\Shipment as ShipmentResource; use Magento\Sales\Model\Order\Address\Renderer; use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\DataObject; /** * Class ShipmentSender @@ -113,7 +114,7 @@ public function send(Shipment $shipment, $forceSyncMode = false) 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order) ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_shipment_set_template_vars_before', diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php b/app/code/Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php index 1924549280191..5d156722d54b6 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Sender/EmailSender.php @@ -7,6 +7,7 @@ use Magento\Sales\Model\Order\Email\Sender; use Magento\Sales\Model\Order\Invoice\SenderInterface; +use Magento\Framework\DataObject; /** * Email notification sender for Invoice. @@ -106,7 +107,7 @@ public function send( 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_invoice_set_template_vars_before', diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php b/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php index 31a6c289f0836..34c67f9533ed8 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Sender/EmailSender.php @@ -7,6 +7,7 @@ use Magento\Sales\Model\Order\Email\Sender; use Magento\Sales\Model\Order\Shipment\SenderInterface; +use Magento\Framework\DataObject; /** * Email notification sender for Shipment. @@ -106,7 +107,7 @@ public function send( 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order) ]; - $transport = new \Magento\Framework\DataObject($transport); + $transport = new DataObject($transport); $this->eventManager->dispatch( 'email_shipment_set_template_vars_before', From c32d10c15380e89d1e86e0e4752cbcf3f742666b Mon Sep 17 00:00:00 2001 From: Evgeni Obukhovsky Date: Thu, 25 May 2017 00:30:11 +0300 Subject: [PATCH 0085/1004] update unit tests --- .../Unit/Model/Order/Creditmemo/Sender/EmailSenderTest.php | 3 ++- .../Test/Unit/Model/Order/Invoice/Sender/EmailSenderTest.php | 3 ++- .../Test/Unit/Model/Order/Shipment/Sender/EmailSenderTest.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Sender/EmailSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Sender/EmailSenderTest.php index 5b79cd26d56d7..2a8731ebf25a3 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Sender/EmailSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Creditmemo/Sender/EmailSenderTest.php @@ -262,6 +262,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending 'formattedShippingAddress' => 'Formatted address', 'formattedBillingAddress' => 'Formatted address', ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManagerMock->expects($this->once()) ->method('dispatch') @@ -275,7 +276,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending $this->templateContainerMock->expects($this->once()) ->method('setTemplateVars') - ->with($transport); + ->with($transport->getData()); $this->identityContainerMock->expects($this->once()) ->method('isEnabled') diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Sender/EmailSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Sender/EmailSenderTest.php index dcdd04dcc5531..b1cc20ff6ea00 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Sender/EmailSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Sender/EmailSenderTest.php @@ -260,6 +260,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending 'formattedShippingAddress' => 'Formatted address', 'formattedBillingAddress' => 'Formatted address', ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManagerMock->expects($this->once()) ->method('dispatch') @@ -273,7 +274,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending $this->templateContainerMock->expects($this->once()) ->method('setTemplateVars') - ->with($transport); + ->with($transport->getData()); $this->identityContainerMock->expects($this->once()) ->method('isEnabled') diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Sender/EmailSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Sender/EmailSenderTest.php index 8226920157420..3060b950ce888 100644 --- a/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Sender/EmailSenderTest.php +++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Shipment/Sender/EmailSenderTest.php @@ -262,6 +262,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending 'formattedShippingAddress' => 'Formatted address', 'formattedBillingAddress' => 'Formatted address', ]; + $transport = new \Magento\Framework\DataObject($transport); $this->eventManagerMock->expects($this->once()) ->method('dispatch') @@ -275,7 +276,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending $this->templateContainerMock->expects($this->once()) ->method('setTemplateVars') - ->with($transport); + ->with($transport->getData()); $this->identityContainerMock->expects($this->once()) ->method('isEnabled') From 9479ee9ef3da414aff914c64be4cac5bf2f1c445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20R=C3=B6ttig?= Date: Sat, 27 May 2017 17:47:30 +0200 Subject: [PATCH 0086/1004] magento-engcom/magento2#3 WIP: Add Edit Form --- .../Adminhtml/Edit/Button/AbstractButton.php | 76 ++++++++++++++++ .../Block/Adminhtml/Edit/Button/Back.php | 27 ++++++ .../Block/Adminhtml/Edit/Button/Delete.php | 42 +++++++++ .../Block/Adminhtml/Edit/Button/Save.php | 30 +++++++ .../Adminhtml/Sources/NewAction.php | 41 +++++++++ .../Controller/Adminhtml/Sources/Save.php | 40 +++++++++ .../Magento/Inventory/Setup/InstallSchema.php | 4 +- .../Component/Form/DataProviders/Source.php | 27 ++++++ .../Inventory/etc/adminhtml/routes.xml | 2 +- .../layout/inventory_sources_edit.xml | 6 +- .../layout/inventory_sources_new.xml | 12 +++ .../ui_component/inventory_source_form.xml | 90 +++++++++++++++++++ .../ui_component/inventory_source_listing.xml | 79 ++++++++++++---- 13 files changed, 455 insertions(+), 21 deletions(-) create mode 100644 app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/AbstractButton.php create mode 100644 app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php create mode 100644 app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php create mode 100644 app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Sources/NewAction.php create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Sources/Save.php create mode 100644 app/code/Magento/Inventory/Ui/Component/Form/DataProviders/Source.php create mode 100644 app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_new.xml create mode 100644 app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/AbstractButton.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/AbstractButton.php new file mode 100644 index 0000000000000..a84abb8fef602 --- /dev/null +++ b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/AbstractButton.php @@ -0,0 +1,76 @@ +context = $context; + $this->sourceRepository = $sourceRepository; + } + + /** + * + * @return bool + */ + protected function isEditMode() + { + return (bool)$this->getSourceId(); + } + + /** + * Returns the Source Id. + * + * @return null | int + */ + protected function getSourceId() + { + try { + $sourceId = $this->context->getRequest()->getParam('id'); + return $this->sourceRepository->getById($sourceId)->getId(); + } catch (NoSuchEntityException $exception) { + } + return null; + } + + /** + * Generate url by route and parameters + * + * @param string $route + * @param array $params + * @return string + */ + public function getUrl($route = '', $params = []) + { + return $this->context->getUrlBuilder()->getUrl($route, $params); + } +} diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php new file mode 100644 index 0000000000000..e357265402adf --- /dev/null +++ b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php @@ -0,0 +1,27 @@ + __('Back'), + 'on_click' => sprintf("location.href = '%s';", $this->getUrl('*/*/')), + 'class' => 'back', + 'sort_order' => 10 + ]; + } +} diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php new file mode 100644 index 0000000000000..c29b343799db5 --- /dev/null +++ b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php @@ -0,0 +1,42 @@ +isEditMode()) { + $data = [ + 'label' => __('Delete Entry'), + 'class' => 'delete', + 'on_click' => 'deleteConfirm(\'' . __( + 'Are you sure you want to do this?' + ) . '\', \'' . $this->getDeleteUrl() . '\')', + 'sort_order' => 20, + ]; + } + return $data; + } + + /** + * @return string + */ + private function getDeleteUrl() + { + return $this->getUrl('*/*/delete', ['id' => $this->getRateId()]); + } +} diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php new file mode 100644 index 0000000000000..98d320f2f268a --- /dev/null +++ b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php @@ -0,0 +1,30 @@ + __('Save Entry'), + 'class' => 'save primary', + 'data_attribute' => [ + 'mage-init' => ['button' => ['event' => 'save']], + 'form-role' => 'save', + ], + 'sort_order' => 90, + ]; + } +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/NewAction.php b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/NewAction.php new file mode 100644 index 0000000000000..8b8d423b53cf7 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/NewAction.php @@ -0,0 +1,41 @@ +resultForwardFactory = $resultForwardFactory; + parent::__construct($context, $coreRegistry); + } + + /** + * Create new CMS block + * + * @return \Magento\Framework\Controller\ResultInterface + */ + public function execute() + { + /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ + $resultForward = $this->resultForwardFactory->create(); + return $resultForward->forward('edit'); + } +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Save.php new file mode 100644 index 0000000000000..4d22db6c27043 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Save.php @@ -0,0 +1,40 @@ +resultPageFactory = $resultPageFactory; + parent::__construct($context); + } + + /** + * @return \Magento\Framework\View\Result\Page + */ + public function execute() + { + + } +} diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index ae8a3c878d28a..09b2a36dac726 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -6,8 +6,8 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; -use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; +use Magento\InventoryApi\Api\Data\SourceInterface; class InstallSchema implements InstallSchemaInterface { @@ -212,6 +212,8 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con InstallSchema::OPTION_UNSIGNED => true, ], 'Priority' ); + + $table->setComment('Inventory Source Entity Table')->setOption('type', 'InnoDB')->setOption('charset', 'utf8'); $installer->getConnection()->createTable($table); diff --git a/app/code/Magento/Inventory/Ui/Component/Form/DataProviders/Source.php b/app/code/Magento/Inventory/Ui/Component/Form/DataProviders/Source.php new file mode 100644 index 0000000000000..76c89b9408e44 --- /dev/null +++ b/app/code/Magento/Inventory/Ui/Component/Form/DataProviders/Source.php @@ -0,0 +1,27 @@ +collection = $collectionFactory->create(); + } + + /** + * Get data + * + * @return array + */ + public function getData() + { + return []; + } +} diff --git a/app/code/Magento/Inventory/etc/adminhtml/routes.xml b/app/code/Magento/Inventory/etc/adminhtml/routes.xml index b3c812662a0d7..a6d6727d5d568 100644 --- a/app/code/Magento/Inventory/etc/adminhtml/routes.xml +++ b/app/code/Magento/Inventory/etc/adminhtml/routes.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml index 4f7d677aaee92..5da8a215da176 100644 --- a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml @@ -7,8 +7,10 @@ --> - + - + + + diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_new.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_new.xml new file mode 100644 index 0000000000000..139a4b22b9e67 --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_new.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml new file mode 100644 index 0000000000000..2a0eb58f66d4b --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -0,0 +1,90 @@ + + +
+ + + inventory_source_form.inventory_source_form_data_source + + General Information + templates/form/collapsible + + + +
From bd9868013ff27011f1a3b73c7b4ef5ca3f38fe04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20R=C3=B6ttig?= Date: Sat, 27 May 2017 18:02:15 +0200 Subject: [PATCH 0087/1004] magento-engcom/magento2#3 remove usless class --- app/code/Magento/Inventory/Model/Source/IsActive.php | 7 ------- .../view/adminhtml/ui_component/inventory_source_form.xml | 1 - 2 files changed, 8 deletions(-) delete mode 100644 app/code/Magento/Inventory/Model/Source/IsActive.php diff --git a/app/code/Magento/Inventory/Model/Source/IsActive.php b/app/code/Magento/Inventory/Model/Source/IsActive.php deleted file mode 100644 index 478451af6d7ec..0000000000000 --- a/app/code/Magento/Inventory/Model/Source/IsActive.php +++ /dev/null @@ -1,7 +0,0 @@ - - From 1e9da30b972f458975a96c19de3ace23168cc8d5 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sun, 28 May 2017 15:32:53 +0200 Subject: [PATCH 0088/1004] magento-engcom/magento2#25: WIP api-functional tests --- .../Api/Data/SourceCarrierLinkInterface.php | 1 + .../InventoryApi/Api/SourceRepositoryTest.php | 28 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index ad84cda34323c..99b91f37a2046 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -14,6 +14,7 @@ interface SourceCarrierLinkInterface extends ExtensibleDataInterface */ const CARRIER_CODE = 'carrier_code'; const POSITION = 'position'; + const EXTENSION_ATTRIBUTES = 'extension_attributes'; /**#@-*/ /** diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index b9e43f36baa28..f62295bd4cf2a 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -147,21 +147,42 @@ public function testCreateSource() ]; $requestData = [ - 'source' => $this->formSourceToArray($expectedSource) + 'source' => $this->getSourceDataArray($expectedSource) ]; $result = $this->_webApiCall($serviceInfo, $requestData); $this->assertNotNull($result); $createdSource = $this->sourceRepository->get($result); - $this->assertSame($this->formSourceToArray($expectedSource), $this->formSourceToArray($createdSource)); + $this->assertSame( + $this->getExpectedValues($this->getSourceDataArray($expectedSource)), + $this->getSourceDataArray($createdSource) + ); + } + + /** + * @param array $sourceData + * @return array + */ + private function getExpectedValues(array $sourceData) + { + $sourceData[SourceInterface::LATITUDE] = number_format( + $sourceData[SourceInterface::LATITUDE], + 6 + ); + $sourceData[SourceInterface::LONGITUDE] = number_format( + $sourceData[SourceInterface::LONGITUDE], + 6 + ); + + return $sourceData; } /** * @param SourceInterface $source * @return array */ - private function formSourceToArray(SourceInterface $source) + private function getSourceDataArray(SourceInterface $source) { $result = [ SourceInterface::NAME => $source->getName(), @@ -189,6 +210,7 @@ private function formSourceToArray(SourceInterface $source) $result[SourceInterface::CARRIER_LINKS][] = [ SourceCarrierLinkInterface::CARRIER_CODE => $carrierLink->getCarrierCode(), SourceCarrierLinkInterface::POSITION => $carrierLink->getPosition(), + SourceCarrierLinkInterface::EXTENSION_ATTRIBUTES => [], ]; } } From 3712ecf0cf8eb8098806cf0ea14cf5cb5f51fc53 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sun, 28 May 2017 19:15:16 +0200 Subject: [PATCH 0089/1004] magento-engcom/magento2#25: Finish first api-functional test --- .../Inventory/Model/SourceRepository.php | 81 +++++++++++++++++-- .../Api/Data/SourceCarrierLinkInterface.php | 5 +- .../InventoryApi/Api/SourceRepositoryTest.php | 3 +- 3 files changed, 79 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 9beb1574ad411..0120daf1baafa 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -6,18 +6,22 @@ namespace Magento\Inventory\Model; +use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Model\AbstractModel; +use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterfaceFactory; use Magento\InventoryApi\Api\SourceRepositoryInterface; use Magento\Inventory\Model\Resource\Source as ResourceSource; +use Magento\Inventory\Model\Resource\SourceCarrierLink as ResourceSourceCarrierLink; use Magento\Inventory\Model\Resource\Source\CollectionFactory; +use Magento\Inventory\Model\Resource\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; use \Psr\Log\LoggerInterface; /** @@ -31,7 +35,12 @@ class SourceRepository implements SourceRepositoryInterface /** * @var ResourceSource */ - private $resource; + private $resourceSource; + + /** + * @var ResourceSourceCarrierLink + */ + private $resourceSourceCarrierLink; /** * @var SourceInterfaceFactory @@ -48,11 +57,21 @@ class SourceRepository implements SourceRepositoryInterface */ private $collectionFactory; + /** + * @var CarrierLinkCollectionFactory + */ + private $carrierLinkCollectionFactory; + /** * @var SourceSearchResultsInterfaceFactory */ private $sourceSearchResultsFactory; + /** + * @var SearchCriteriaBuilder + */ + private $searchCriteriaBuilder; + /** * @var LoggerInterface */ @@ -60,26 +79,35 @@ class SourceRepository implements SourceRepositoryInterface /** * SourceRepository constructor. - * @param ResourceSource $resource + * @param ResourceSource $resourceSource + * @param ResourceSourceCarrierLink $resourceSourceCarrierLink * @param SourceInterfaceFactory $sourceFactory * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $collectionFactory + * @param CarrierLinkCollectionFactory $carrierLinkCollectionFactory * @param SourceSearchResultsInterfaceFactory $sourceSearchResultsFactory + * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param LoggerInterface $logger */ public function __construct( - ResourceSource $resource, + ResourceSource $resourceSource, + ResourceSourceCarrierLink $resourceSourceCarrierLink, SourceInterfaceFactory $sourceFactory, CollectionProcessorInterface $collectionProcessor, CollectionFactory $collectionFactory, + CarrierLinkCollectionFactory $carrierLinkCollectionFactory, SourceSearchResultsInterfaceFactory $sourceSearchResultsFactory, + SearchCriteriaBuilder $searchCriteriaBuilder, LoggerInterface $logger ) { - $this->resource = $resource; + $this->resourceSource = $resourceSource; + $this->resourceSourceCarrierLink = $resourceSourceCarrierLink; $this->sourceFactory = $sourceFactory; $this->collectionProcessor = $collectionProcessor; $this->collectionFactory = $collectionFactory; + $this->carrierLinkCollectionFactory = $carrierLinkCollectionFactory; $this->sourceSearchResultsFactory = $sourceSearchResultsFactory; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->logger = $logger; } @@ -89,7 +117,8 @@ public function __construct( public function save(SourceInterface $source) { try { - $this->resource->save($source); + $this->saveSource($source); + $this->saveSourceCarrierLinks($source); return $source->getSourceId(); } catch (\Exception $exception) { $this->logger->error($exception->getMessage()); @@ -97,14 +126,36 @@ public function save(SourceInterface $source) } } + /** + * @param SourceInterface $source + */ + private function saveSource(SourceInterface $source) + { + /** @var SourceInterface|AbstractModel $source */ + $this->resourceSource->save($source); + } + + /** + * @param SourceInterface $source + */ + private function saveSourceCarrierLinks(SourceInterface $source) + { + /** @var SourceCarrierLinkInterface|AbstractModel $carrierLink */ + foreach ($source->getCarrierLinks() as $carrierLink) { + $carrierLink->setData(SourceInterface::SOURCE_ID, $source->getSourceId()); + $this->resourceSourceCarrierLink->save($carrierLink); + } + } + /** * @inheritdoc */ public function get($sourceId) { - /** @var SourceInterface|AbstractModel $model */ + /** @var SourceInterface|AbstractModel $source */ $source = $this->sourceFactory->create(); - $this->resource->load($source, $sourceId, SourceInterface::SOURCE_ID); + $this->resourceSource->load($source, $sourceId, SourceInterface::SOURCE_ID); + $this->addCarrierLinks($source); if (!$source->getSourceId()) { throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); @@ -113,6 +164,22 @@ public function get($sourceId) return $source; } + /** + * @param SourceInterface $source + */ + private function addCarrierLinks(SourceInterface $source) + { + /** @var ResourceSourceCarrierLink\Collection $collection */ + $collection = $this->carrierLinkCollectionFactory->create(); + + $searchCriteria = $this->searchCriteriaBuilder + ->addFilter(SourceInterface::SOURCE_ID, $source->getSourceId()) + ->create(); + + $this->collectionProcessor->process($searchCriteria, $collection); + $source->setCarrierLinks($collection->getItems()); + } + /** * @inheritdoc */ diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index 99b91f37a2046..44bcb68d6b3e4 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -7,6 +7,10 @@ use \Magento\Framework\Api\ExtensibleDataInterface; +/** + * SourceCarrierLink interface + * @api + */ interface SourceCarrierLinkInterface extends ExtensibleDataInterface { /**#@+ @@ -14,7 +18,6 @@ interface SourceCarrierLinkInterface extends ExtensibleDataInterface */ const CARRIER_CODE = 'carrier_code'; const POSITION = 'position'; - const EXTENSION_ATTRIBUTES = 'extension_attributes'; /**#@-*/ /** diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index f62295bd4cf2a..047e70c2b3af7 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -154,7 +154,7 @@ public function testCreateSource() $this->assertNotNull($result); $createdSource = $this->sourceRepository->get($result); - $this->assertSame( + $this->assertEquals( $this->getExpectedValues($this->getSourceDataArray($expectedSource)), $this->getSourceDataArray($createdSource) ); @@ -210,7 +210,6 @@ private function getSourceDataArray(SourceInterface $source) $result[SourceInterface::CARRIER_LINKS][] = [ SourceCarrierLinkInterface::CARRIER_CODE => $carrierLink->getCarrierCode(), SourceCarrierLinkInterface::POSITION => $carrierLink->getPosition(), - SourceCarrierLinkInterface::EXTENSION_ATTRIBUTES => [], ]; } } From a3599a49b9cfd73178fbf2df5da77193d6803857 Mon Sep 17 00:00:00 2001 From: Vadim Justus Date: Sun, 28 May 2017 20:56:14 +0200 Subject: [PATCH 0090/1004] magento-engcom/magento2#25: wip: Implement further api-functional tests --- .../Inventory/Model/SourceRepository.php | 7 +- .../Magento/Cms/Api/BlockRepositoryTest.php | 1 + .../InventoryApi/Api/SourceRepositoryTest.php | 284 ++++++++++++------ 3 files changed, 200 insertions(+), 92 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 0120daf1baafa..f16ae071906f8 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -188,15 +188,16 @@ public function getList(SearchCriteriaInterface $searchCriteria = null) /** @var \Magento\Inventory\Model\Resource\Source\Collection $collection */ $collection = $this->collectionFactory->create(); + /** @var SourceSearchResultsInterface $searchResults */ + $searchResults = $this->sourceSearchResultsFactory->create(); + // if there is a searchCriteria defined, use it to add its creterias to the collection if (!is_null($searchCriteria)) { $this->collectionProcessor->process($searchCriteria, $collection); + $searchResults->setSearchCriteria($searchCriteria); } - /** @var SourceSearchResultsInterface $searchResults */ - $searchResults = $this->sourceSearchResultsFactory->create(); $searchResults->setItems($collection->getItems()); - $searchResults->setSearchCriteria($searchCriteria); $searchResults->setTotalCount($collection->getSize()); return $searchResults; } diff --git a/dev/tests/api-functional/testsuite/Magento/Cms/Api/BlockRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Cms/Api/BlockRepositoryTest.php index 15ccd5e2586d8..3c00fdc1ae863 100644 --- a/dev/tests/api-functional/testsuite/Magento/Cms/Api/BlockRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Cms/Api/BlockRepositoryTest.php @@ -262,6 +262,7 @@ public function testSearch() $searchData = $searchCriteriaBuilder->create()->__toArray(); $requestData = ['searchCriteria' => $searchData]; + $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . "/search" . '?' . http_build_query($requestData), diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index 047e70c2b3af7..d01340e4ecadd 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -6,7 +6,9 @@ namespace Magento\InventoryApi\Api; use Magento\Directory\Api\CountryInformationAcquirerInterface; +use Magento\Framework\Api\FilterBuilder; use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Framework\Api\SortOrder; use Magento\Framework\Api\SortOrderBuilder; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterfaceFactory; @@ -46,6 +48,11 @@ class SourceRepositoryTest extends WebapiAbstract */ private $searchCriteriaBuilder; + /** + * @var FilterBuilder + */ + private $filterBuilder; + /** * @var SortOrderBuilder */ @@ -71,95 +78,13 @@ public function setUp() $this->searchCriteriaBuilder = Bootstrap::getObjectManager() ->create(SearchCriteriaBuilder::class); + $this->filterBuilder = Bootstrap::getObjectManager() + ->create(FilterBuilder::class); + $this->sortOrderBuilder = Bootstrap::getObjectManager() ->create(SortOrderBuilder::class); } - /** - * Create new Inventory Source using Web API and verify it's integrity. - */ - public function testCreateSource() - { - $country = $this->countryInformationAcquirer->getCountryInfo('DE'); - $regions = $country->getAvailableRegions(); - $region = $regions[0]; - - $name = 'Source name'; - $description = 'Some description for source'; - $city = 'Exampletown'; - $street = 'Some Street 455'; - $postcode = '54321'; - $contactName = 'Contact Name'; - $email = 'example.guy@test.com'; - $fax = '0120002020033'; - $phone = '0120002020044'; - $latitude = 51.343479; - $longitude = 12.387772; - $isActive = true; - $priority = 40; - - $carrierCode1 = 'CAR-1'; - $carrierCode2 = 'CAR-2'; - - /** @var SourceCarrierLinkInterface $expectedCarrierLink1 */ - $expectedCarrierLink1 = $this->sourceCarrierLinkFactory->create(); - $expectedCarrierLink1->setPosition(1) - ->setCarrierCode($carrierCode1); - - /** @var SourceCarrierLinkInterface $expectedCarrierLink2 */ - $expectedCarrierLink2 = $this->sourceCarrierLinkFactory->create(); - $expectedCarrierLink2->setPosition(2) - ->setCarrierCode($carrierCode2); - - /** @var \Magento\InventoryApi\Api\Data\SourceInterface $expectedSource */ - $expectedSource = $this->sourceFactory->create(); - $expectedSource->setName($name) - ->setCity($city) - ->setPostcode($postcode) - ->setContactName($contactName) - ->setCountryId($country->getId()) - ->setDescription($description) - ->setEmail($email) - ->setStreet($street) - ->setFax($fax) - ->setPhone($phone) - ->setRegion($region->getName()) - ->setRegionId($region->getId()) - ->setLatitude($latitude) - ->setLongitude($longitude) - ->setIsActive($isActive) - ->setPriority($priority) - ->setCarrierLinks([ - $expectedCarrierLink1, - $expectedCarrierLink2 - ]); - - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH, - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => [ - 'service' => self::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'Save', - ], - ]; - - $requestData = [ - 'source' => $this->getSourceDataArray($expectedSource) - ]; - - $result = $this->_webApiCall($serviceInfo, $requestData); - $this->assertNotNull($result); - - $createdSource = $this->sourceRepository->get($result); - $this->assertEquals( - $this->getExpectedValues($this->getSourceDataArray($expectedSource)), - $this->getSourceDataArray($createdSource) - ); - } - /** * @param array $sourceData * @return array @@ -217,13 +142,121 @@ private function getSourceDataArray(SourceInterface $source) return $result; } + /** + * @param int $countCarrier + * @param string $postcode + * @return SourceInterface + */ + private function createRandomSource($countCarrier = 2, $postcode = '54321', $isActive = true) + { + $country = $this->countryInformationAcquirer->getCountryInfo('US'); + $regions = $country->getAvailableRegions(); + $region = $regions[rand(0, count($regions)-1)]; + + $name = 'Api Test ' . uniqid(); + $description = 'This is an inventory source created by api-functional tests'; + $city = 'Exampletown'; + $street = 'Some Street 455'; + $contactName = 'Contact Name'; + $email = 'example.guy@test.com'; + $fax = '0120002066033'; + $phone = '01660002020044'; + $latitude = 51.343479; + $longitude = 12.387772; + $priority = rand(1,999); + + $carriers = []; + for ($index = 1; $index <= $countCarrier; $index++) { + $carrierCode = 'CAR-' . $index; + $carrier = $this->sourceCarrierLinkFactory->create(); + $carrier->setPosition($index) + ->setCarrierCode($carrierCode); + $carriers[] = $carrier; + } + + /** @var \Magento\InventoryApi\Api\Data\SourceInterface $source */ + $source = $this->sourceFactory->create(); + $source->setName($name) + ->setCity($city) + ->setPostcode($postcode) + ->setContactName($contactName) + ->setCountryId($country->getId()) + ->setDescription($description) + ->setEmail($email) + ->setStreet($street) + ->setFax($fax) + ->setPhone($phone) + ->setRegion($region->getName()) + ->setRegionId($region->getId()) + ->setLatitude($latitude) + ->setLongitude($longitude) + ->setIsActive($isActive) + ->setPriority($priority) + ->setCarrierLinks($carriers); + + return $source; + } + + /** + * Create new Inventory Source using Web API and verify it's integrity. + */ + public function testCreateSource() + { + $expectedSource = $this->createRandomSource(3); + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Save', + ], + ]; + + $requestData = [ + 'source' => $this->getSourceDataArray($expectedSource) + ]; + + $result = $this->_webApiCall($serviceInfo, $requestData); + $this->assertNotNull($result); + + $createdSource = $this->sourceRepository->get($result); + $this->assertEquals( + $this->getExpectedValues($this->getSourceDataArray($expectedSource)), + $this->getSourceDataArray($createdSource) + ); + } + /** * Load already existing Inventory Source using Web API and verify it's integrity. */ public function testGetSource() { - //TODO: Implement testGetSource - $this->fail(__METHOD__ . " is not implemented yet."); + $expectedSource = $this->createRandomSource(5); + $currentSourceId = $this->sourceRepository->save($expectedSource); + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $currentSourceId, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Get', + ], + ]; + + $result = $this->_webApiCall($serviceInfo, [SourceInterface::SOURCE_ID => $currentSourceId]); + $this->assertNotNull($result); + + $this->assertEquals($currentSourceId, $result[SourceInterface::SOURCE_ID]); + + unset($result[SourceInterface::SOURCE_ID]); + $this->assertEquals($this->getSourceDataArray($expectedSource), $result); } /** @@ -231,8 +264,81 @@ public function testGetSource() */ public function testGetSourcesList() { - //TODO: Implement testGetSourcesList - $this->fail(__METHOD__ . " is not implemented yet."); + $this->markTestSkipped('WIP: Search seems to ignore filter criterias!'); + + /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ + $searchCriteriaBuilder = Bootstrap::getObjectManager() + ->create(SearchCriteriaBuilder::class); + + $postcode1 = uniqid('APITEST'); + $postcode2 = uniqid('APITEST'); + + $source1 = $this->createRandomSource(2, $postcode1, true); + $source1->setSourceId($this->sourceRepository->save($source1)); + + $source2 = $this->createRandomSource(3, $postcode1, false); + $this->sourceRepository->save($source2); + + $source3 = $this->createRandomSource(1, $postcode2, true); + $this->sourceRepository->save($source3); + + $source4 = $this->createRandomSource(3, $postcode2, true); + $this->sourceRepository->save($source4); + + $filter1 = $this->filterBuilder->setField(SourceInterface::POSTCODE) + ->setValue($postcode1); + + $filter2 = $this->filterBuilder->setField(SourceInterface::POSTCODE) + ->setValue($postcode2); + + $filter3 = $this->filterBuilder->setField(SourceInterface::IS_ACTIVE) + ->setValue(true); + + // where postcode = $postcode1 + // or postcode = $postcode2 + // and is_active = true + $searchCriteriaBuilder->addFilters([$filter1, $filter3]); + $searchCriteriaBuilder->addFilters([$filter2, $filter3]); + + $searchCriteriaBuilder->setPageSize(2); + + /** @var SortOrder $sortOrder */ + $sortOrder = $this->sortOrderBuilder->setField(SourceInterface::SOURCE_ID) + ->setDirection(SortOrder::SORT_ASC) + ->create(); + + $searchCriteriaBuilder->setSortOrders([$sortOrder]); + + $searchData = $searchCriteriaBuilder->create()->__toArray(); + $requestData = ['searchCriteria' => $searchData]; + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . 'search?' . http_build_query($requestData), + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'GetList', + ], + ]; + + var_dump($serviceInfo); + + $searchResult = $this->_webApiCall($serviceInfo, $requestData); + var_dump($searchResult); + + $this->assertEquals(3, $searchResult['page_size']); + $this->assertEquals(2, count($searchResult['items'])); + $this->assertEquals( + $searchResult['items'][0][SourceInterface::SOURCE_ID], + $source1->getSourceId() + ); + $this->assertEquals( + $searchResult['items'][1][SourceInterface::SOURCE_ID], + $source2->getSourceId() + ); } /** From 2ce2684f49bf7fce371e8c270895fa6bdb1f856b Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Sun, 28 May 2017 22:50:01 +0300 Subject: [PATCH 0091/1004] magento-engcom/magento2#25: Source Management API Implementation - Added PHP 7 types --- app/code/Magento/Inventory/Model/Source.php | 70 +++++------ .../Inventory/Model/SourceRepository.php | 6 +- .../Magento/Inventory/Setup/InstallSchema.php | 2 +- .../InventoryApi/Api/Data/SourceInterface.php | 110 +++++++++--------- .../Api/SourceRepositoryInterface.php | 7 +- 5 files changed, 98 insertions(+), 97 deletions(-) diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index b027936da91cc..4fc3e34a1b254 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -36,7 +36,7 @@ public function getSourceId() /** * @inheritdoc */ - public function setSourceId($sourceId) + public function setSourceId(int $sourceId): SourceInterface { $this->setData(SourceInterface::SOURCE_ID, $sourceId); return $this; @@ -45,7 +45,7 @@ public function setSourceId($sourceId) /** * @inheritdoc */ - public function getName() + public function getName(): string { return $this->getData(SourceInterface::NAME); } @@ -53,7 +53,7 @@ public function getName() /** * @inheritdoc */ - public function setName($name) + public function setName(string $name): SourceInterface { $this->setData(SourceInterface::NAME, $name); return $this; @@ -62,7 +62,7 @@ public function setName($name) /** * @inheritdoc */ - public function getEmail() + public function getEmail(): string { return $this->getData(SourceInterface::EMAIL); } @@ -70,7 +70,7 @@ public function getEmail() /** * @inheritdoc */ - public function setEmail($email) + public function setEmail(string $email): SourceInterface { $this->setData(SourceInterface::EMAIL, $email); return $this; @@ -79,7 +79,7 @@ public function setEmail($email) /** * @inheritdoc */ - public function getContactName() + public function getContactName(): string { return $this->getData(SourceInterface::CONTACT_NAME); } @@ -87,7 +87,7 @@ public function getContactName() /** * @inheritdoc */ - public function setContactName($contactName) + public function setContactName(string $contactName): SourceInterface { $this->setData(SourceInterface::CONTACT_NAME, $contactName); return $this; @@ -96,7 +96,7 @@ public function setContactName($contactName) /** * @inheritdoc */ - public function getIsActive() + public function getIsActive(): bool { return $this->getData(SourceInterface::IS_ACTIVE); } @@ -104,7 +104,7 @@ public function getIsActive() /** * @inheritdoc */ - public function setIsActive($active) + public function setIsActive(bool $active): SourceInterface { $this->setData(SourceInterface::IS_ACTIVE, $active); return $this; @@ -113,7 +113,7 @@ public function setIsActive($active) /** * @inheritdoc */ - public function getDescription() + public function getDescription(): string { return $this->getData(SourceInterface::DESCRIPTION); } @@ -121,7 +121,7 @@ public function getDescription() /** * @inheritdoc */ - public function setDescription($description) + public function setDescription(string $description): SourceInterface { $this->setData(SourceInterface::DESCRIPTION, $description); return $this; @@ -130,7 +130,7 @@ public function setDescription($description) /** * @inheritdoc */ - public function getLatitude() + public function getLatitude(): float { return $this->getData(SourceInterface::LATITUDE); } @@ -138,7 +138,7 @@ public function getLatitude() /** * @inheritdoc */ - public function setLatitude($latitude) + public function setLatitude(float $latitude): SourceInterface { $this->setData(SourceInterface::LATITUDE, $latitude); return $this; @@ -147,7 +147,7 @@ public function setLatitude($latitude) /** * @inheritdoc */ - public function getLongitude() + public function getLongitude(): float { return $this->getData(SourceInterface::LONGITUDE); } @@ -155,7 +155,7 @@ public function getLongitude() /** * @inheritdoc */ - public function setLongitude($longitude) + public function setLongitude(float $longitude): SourceInterface { $this->setData(SourceInterface::LONGITUDE, $longitude); return $this; @@ -164,7 +164,7 @@ public function setLongitude($longitude) /** * @inheritdoc */ - public function getCountryId() + public function getCountryId(): string { return $this->getData(SourceInterface::COUNTRY_ID); } @@ -172,7 +172,7 @@ public function getCountryId() /** * @inheritdoc */ - public function setCountryId($countryId) + public function setCountryId(string $countryId): SourceInterface { $this->setData(SourceInterface::COUNTRY_ID, $countryId); return $this; @@ -181,7 +181,7 @@ public function setCountryId($countryId) /** * @inheritdoc */ - public function getRegionId() + public function getRegionId(): int { return $this->getData(SourceInterface::REGION_ID); } @@ -189,7 +189,7 @@ public function getRegionId() /** * @inheritdoc */ - public function setRegionId($regionId) + public function setRegionId(int $regionId): SourceInterface { $this->setData(SourceInterface::REGION_ID, $regionId); return $this; @@ -198,7 +198,7 @@ public function setRegionId($regionId) /** * @inheritdoc */ - public function getRegion() + public function getRegion(): string { return $this->getData(SourceInterface::REGION); } @@ -206,7 +206,7 @@ public function getRegion() /** * @inheritdoc */ - public function setRegion($region) + public function setRegion(string $region): SourceInterface { $this->setData(SourceInterface::REGION, $region); return $this; @@ -215,7 +215,7 @@ public function setRegion($region) /** * @inheritdoc */ - public function getCity() + public function getCity(): string { return $this->getData(SourceInterface::CITY); } @@ -223,7 +223,7 @@ public function getCity() /** * @inheritdoc */ - public function setCity($city) + public function setCity(string $city): SourceInterface { $this->setData(SourceInterface::CITY, $city); return $this; @@ -232,7 +232,7 @@ public function setCity($city) /** * @inheritdoc */ - public function getStreet() + public function getStreet(): string { return $this->getData(SourceInterface::STREET); } @@ -240,7 +240,7 @@ public function getStreet() /** * @inheritdoc */ - public function setStreet($street) + public function setStreet(string $street): SourceInterface { $this->setData(SourceInterface::STREET, $street); return $this; @@ -249,7 +249,7 @@ public function setStreet($street) /** * @inheritdoc */ - public function getPostcode() + public function getPostcode(): string { return $this->getData(SourceInterface::POSTCODE); } @@ -257,7 +257,7 @@ public function getPostcode() /** * @inheritdoc */ - public function setPostcode($postcode) + public function setPostcode(string $postcode): SourceInterface { $this->setData(SourceInterface::POSTCODE, $postcode); return $this; @@ -266,7 +266,7 @@ public function setPostcode($postcode) /** * @inheritdoc */ - public function getPhone() + public function getPhone(): string { return $this->getData(SourceInterface::PHONE); } @@ -274,7 +274,7 @@ public function getPhone() /** * @inheritdoc */ - public function setPhone($phone) + public function setPhone(string $phone): SourceInterface { $this->setData(SourceInterface::PHONE, $phone); return $this; @@ -283,7 +283,7 @@ public function setPhone($phone) /** * @inheritdoc */ - public function getFax() + public function getFax(): string { return $this->getData(SourceInterface::FAX); } @@ -291,7 +291,7 @@ public function getFax() /** * @inheritdoc */ - public function setFax($fax) + public function setFax(string $fax): SourceInterface { $this->setData(SourceInterface::FAX, $fax); return $this; @@ -300,7 +300,7 @@ public function setFax($fax) /** * @inheritdoc */ - public function getPriority() + public function getPriority(): int { return $this->getData(SourceInterface::PRIORITY); } @@ -308,7 +308,7 @@ public function getPriority() /** * @inheritdoc */ - public function setPriority($priority) + public function setPriority(int $priority): SourceInterface { $this->setData(SourceInterface::PRIORITY, $priority); return $this; @@ -317,7 +317,7 @@ public function setPriority($priority) /** * @inheritdoc */ - public function getCarrierLinks() + public function getCarrierLinks(): array { return $this->getData(SourceInterface::CARRIER_LINKS); } @@ -325,7 +325,7 @@ public function getCarrierLinks() /** * @inheritdoc */ - public function setCarrierLinks($carrierLinks) + public function setCarrierLinks(array $carrierLinks): SourceInterface { $this->setData(SourceInterface::CARRIER_LINKS, $carrierLinks); return $this; diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index f16ae071906f8..458dc316d8d2b 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -114,7 +114,7 @@ public function __construct( /** * @inheritdoc */ - public function save(SourceInterface $source) + public function save(SourceInterface $source): int { try { $this->saveSource($source); @@ -150,7 +150,7 @@ private function saveSourceCarrierLinks(SourceInterface $source) /** * @inheritdoc */ - public function get($sourceId) + public function get(int $sourceId): SourceInterface { /** @var SourceInterface|AbstractModel $source */ $source = $this->sourceFactory->create(); @@ -183,7 +183,7 @@ private function addCarrierLinks(SourceInterface $source) /** * @inheritdoc */ - public function getList(SearchCriteriaInterface $searchCriteria = null) + public function getList(SearchCriteriaInterface $searchCriteria = null): SourceSearchResultsInterface { /** @var \Magento\Inventory\Model\Resource\Source\Collection $collection */ $collection = $this->collectionFactory->create(); diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index 9cddd740c29d9..e3fc9360650fa 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -136,7 +136,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( SourceInterface::COUNTRY_ID, Table::TYPE_TEXT, - 2, + 30, [ InstallSchema::OPTION_NULLABLE => false, InstallSchema::OPTION_DEFAULT => '' diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php index 75ac289b5f24c..76b7cbd634da3 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\InventoryApi\Api\Data; -use \Magento\Framework\Api\ExtensibleDataInterface; +use Magento\Framework\Api\ExtensibleDataInterface; /** * @api @@ -46,260 +46,260 @@ public function getSourceId(); * Set source id. * * @param int $sourceId - * @return $this + * @return SourceInterface */ - public function setSourceId($sourceId); + public function setSourceId(int $sourceId): SourceInterface; /** * Get source name. * * @return string */ - public function getName(); + public function getName(): string; /** * Set source name. * * @param string $name - * @return $this + * @return SourceInterface */ - public function setName($name); + public function setName(string $name): SourceInterface; /** * Get source email * * @return string */ - public function getEmail(); + public function getEmail(): string; /** * Set source email * * @param string $email - * @return $this + * @return SourceInterface */ - public function setEmail($email); + public function setEmail(string $email): SourceInterface; /** * Get source contact name. * * @return string */ - public function getContactName(); + public function getContactName(): string; /** * Set source contact name. * * @param string $contactName - * @return $this + * @return SourceInterface */ - public function setContactName($contactName); + public function setContactName(string $contactName): SourceInterface; /** * Check if source is enabled. * * @return bool */ - public function getIsActive(); + public function getIsActive(): bool; /** * Enable or disable source. * * @param bool $active - * @return $this + * @return SourceInterface */ - public function setIsActive($active); + public function setIsActive(bool $active): SourceInterface; /** * Get source description. * * @return string */ - public function getDescription(); + public function getDescription(): string; /** * Set source description. * * @param string $description - * @return $this + * @return SourceInterface */ - public function setDescription($description); + public function setDescription(string $description): SourceInterface; /** * Get source latitude. * * @return float */ - public function getLatitude(); + public function getLatitude(): float; /** * Set source latitude. * * @param float $latitude - * @return $this + * @return SourceInterface */ - public function setLatitude($latitude); + public function setLatitude(float $latitude): SourceInterface; /** * Get source longitude. * * @return float */ - public function getLongitude(); + public function getLongitude(): float; /** * Set source longitude. * * @param float $longitude - * @return $this + * @return SourceInterface */ - public function setLongitude($longitude); + public function setLongitude(float $longitude): SourceInterface; /** * Get source country id. * * @return string */ - public function getCountryId(); + public function getCountryId(): string; /** * Set source country id. * - * @param int $countryId - * @return $this + * @param string $countryId + * @return SourceInterface */ - public function setCountryId($countryId); + public function setCountryId(string $countryId): SourceInterface; /** * Get region id if source has registered region. * * @return int */ - public function getRegionId(); + public function getRegionId(): int; /** * Set region id if source has registered region. * * @param int $regionId - * @return $this + * @return SourceInterface */ - public function setRegionId($regionId); + public function setRegionId(int $regionId): SourceInterface; /** * Get region title if source has custom region * * @return string */ - public function getRegion(); + public function getRegion(): string; /** * Set source region title. * * @param string $region - * @return $this + * @return SourceInterface */ - public function setRegion($region); + public function setRegion(string $region): SourceInterface; /** * Get source city. * * @return string */ - public function getCity(); + public function getCity(): string; /** * Set source city. * * @param string $city - * @return $this + * @return SourceInterface */ - public function setCity($city); + public function setCity(string $city): SourceInterface; /** * Get source street name. * * @return string */ - public function getStreet(); + public function getStreet(): string; /** * Set source street name. * * @param string $street - * @return $this + * @return SourceInterface */ - public function setStreet($street); + public function setStreet(string $street): SourceInterface; /** * Get source post code. * * @return string */ - public function getPostcode(); + public function getPostcode(): string; /** * Set source post code. * * @param string $postcode - * @return $this + * @return SourceInterface */ - public function setPostcode($postcode); + public function setPostcode(string $postcode): SourceInterface; /** * Get source phone number. * * @return string */ - public function getPhone(); + public function getPhone(): string; /** * Set source phone number. * * @param string $phone - * @return $this + * @return SourceInterface */ - public function setPhone($phone); + public function setPhone(string $phone): SourceInterface; /** * Get source fax. * * @return string */ - public function getFax(); + public function getFax(): string; /** * Set source fax. * * @param string $fax - * @return $this + * @return SourceInterface */ - public function setFax($fax); + public function setFax(string $fax): SourceInterface; /** * Get source priority * * @return int */ - public function getPriority(); + public function getPriority(): int; /** * Set source priority * * @param int $priority - * @return $this + * @return SourceInterface */ - public function setPriority($priority); + public function setPriority(int $priority): SourceInterface; /** * @param \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] $carrierLinks - * @return $this + * @return SourceInterface */ - public function setCarrierLinks($carrierLinks); + public function setCarrierLinks(array $carrierLinks): SourceInterface; /** * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] */ - public function getCarrierLinks(); + public function getCarrierLinks(): array; /** * Retrieve existing extension attributes object or create a new one. diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index 29df169d2cc21..b6c5a4af239be 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -9,6 +9,7 @@ use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\InventoryApi\Api\Data\SourceInterface; +use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; /** * @api @@ -23,7 +24,7 @@ interface SourceRepositoryInterface * * @throws CouldNotSaveException */ - public function save(SourceInterface $source); + public function save(SourceInterface $source): int; /** * Load Source data by given sourceId. @@ -32,7 +33,7 @@ public function save(SourceInterface $source); * @return \Magento\InventoryApi\Api\Data\SourceInterface * @throws NoSuchEntityException */ - public function get($sourceId); + public function get(int $sourceId): SourceInterface; /** * Load Source data collection by given search criteria @@ -40,5 +41,5 @@ public function get($sourceId); * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\InventoryApi\Api\Data\SourceSearchResultsInterface */ - public function getList(SearchCriteriaInterface $searchCriteria = null); + public function getList(SearchCriteriaInterface $searchCriteria = null): SourceSearchResultsInterface; } From 385132ac1a2473ee10fef28f1f25d9a9c532ea60 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Mon, 29 May 2017 12:05:44 +0300 Subject: [PATCH 0092/1004] magento-engcom/magento2#25: Source Management API Implementation - Removed PHP 7 Types to keep code PHPUnit 4 compatible - Fixed Unit Tests --- app/code/Magento/Inventory/Model/Source.php | 70 ++++++------ .../Inventory/Model/SourceRepository.php | 6 +- .../Test/Unit/Model/SourceRepositoryTest.php | 100 +++++++++++++---- .../InventoryApi/Api/Data/SourceInterface.php | 106 +++++++++--------- .../Api/SourceRepositoryInterface.php | 18 ++- 5 files changed, 176 insertions(+), 124 deletions(-) diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index 4fc3e34a1b254..b027936da91cc 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -36,7 +36,7 @@ public function getSourceId() /** * @inheritdoc */ - public function setSourceId(int $sourceId): SourceInterface + public function setSourceId($sourceId) { $this->setData(SourceInterface::SOURCE_ID, $sourceId); return $this; @@ -45,7 +45,7 @@ public function setSourceId(int $sourceId): SourceInterface /** * @inheritdoc */ - public function getName(): string + public function getName() { return $this->getData(SourceInterface::NAME); } @@ -53,7 +53,7 @@ public function getName(): string /** * @inheritdoc */ - public function setName(string $name): SourceInterface + public function setName($name) { $this->setData(SourceInterface::NAME, $name); return $this; @@ -62,7 +62,7 @@ public function setName(string $name): SourceInterface /** * @inheritdoc */ - public function getEmail(): string + public function getEmail() { return $this->getData(SourceInterface::EMAIL); } @@ -70,7 +70,7 @@ public function getEmail(): string /** * @inheritdoc */ - public function setEmail(string $email): SourceInterface + public function setEmail($email) { $this->setData(SourceInterface::EMAIL, $email); return $this; @@ -79,7 +79,7 @@ public function setEmail(string $email): SourceInterface /** * @inheritdoc */ - public function getContactName(): string + public function getContactName() { return $this->getData(SourceInterface::CONTACT_NAME); } @@ -87,7 +87,7 @@ public function getContactName(): string /** * @inheritdoc */ - public function setContactName(string $contactName): SourceInterface + public function setContactName($contactName) { $this->setData(SourceInterface::CONTACT_NAME, $contactName); return $this; @@ -96,7 +96,7 @@ public function setContactName(string $contactName): SourceInterface /** * @inheritdoc */ - public function getIsActive(): bool + public function getIsActive() { return $this->getData(SourceInterface::IS_ACTIVE); } @@ -104,7 +104,7 @@ public function getIsActive(): bool /** * @inheritdoc */ - public function setIsActive(bool $active): SourceInterface + public function setIsActive($active) { $this->setData(SourceInterface::IS_ACTIVE, $active); return $this; @@ -113,7 +113,7 @@ public function setIsActive(bool $active): SourceInterface /** * @inheritdoc */ - public function getDescription(): string + public function getDescription() { return $this->getData(SourceInterface::DESCRIPTION); } @@ -121,7 +121,7 @@ public function getDescription(): string /** * @inheritdoc */ - public function setDescription(string $description): SourceInterface + public function setDescription($description) { $this->setData(SourceInterface::DESCRIPTION, $description); return $this; @@ -130,7 +130,7 @@ public function setDescription(string $description): SourceInterface /** * @inheritdoc */ - public function getLatitude(): float + public function getLatitude() { return $this->getData(SourceInterface::LATITUDE); } @@ -138,7 +138,7 @@ public function getLatitude(): float /** * @inheritdoc */ - public function setLatitude(float $latitude): SourceInterface + public function setLatitude($latitude) { $this->setData(SourceInterface::LATITUDE, $latitude); return $this; @@ -147,7 +147,7 @@ public function setLatitude(float $latitude): SourceInterface /** * @inheritdoc */ - public function getLongitude(): float + public function getLongitude() { return $this->getData(SourceInterface::LONGITUDE); } @@ -155,7 +155,7 @@ public function getLongitude(): float /** * @inheritdoc */ - public function setLongitude(float $longitude): SourceInterface + public function setLongitude($longitude) { $this->setData(SourceInterface::LONGITUDE, $longitude); return $this; @@ -164,7 +164,7 @@ public function setLongitude(float $longitude): SourceInterface /** * @inheritdoc */ - public function getCountryId(): string + public function getCountryId() { return $this->getData(SourceInterface::COUNTRY_ID); } @@ -172,7 +172,7 @@ public function getCountryId(): string /** * @inheritdoc */ - public function setCountryId(string $countryId): SourceInterface + public function setCountryId($countryId) { $this->setData(SourceInterface::COUNTRY_ID, $countryId); return $this; @@ -181,7 +181,7 @@ public function setCountryId(string $countryId): SourceInterface /** * @inheritdoc */ - public function getRegionId(): int + public function getRegionId() { return $this->getData(SourceInterface::REGION_ID); } @@ -189,7 +189,7 @@ public function getRegionId(): int /** * @inheritdoc */ - public function setRegionId(int $regionId): SourceInterface + public function setRegionId($regionId) { $this->setData(SourceInterface::REGION_ID, $regionId); return $this; @@ -198,7 +198,7 @@ public function setRegionId(int $regionId): SourceInterface /** * @inheritdoc */ - public function getRegion(): string + public function getRegion() { return $this->getData(SourceInterface::REGION); } @@ -206,7 +206,7 @@ public function getRegion(): string /** * @inheritdoc */ - public function setRegion(string $region): SourceInterface + public function setRegion($region) { $this->setData(SourceInterface::REGION, $region); return $this; @@ -215,7 +215,7 @@ public function setRegion(string $region): SourceInterface /** * @inheritdoc */ - public function getCity(): string + public function getCity() { return $this->getData(SourceInterface::CITY); } @@ -223,7 +223,7 @@ public function getCity(): string /** * @inheritdoc */ - public function setCity(string $city): SourceInterface + public function setCity($city) { $this->setData(SourceInterface::CITY, $city); return $this; @@ -232,7 +232,7 @@ public function setCity(string $city): SourceInterface /** * @inheritdoc */ - public function getStreet(): string + public function getStreet() { return $this->getData(SourceInterface::STREET); } @@ -240,7 +240,7 @@ public function getStreet(): string /** * @inheritdoc */ - public function setStreet(string $street): SourceInterface + public function setStreet($street) { $this->setData(SourceInterface::STREET, $street); return $this; @@ -249,7 +249,7 @@ public function setStreet(string $street): SourceInterface /** * @inheritdoc */ - public function getPostcode(): string + public function getPostcode() { return $this->getData(SourceInterface::POSTCODE); } @@ -257,7 +257,7 @@ public function getPostcode(): string /** * @inheritdoc */ - public function setPostcode(string $postcode): SourceInterface + public function setPostcode($postcode) { $this->setData(SourceInterface::POSTCODE, $postcode); return $this; @@ -266,7 +266,7 @@ public function setPostcode(string $postcode): SourceInterface /** * @inheritdoc */ - public function getPhone(): string + public function getPhone() { return $this->getData(SourceInterface::PHONE); } @@ -274,7 +274,7 @@ public function getPhone(): string /** * @inheritdoc */ - public function setPhone(string $phone): SourceInterface + public function setPhone($phone) { $this->setData(SourceInterface::PHONE, $phone); return $this; @@ -283,7 +283,7 @@ public function setPhone(string $phone): SourceInterface /** * @inheritdoc */ - public function getFax(): string + public function getFax() { return $this->getData(SourceInterface::FAX); } @@ -291,7 +291,7 @@ public function getFax(): string /** * @inheritdoc */ - public function setFax(string $fax): SourceInterface + public function setFax($fax) { $this->setData(SourceInterface::FAX, $fax); return $this; @@ -300,7 +300,7 @@ public function setFax(string $fax): SourceInterface /** * @inheritdoc */ - public function getPriority(): int + public function getPriority() { return $this->getData(SourceInterface::PRIORITY); } @@ -308,7 +308,7 @@ public function getPriority(): int /** * @inheritdoc */ - public function setPriority(int $priority): SourceInterface + public function setPriority($priority) { $this->setData(SourceInterface::PRIORITY, $priority); return $this; @@ -317,7 +317,7 @@ public function setPriority(int $priority): SourceInterface /** * @inheritdoc */ - public function getCarrierLinks(): array + public function getCarrierLinks() { return $this->getData(SourceInterface::CARRIER_LINKS); } @@ -325,7 +325,7 @@ public function getCarrierLinks(): array /** * @inheritdoc */ - public function setCarrierLinks(array $carrierLinks): SourceInterface + public function setCarrierLinks($carrierLinks) { $this->setData(SourceInterface::CARRIER_LINKS, $carrierLinks); return $this; diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 458dc316d8d2b..f16ae071906f8 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -114,7 +114,7 @@ public function __construct( /** * @inheritdoc */ - public function save(SourceInterface $source): int + public function save(SourceInterface $source) { try { $this->saveSource($source); @@ -150,7 +150,7 @@ private function saveSourceCarrierLinks(SourceInterface $source) /** * @inheritdoc */ - public function get(int $sourceId): SourceInterface + public function get($sourceId) { /** @var SourceInterface|AbstractModel $source */ $source = $this->sourceFactory->create(); @@ -183,7 +183,7 @@ private function addCarrierLinks(SourceInterface $source) /** * @inheritdoc */ - public function getList(SearchCriteriaInterface $searchCriteria = null): SourceSearchResultsInterface + public function getList(SearchCriteriaInterface $searchCriteria = null) { /** @var \Magento\Inventory\Model\Resource\Source\Collection $collection */ $collection = $this->collectionFactory->create(); diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 9aa62a5f8665a..1992154472a74 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -7,6 +7,9 @@ namespace Magento\Inventory\Test\Unit\Model; use Magento\InventoryApi\Api\Data\SourceInterface; +use Magento\Inventory\Model\Resource\SourceCarrierLink as ResourceSourceCarrierLink; +use Magento\Inventory\Model\Resource\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; +use Magento\Framework\Api\SearchCriteriaBuilder; /** * Class SourceRepositoryTest @@ -16,7 +19,12 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Inventory\Model\Resource\Source|\PHPUnit_Framework_MockObject_MockObject */ - private $resource; + private $resourceSource; + + /** + * @var ResourceSourceCarrierLink|\PHPUnit_Framework_MockObject_MockObject + */ + private $carrierLinkResource; /** * @var \Magento\Inventory\Model\SourceFactory|\PHPUnit_Framework_MockObject_MockObject @@ -38,6 +46,16 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase */ private $sourceSearchResultsFactory; + /** + * @var CarrierLinkCollectionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + private $carrierLinkCollectionFactory; + + /** + * @var SearchCriteriaBuilder|\PHPUnit_Framework_MockObject_MockObject + */ + private $searchCriteriaBuilder; + /** * @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */ @@ -50,7 +68,7 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->resource = $this->getMock( + $this->resourceSource = $this->getMock( \Magento\Inventory\Model\Resource\Source::class, [], [], @@ -58,6 +76,19 @@ protected function setUp() false ); + $this->carrierLinkResource = $this->getMockBuilder(ResourceSourceCarrierLink::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->carrierLinkCollectionFactory = $this->getMockBuilder(CarrierLinkCollectionFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) + ->disableOriginalConstructor() + ->getMock(); + $this->sourceFactory = $this->getMock( \Magento\InventoryApi\Api\Data\SourceInterfaceFactory::class, ['create'], @@ -79,7 +110,7 @@ protected function setUp() ); $this->sourceSearchResultsFactory = $this->getMock( - \Magento\Inventory\Model\SourceSearchResultsFactory::class, + \Magento\InventoryApi\Api\Data\SourceSearchResultsInterfaceFactory::class, ['create'], [], '', @@ -94,11 +125,14 @@ protected function setUp() $this->sourceRepository = $objectManager->getObject( \Magento\Inventory\Model\SourceRepository::class, [ - 'resource' => $this->resource, + 'resourceSource' => $this->resourceSource, + 'resourceSourceCarrierLink' => $this->carrierLinkResource, 'sourceFactory' => $this->sourceFactory, 'collectionProcessor' => $this->collectionProcessor, 'collectionFactory' => $this->collectionFactory, + 'carrierLinkCollectionFactory' => $this->carrierLinkCollectionFactory, 'sourceSearchResultsFactory' => $this->sourceSearchResultsFactory, + 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, 'logger' => $this->loggerMock, ] ); @@ -106,17 +140,17 @@ protected function setUp() public function testSaveSuccessful() { - /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMock( - \Magento\Inventory\Model\Source::class, - [], - [], - '', - false - ); + $sourceId = 42; + /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceMock */ + $sourceMock = $this->getMockBuilder(\Magento\Inventory\Model\Source::class) + ->disableOriginalConstructor() + ->getMock(); + + $sourceMock->expects($this->atLeastOnce())->method('getSourceId')->willReturn($sourceId); + $sourceMock->expects($this->atLeastOnce())->method('getCarrierLinks')->willReturn([]); + $this->resourceSource->expects($this->once())->method('save')->with($sourceMock); - $result = $this->sourceRepository->save($sourceModel); - $this->assertNotNull($result); + $this->assertEquals($sourceId, $this->sourceRepository->save($sourceMock)); } public function testSaveErrorExpectsException() @@ -130,12 +164,12 @@ public function testSaveErrorExpectsException() false ); - $this->resource->expects($this->atLeastOnce()) + $this->resourceSource->expects($this->atLeastOnce()) ->method('save'); $this->setExpectedException(\Magento\Framework\Exception\CouldNotSaveException::class); - $this->resource->expects($this->atLeastOnce()) + $this->resourceSource->expects($this->atLeastOnce()) ->method('save') ->will($this->throwException(new \Exception('Some unit test Exception'))); @@ -154,6 +188,17 @@ public function testGetSuccessful() '', false ); + $searchCriteriaMock = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteria::class) + ->disableOriginalConstructor() + ->getMock(); + $carrierLinkCollectionMock = $this->getMockBuilder( + \Magento\Inventory\Model\Resource\SourceCarrierLink\Collection::class + )->disableOriginalConstructor()->getMock(); + + $this->carrierLinkCollectionFactory->expects($this->atLeastOnce())->method('create') + ->willReturn($carrierLinkCollectionMock); + $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf(); + $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('create')->willReturn($searchCriteriaMock); $sourceModel->expects($this->atLeastOnce()) ->method('getSourceId') @@ -163,12 +208,12 @@ public function testGetSuccessful() ->method('create') ->will($this->returnValue($sourceModel)); - $this->resource->expects($this->once()) + $this->resourceSource->expects($this->once()) ->method('load') ->with( $sourceModel, - SourceInterface::SOURCE_ID, - $sourceId + $sourceId, + SourceInterface::SOURCE_ID ); $result = $this->sourceRepository->get($sourceId); @@ -188,6 +233,17 @@ public function testGetErrorExpectsException() '', false ); + $searchCriteriaMock = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteria::class) + ->disableOriginalConstructor() + ->getMock(); + $carrierLinkCollectionMock = $this->getMockBuilder( + \Magento\Inventory\Model\Resource\SourceCarrierLink\Collection::class + )->disableOriginalConstructor()->getMock(); + + $this->carrierLinkCollectionFactory->expects($this->atLeastOnce())->method('create') + ->willReturn($carrierLinkCollectionMock); + $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf(); + $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('create')->willReturn($searchCriteriaMock); $sourceModel->expects($this->atLeastOnce()) ->method('getSourceId') @@ -197,12 +253,12 @@ public function testGetErrorExpectsException() ->method('create') ->will($this->returnValue($sourceModel)); - $this->resource->expects($this->once()) + $this->resourceSource->expects($this->once()) ->method('load') ->with( $sourceModel, - SourceInterface::SOURCE_ID, - $sourceId + $sourceId, + SourceInterface::SOURCE_ID ); $this->setExpectedException(\Magento\Framework\Exception\NoSuchEntityException::class); diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php index 76b7cbd634da3..0d544391f86a6 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php @@ -46,260 +46,260 @@ public function getSourceId(); * Set source id. * * @param int $sourceId - * @return SourceInterface + * @return $this */ - public function setSourceId(int $sourceId): SourceInterface; + public function setSourceId($sourceId); /** * Get source name. * * @return string */ - public function getName(): string; + public function getName(); /** * Set source name. * * @param string $name - * @return SourceInterface + * @return $this */ - public function setName(string $name): SourceInterface; + public function setName($name); /** * Get source email * * @return string */ - public function getEmail(): string; + public function getEmail(); /** * Set source email * * @param string $email - * @return SourceInterface + * @return $this */ - public function setEmail(string $email): SourceInterface; + public function setEmail($email); /** * Get source contact name. * * @return string */ - public function getContactName(): string; + public function getContactName(); /** * Set source contact name. * * @param string $contactName - * @return SourceInterface + * @return $this */ - public function setContactName(string $contactName): SourceInterface; + public function setContactName($contactName); /** * Check if source is enabled. * * @return bool */ - public function getIsActive(): bool; + public function getIsActive(); /** * Enable or disable source. * * @param bool $active - * @return SourceInterface + * @return $this */ - public function setIsActive(bool $active): SourceInterface; + public function setIsActive($active); /** * Get source description. * * @return string */ - public function getDescription(): string; + public function getDescription(); /** * Set source description. * * @param string $description - * @return SourceInterface + * @return $this */ - public function setDescription(string $description): SourceInterface; + public function setDescription($description); /** * Get source latitude. * * @return float */ - public function getLatitude(): float; + public function getLatitude(); /** * Set source latitude. * * @param float $latitude - * @return SourceInterface + * @return $this */ - public function setLatitude(float $latitude): SourceInterface; + public function setLatitude($latitude); /** * Get source longitude. * * @return float */ - public function getLongitude(): float; + public function getLongitude(); /** * Set source longitude. * * @param float $longitude - * @return SourceInterface + * @return $this */ - public function setLongitude(float $longitude): SourceInterface; + public function setLongitude($longitude); /** * Get source country id. * * @return string */ - public function getCountryId(): string; + public function getCountryId(); /** * Set source country id. * * @param string $countryId - * @return SourceInterface + * @return $this */ - public function setCountryId(string $countryId): SourceInterface; + public function setCountryId($countryId); /** * Get region id if source has registered region. * * @return int */ - public function getRegionId(): int; + public function getRegionId(); /** * Set region id if source has registered region. * * @param int $regionId - * @return SourceInterface + * @return $this */ - public function setRegionId(int $regionId): SourceInterface; + public function setRegionId($regionId); /** * Get region title if source has custom region * * @return string */ - public function getRegion(): string; + public function getRegion(); /** * Set source region title. * * @param string $region - * @return SourceInterface + * @return $this */ - public function setRegion(string $region): SourceInterface; + public function setRegion($region); /** * Get source city. * * @return string */ - public function getCity(): string; + public function getCity(); /** * Set source city. * * @param string $city - * @return SourceInterface + * @return $this */ - public function setCity(string $city): SourceInterface; + public function setCity($city); /** * Get source street name. * * @return string */ - public function getStreet(): string; + public function getStreet(); /** * Set source street name. * * @param string $street - * @return SourceInterface + * @return $this */ - public function setStreet(string $street): SourceInterface; + public function setStreet($street); /** * Get source post code. * * @return string */ - public function getPostcode(): string; + public function getPostcode(); /** * Set source post code. * * @param string $postcode - * @return SourceInterface + * @return $this */ - public function setPostcode(string $postcode): SourceInterface; + public function setPostcode($postcode); /** * Get source phone number. * * @return string */ - public function getPhone(): string; + public function getPhone(); /** * Set source phone number. * * @param string $phone - * @return SourceInterface + * @return $this */ - public function setPhone(string $phone): SourceInterface; + public function setPhone($phone); /** * Get source fax. * * @return string */ - public function getFax(): string; + public function getFax(); /** * Set source fax. * * @param string $fax - * @return SourceInterface + * @return $this */ - public function setFax(string $fax): SourceInterface; + public function setFax($fax); /** * Get source priority * * @return int */ - public function getPriority(): int; + public function getPriority(); /** * Set source priority * * @param int $priority - * @return SourceInterface + * @return $this */ - public function setPriority(int $priority): SourceInterface; + public function setPriority($priority); /** * @param \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] $carrierLinks - * @return SourceInterface + * @return $this */ - public function setCarrierLinks(array $carrierLinks): SourceInterface; + public function setCarrierLinks($carrierLinks); /** * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] */ - public function getCarrierLinks(): array; + public function getCarrierLinks(); /** * Retrieve existing extension attributes object or create a new one. diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index b6c5a4af239be..3bc8947a4cec0 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -5,12 +5,6 @@ */ namespace Magento\InventoryApi\Api; -use Magento\Framework\Api\SearchCriteriaInterface; -use Magento\Framework\Exception\CouldNotSaveException; -use Magento\Framework\Exception\NoSuchEntityException; -use Magento\InventoryApi\Api\Data\SourceInterface; -use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; - /** * @api */ @@ -22,18 +16,18 @@ interface SourceRepositoryInterface * @param \Magento\InventoryApi\Api\Data\SourceInterface $source * @return int * - * @throws CouldNotSaveException + * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function save(SourceInterface $source): int; + public function save(\Magento\InventoryApi\Api\Data\SourceInterface $source); /** * Load Source data by given sourceId. * * @param int $sourceId * @return \Magento\InventoryApi\Api\Data\SourceInterface - * @throws NoSuchEntityException + * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function get(int $sourceId): SourceInterface; + public function get($sourceId); /** * Load Source data collection by given search criteria @@ -41,5 +35,7 @@ public function get(int $sourceId): SourceInterface; * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\InventoryApi\Api\Data\SourceSearchResultsInterface */ - public function getList(SearchCriteriaInterface $searchCriteria = null): SourceSearchResultsInterface; + public function getList( + \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null + ); } From 8c094fddf6011e26a4d06a81e5592c9f55d8e57d Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Mon, 29 May 2017 12:58:48 +0300 Subject: [PATCH 0093/1004] magento-engcom/magento2#25: Source Management API Implementation - Unit Tests Updated --- app/code/Magento/Inventory/Model/Source.php | 6 +- .../Inventory/Model/SourceCarrierLink.php | 4 +- .../Test/Unit/Model/SourceCarrierLinkTest.php | 49 ---- .../Test/Unit/Model/SourceRepositoryTest.php | 253 ++++++------------ .../Inventory/Test/Unit/Model/SourceTest.php | 160 ----------- 5 files changed, 92 insertions(+), 380 deletions(-) delete mode 100644 app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php delete mode 100644 app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index b027936da91cc..f07dda86daf6f 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -11,9 +11,11 @@ /** * Class Source, - * provides implementation of the SourceInterface which adds the possibilty + * provides implementation of the SourceInterface which adds the possibility * for a Merchant to map existing physical sources to some particular sales channels - * this model holds the information like name and description of this physical sources + * this model holds the information like name and description of this physical sources. + * + * @codeCoverageIgnore */ class Source extends AbstractExtensibleModel implements SourceInterface { diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php index 2b5473103521f..d79fcbaed25b1 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php @@ -9,12 +9,14 @@ use Magento\Framework\Model\AbstractExtensibleModel; use \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; +/** + * @codeCoverageIgnore + */ class SourceCarrierLink extends AbstractExtensibleModel implements SourceCarrierLinkInterface { /** * Initialize resource model * - * @codingStandardsIgnore * @return void */ protected function _construct() diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php deleted file mode 100644 index 259eee69c31a8..0000000000000 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceCarrierLinkTest.php +++ /dev/null @@ -1,49 +0,0 @@ -objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->sourceCarrierLink = $this->objectManager->getObject(SourceCarrierLink::class); - } - - public function testCarrierCode() - { - $this->sourceCarrierLink->setCarrierCode(SourceCarrierLinkTest::TEST_STRING); - $this->assertEquals($this->sourceCarrierLink->getCarrierCode(), SourceCarrierLinkTest::TEST_STRING); - } - - public function testPosition() - { - $this->sourceCarrierLink->setPosition(SourceCarrierLinkTest::TEST_POSITION); - $this->assertEquals($this->sourceCarrierLink->getPosition(), SourceCarrierLinkTest::TEST_POSITION); - } -} diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 1992154472a74..d93181bc57679 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -7,8 +7,17 @@ namespace Magento\Inventory\Test\Unit\Model; use Magento\InventoryApi\Api\Data\SourceInterface; +use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; +use Magento\InventoryApi\Api\Data\SourceSearchResultsInterfaceFactory; +use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; +use Magento\Inventory\Model\Source; +use Magento\Inventory\Model\Resource\Source as SourceResource; +use Magento\Inventory\Model\Resource\Source\CollectionFactory as SourceCollectionFactory; +use Magento\Inventory\Model\Resource\Source\Collection as SourceCollection; +use Magento\Inventory\Model\SourceCarrierLink; use Magento\Inventory\Model\Resource\SourceCarrierLink as ResourceSourceCarrierLink; use Magento\Inventory\Model\Resource\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; +use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaBuilder; /** @@ -17,9 +26,9 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Inventory\Model\Resource\Source|\PHPUnit_Framework_MockObject_MockObject + * @var SourceResource|\PHPUnit_Framework_MockObject_MockObject */ - private $resourceSource; + private $sourceResource; /** * @var ResourceSourceCarrierLink|\PHPUnit_Framework_MockObject_MockObject @@ -27,22 +36,22 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase private $carrierLinkResource; /** - * @var \Magento\Inventory\Model\SourceFactory|\PHPUnit_Framework_MockObject_MockObject + * @var SourceInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject */ private $sourceFactory; /** - * @var \Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface|\PHPUnit_Framework_MockObject_MockObject + * @var CollectionProcessorInterface|\PHPUnit_Framework_MockObject_MockObject */ private $collectionProcessor; /** - * @var \Magento\Inventory\Model\Resource\Source\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + * @var SourceCollectionFactory|\PHPUnit_Framework_MockObject_MockObject */ private $collectionFactory; /** - * @var \Magento\Inventory\Model\SourceSearchResultsFactory|\PHPUnit_Framework_MockObject_MockObject + * @var SourceSearchResultsInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject */ private $sourceSearchResultsFactory; @@ -62,70 +71,48 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase private $loggerMock; /** - * @var \Magento\Inventory\Model\SourceRepository|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Inventory\Model\SourceRepository */ - private $sourceRepository; + private $model; protected function setUp() { - $this->resourceSource = $this->getMock( - \Magento\Inventory\Model\Resource\Source::class, - [], - [], - '', - false - ); - + $this->sourceResource = $this->getMockBuilder(SourceResource::class)->disableOriginalConstructor()->getMock(); $this->carrierLinkResource = $this->getMockBuilder(ResourceSourceCarrierLink::class) ->disableOriginalConstructor() ->getMock(); - $this->carrierLinkCollectionFactory = $this->getMockBuilder(CarrierLinkCollectionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) ->disableOriginalConstructor() ->getMock(); - - $this->sourceFactory = $this->getMock( - \Magento\InventoryApi\Api\Data\SourceInterfaceFactory::class, - ['create'], - [], - '', - false - ); - - $this->collectionProcessor = $this->getMockBuilder( - \Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface::class - )->getMockForAbstractClass(); - - $this->collectionFactory = $this->getMock( - \Magento\Inventory\Model\Resource\Source\CollectionFactory::class, - ['create'], - [], - '', - false - ); - - $this->sourceSearchResultsFactory = $this->getMock( - \Magento\InventoryApi\Api\Data\SourceSearchResultsInterfaceFactory::class, - ['create'], - [], - '', - false - ); - + $this->sourceFactory = $this->getMockBuilder(SourceInterfaceFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class) + ->disableOriginalConstructor() + ->setMethods(['process']) + ->getMock(); + $this->collectionFactory = $this->getMockBuilder(SourceCollectionFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->sourceSearchResultsFactory = $this->getMockBuilder(SourceSearchResultsInterfaceFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class) ->disableOriginalConstructor() ->getMock(); $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->sourceRepository = $objectManager->getObject( + $this->model = $objectManager->getObject( \Magento\Inventory\Model\SourceRepository::class, [ - 'resourceSource' => $this->resourceSource, + 'resourceSource' => $this->sourceResource, 'resourceSourceCarrierLink' => $this->carrierLinkResource, 'sourceFactory' => $this->sourceFactory, 'collectionProcessor' => $this->collectionProcessor, @@ -145,49 +132,40 @@ public function testSaveSuccessful() $sourceMock = $this->getMockBuilder(\Magento\Inventory\Model\Source::class) ->disableOriginalConstructor() ->getMock(); + $carrierLinkMock = $this->getMockBuilder(SourceCarrierLink::class) + ->disableOriginalConstructor() + ->getMock(); $sourceMock->expects($this->atLeastOnce())->method('getSourceId')->willReturn($sourceId); - $sourceMock->expects($this->atLeastOnce())->method('getCarrierLinks')->willReturn([]); - $this->resourceSource->expects($this->once())->method('save')->with($sourceMock); + $sourceMock->expects($this->atLeastOnce())->method('getCarrierLinks')->willReturn([$carrierLinkMock]); + + $this->sourceResource->expects($this->once())->method('save')->with($sourceMock); + $this->carrierLinkResource->expects($this->once())->method('save')->with($carrierLinkMock); - $this->assertEquals($sourceId, $this->sourceRepository->save($sourceMock)); + $this->assertEquals($sourceId, $this->model->save($sourceMock)); } + /** + * @expectedException \Magento\Framework\Exception\CouldNotSaveException + */ public function testSaveErrorExpectsException() { - /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMock( - \Magento\Inventory\Model\Source::class, - [], - [], - '', - false - ); - - $this->resourceSource->expects($this->atLeastOnce()) - ->method('save'); - - $this->setExpectedException(\Magento\Framework\Exception\CouldNotSaveException::class); - - $this->resourceSource->expects($this->atLeastOnce()) + /** @var Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ + $sourceModel = $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(); + $this->sourceResource->expects($this->atLeastOnce())->method('save'); + $this->sourceResource->expects($this->atLeastOnce()) ->method('save') ->will($this->throwException(new \Exception('Some unit test Exception'))); - $this->sourceRepository->save($sourceModel); + $this->model->save($sourceModel); } public function testGetSuccessful() { $sourceId = 345; - /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMock( - \Magento\Inventory\Model\Source::class, - [], - [], - '', - false - ); + /** @var Source|\PHPUnit_Framework_MockObject_MockObject $sourceMock */ + $sourceMock = $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(); $searchCriteriaMock = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteria::class) ->disableOriginalConstructor() ->getMock(); @@ -200,39 +178,34 @@ public function testGetSuccessful() $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf(); $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('create')->willReturn($searchCriteriaMock); - $sourceModel->expects($this->atLeastOnce()) + $carrierLinkCollectionMock->expects($this->atLeastOnce())->method('getItems')->willReturn([]); + $sourceMock->expects($this->atLeastOnce())->method('setCarrierLinks')->with([]); + + $sourceMock->expects($this->atLeastOnce()) ->method('getSourceId') ->will($this->returnValue($sourceId)); - - $this->sourceFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($sourceModel)); - - $this->resourceSource->expects($this->once()) + $this->sourceFactory->expects($this->once())->method('create')->willReturn($sourceMock); + $this->sourceResource->expects($this->once()) ->method('load') ->with( - $sourceModel, + $sourceMock, $sourceId, SourceInterface::SOURCE_ID ); - $result = $this->sourceRepository->get($sourceId); - $this->assertSame($sourceModel, $result); + $this->assertSame($sourceMock, $this->model->get($sourceId)); } + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + */ public function testGetErrorExpectsException() { $sourceId = 345; - /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMock( - \Magento\Inventory\Model\Source::class, - [], - [], - '', - false - ); + /** @var Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ + $sourceModel = $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(); $searchCriteriaMock = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteria::class) ->disableOriginalConstructor() ->getMock(); @@ -245,15 +218,9 @@ public function testGetErrorExpectsException() $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf(); $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('create')->willReturn($searchCriteriaMock); - $sourceModel->expects($this->atLeastOnce()) - ->method('getSourceId') - ->will($this->returnValue(null)); - - $this->sourceFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($sourceModel)); - - $this->resourceSource->expects($this->once()) + $sourceModel->expects($this->atLeastOnce())->method('getSourceId')->willReturn(null); + $this->sourceFactory->expects($this->once())->method('create')->willReturn($sourceModel); + $this->sourceResource->expects($this->once()) ->method('load') ->with( $sourceModel, @@ -261,78 +228,28 @@ public function testGetErrorExpectsException() SourceInterface::SOURCE_ID ); - $this->setExpectedException(\Magento\Framework\Exception\NoSuchEntityException::class); - - $this->sourceRepository->get($sourceId); + $this->model->get($sourceId); } public function testGetList() { - /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel1 */ - $sourceModel1 = $this->getMock( - \Magento\Inventory\Model\Source::class, - [], - [], - '', - false - ); - - /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel2 */ - $sourceModel2 = $this->getMock( - \Magento\Inventory\Model\Source::class, - [], - [], - '', - false - ); - - $searchCriteria = $this->getMock( - \Magento\Framework\Api\SearchCriteriaInterface::class, - [], - [], - '', - false - ); - - $collection = $this->getMock( - \Magento\Inventory\Model\Resource\Source\Collection::class, - [], - [], - '', - false - ); - - $this->collectionFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($collection)); - + $sourceCollection = $this->getMockBuilder(SourceCollection::class)->disableOriginalConstructor()->getMock(); + $searchResults = $this->getMockBuilder(SourceSearchResultsInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $searchCriteria = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteriaInterface::class) + ->disableOriginalConstructor() + ->getMock(); $sources = [ - $sourceModel1, - $sourceModel2 + $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(), + $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock() ]; - $collection->expects($this->atLeastOnce()) - ->method('getItems') - ->will($this->returnValue($sources)); - - $searchResults = $this->getMock( - \Magento\Inventory\Model\SourceSearchResults::class, - [], - [], - '', - false - ); - - $this->sourceSearchResultsFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($searchResults)); - - $searchResults->expects($this->once()) - ->method('setItems') - ->with($sources); - - $result = $this->sourceRepository->getList($searchCriteria); + $this->collectionFactory->expects($this->once())->method('create')->willReturn($sourceCollection); + $sourceCollection->expects($this->atLeastOnce())->method('getItems')->willReturn($sources); + $this->sourceSearchResultsFactory->expects($this->once())->method('create')->willReturn($searchResults); + $searchResults->expects($this->once())->method('setItems')->with($sources); - $this->assertSame($searchResults, $result); + $this->assertSame($searchResults, $this->model->getList($searchCriteria)); } } diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php deleted file mode 100644 index f78c2e66d9344..0000000000000 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceTest.php +++ /dev/null @@ -1,160 +0,0 @@ -objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->source = $this->objectManager->getObject(Source::class); - } - - - public function testSourceId() - { - $this->source->setSourceId(SourceTest::TEST_ID); - $this->assertEquals($this->source->getSourceId(), SourceTest::TEST_ID); - } - - public function testName() - { - $this->source->setName(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getName(), SourceTest::TEST_STRING); - } - - public function testEmail() - { - $this->source->setEmail(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getEmail(), SourceTest::TEST_STRING); - } - - public function testContactName() - { - $this->source->setContactName(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getContactName(), SourceTest::TEST_STRING); - } - - public function testIsActive() - { - $this->source->setIsActive(SourceTest::TEST_IS_ACTIVE); - $this->assertEquals($this->source->getIsActive(), SourceTest::TEST_IS_ACTIVE); - } - - public function testDescription() - { - $this->source->setDescription(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getDescription(), SourceTest::TEST_STRING); - } - - public function testLatitude() - { - $this->source->setLatitude(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getLatitude(), SourceTest::TEST_STRING); - } - - public function testLongitude() - { - $this->source->setLongitude(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getLongitude(), SourceTest::TEST_STRING); - } - - public function testCountryId() - { - $this->source->setCountryId(SourceTest::TEST_ID); - $this->assertEquals($this->source->getCountryId(), SourceTest::TEST_ID); - } - - public function testRegion() - { - $this->source->setRegion(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getRegion(), SourceTest::TEST_STRING); - } - - public function testCity() - { - $this->source->setCity(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getCity(), SourceTest::TEST_STRING); - } - - public function testStreet() - { - $this->source->setStreet(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getStreet(), SourceTest::TEST_STRING); - } - - public function testPhone() - { - $this->source->setPhone(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getPhone(), SourceTest::TEST_STRING); - } - - public function testPostcode() - { - $this->source->setPostcode(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getPostcode(), SourceTest::TEST_STRING); - } - - public function testFax() - { - $this->source->setFax(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getFax(), SourceTest::TEST_STRING); - } - - public function testPriority() - { - $this->source->setPriority(SourceTest::TEST_STRING); - $this->assertEquals($this->source->getPriority(), SourceTest::TEST_STRING); - } - - public function testCarrierLinks() - { - $carrierLink1 = $this->getMock( - \Magento\Inventory\Model\SourceCarrierLink::class, - [], - [], - '', - false - ); - - $carrierLink2 = $this->getMock( - \Magento\Inventory\Model\SourceCarrierLink::class, - [], - [], - '', - false - ); - - $carrierLinks = [$carrierLink1, $carrierLink2]; - - $this->source->setCarrierLinks($carrierLinks); - $this->assertEquals($carrierLinks, $this->source->getCarrierLinks()); - } - -} From fd83642c374131aefc2ba68389ffadcf30d2d480 Mon Sep 17 00:00:00 2001 From: Sergey Date: Tue, 30 May 2017 16:19:44 +0300 Subject: [PATCH 0094/1004] Issues 6729, 6457, 7362: Configurable product price options provider --- .../Pricing/Price/LowestPriceOptionsProvider.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php index 498a7cac77e56..66bc3db7ee89d 100644 --- a/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php +++ b/app/code/Magento/ConfigurableProduct/Pricing/Price/LowestPriceOptionsProvider.php @@ -63,7 +63,9 @@ public function getProducts(ProductInterface $product) ); $this->linkedProductMap[$product->getId()] = $this->collectionFactory->create() - ->addAttributeToSelect(['price', 'special_price']) + ->addAttributeToSelect( + ['price', 'special_price', 'special_from_date', 'special_to_date', 'tax_class_id'] + ) ->addIdFilter($productIds) ->getItems(); } From 01c969863f39e0b72db5bb0e1d65161172013990 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 2 Jun 2017 17:32:38 +0300 Subject: [PATCH 0095/1004] magento-engcom/magento2#3: Source Management UI - Minor refactoring --- .../Adminhtml/Edit/Button/AbstractButton.php | 76 ------------------- .../Block/Adminhtml/Edit/Button/Back.php | 24 +++++- .../Block/Adminhtml/Edit/Button/Delete.php | 60 ++++++++++++--- .../Block/Adminhtml/Edit/Button/Save.php | 4 +- .../ui_component/inventory_source_form.xml | 59 +++++++------- 5 files changed, 104 insertions(+), 119 deletions(-) delete mode 100644 app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/AbstractButton.php diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/AbstractButton.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/AbstractButton.php deleted file mode 100644 index a84abb8fef602..0000000000000 --- a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/AbstractButton.php +++ /dev/null @@ -1,76 +0,0 @@ -context = $context; - $this->sourceRepository = $sourceRepository; - } - - /** - * - * @return bool - */ - protected function isEditMode() - { - return (bool)$this->getSourceId(); - } - - /** - * Returns the Source Id. - * - * @return null | int - */ - protected function getSourceId() - { - try { - $sourceId = $this->context->getRequest()->getParam('id'); - return $this->sourceRepository->getById($sourceId)->getId(); - } catch (NoSuchEntityException $exception) { - } - return null; - } - - /** - * Generate url by route and parameters - * - * @param string $route - * @param array $params - * @return string - */ - public function getUrl($route = '', $params = []) - { - return $this->context->getUrlBuilder()->getUrl($route, $params); - } -} diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php index e357265402adf..0921b74fe4a3c 100644 --- a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php +++ b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php @@ -6,20 +6,38 @@ namespace Magento\Inventory\Block\Adminhtml\Edit\Button; use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; +use Magento\Framework\UrlInterface; /** * Class Back + * Configures "Back" button on the Source Management Edit form. */ -class Back extends AbstractButton implements ButtonProviderInterface +class Back implements ButtonProviderInterface { /** - * @return array + * @var UrlInterface + */ + private $urlBuilder; + + /** + * @param UrlInterface $urlBuilder + */ + public function __construct( + UrlInterface $urlBuilder + ) { + $this->urlBuilder = $urlBuilder; + } + + /** + * @inheritdoc */ public function getButtonData() { + $backUrl = $this->urlBuilder->getUrl('*/*/'); + return [ 'label' => __('Back'), - 'on_click' => sprintf("location.href = '%s';", $this->getUrl('*/*/')), + 'on_click' => sprintf("location.href = '%s';", $backUrl), 'class' => 'back', 'sort_order' => 10 ]; diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php index c29b343799db5..ff34a817fcd48 100644 --- a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php +++ b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php @@ -6,37 +6,73 @@ namespace Magento\Inventory\Block\Adminhtml\Edit\Button; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\InventoryApi\Api\SourceRepositoryInterface; use Magento\Framework\View\Element\UiComponent\Control\ButtonProviderInterface; +use Magento\Backend\Block\Context; +use Magento\Framework\UrlInterface; /** * Class Delete + * Configures "Delete" button on the Source Management edit form. */ -class Delete extends AbstractButton implements ButtonProviderInterface +class Delete implements ButtonProviderInterface { /** - * @return array + * @var UrlInterface + */ + private $urlBuilder; + + /** + * @var Context + */ + private $context; + + /** + * @var SourceRepositoryInterface + */ + private $sourceRepository; + + /** + * @param UrlInterface $urlBuilder + * @param SourceRepositoryInterface $sourceRepository + * @param Context $context + */ + public function __construct( + UrlInterface $urlBuilder, + SourceRepositoryInterface $sourceRepository, + Context $context + ) { + $this->urlBuilder = $urlBuilder; + $this->sourceRepository = $sourceRepository; + $this->context = $context; + } + + /** + * @inheritdoc */ public function getButtonData() { $data = []; - if ($this->isEditMode()) { + // This part should be refactored. Implemented for test purposes. + try { + $sourceId = $this->context->getRequest()->getParam('id'); + $sourceId = $this->sourceRepository->get($sourceId)->getSourceId(); + + } catch (NoSuchEntityException $exception) { + $sourceId = null; + } + + if ((bool)$sourceId) { + $deleteUrl = $this->urlBuilder->getUrl('*/*/delete', ['id' => $sourceId]); $data = [ 'label' => __('Delete Entry'), 'class' => 'delete', 'on_click' => 'deleteConfirm(\'' . __( 'Are you sure you want to do this?' - ) . '\', \'' . $this->getDeleteUrl() . '\')', + ) . '\', \'' . $deleteUrl . '\')', 'sort_order' => 20, ]; } return $data; } - - /** - * @return string - */ - private function getDeleteUrl() - { - return $this->getUrl('*/*/delete', ['id' => $this->getRateId()]); - } } diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php index 98d320f2f268a..7bdfd9ce7d562 100644 --- a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php +++ b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php @@ -10,10 +10,10 @@ /** * Class Save */ -class Save extends AbstractButton implements ButtonProviderInterface +class Save implements ButtonProviderInterface { /** - * @return array + * @inheritdoc */ public function getButtonData() { diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index 3e99f64b94a2c..f3db5d9aca8c1 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -47,43 +47,50 @@ - + - false - text - input storelocator_form_data_source - source_id + + false + text + source_id + - + - text - Status - select storelocator_form_data_source - 10 - status - - true - false - true - - - - 0 - Inactive - - - 1 - Active - - + + text + + status + + + + From 141fa5efe8008cba70bf76c0ea472624b4546bc7 Mon Sep 17 00:00:00 2001 From: waynemowdirect Date: Fri, 2 Jun 2017 16:12:02 +0100 Subject: [PATCH 0096/1004] testing travis --- forceBuild.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 forceBuild.txt diff --git a/forceBuild.txt b/forceBuild.txt new file mode 100644 index 0000000000000..6dacae433f39f --- /dev/null +++ b/forceBuild.txt @@ -0,0 +1 @@ +forcing From 706513557b506eecc413459eb4ba71e359521197 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 2 Jun 2017 19:03:09 +0300 Subject: [PATCH 0097/1004] magento-engcom/magento2#3: Source Management UI - Minor refactoring --- .../ui_component/inventory_source_form.xml | 8 +-- .../ui_component/inventory_source_listing.xml | 68 +++++++++---------- 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index f3db5d9aca8c1..c2fc3fa608ce0 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -42,11 +42,9 @@
- - - - - + + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml index 8832fa9bbd103..04ceb9e0b1985 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml @@ -9,39 +9,41 @@ inventory_source_listing.inventory_source_listing_data_source - inventory_source_listing.inventory_source_listing_data_source - - inventory_source_listing_columns - - - add - Add New Warehouse - primary - */*/edit - + + + + + inventory_source_listing_columns + + inventory_source_listing.inventory_source_listing_data_source + + - - Magento\Inventory\Ui\Component\Listing\DataProviders\Magento\Inventory\Source - inventory_source_listing_data_source - source_id - id + - - - - source_id - + + Magento_Ui/js/grid/provider - - - - Magento_Ui/js/grid/provider - - + + Magento\Inventory\Ui\Component\Listing\DataProviders\Magento\Inventory\Source + inventory_source_listing_data_source + source_id + id + + + source_id + + + + true @@ -84,7 +86,12 @@ - + + + + select + select + @@ -96,13 +103,6 @@ Inactive - - select - Magento_Ui/js/grid/columns/select - select - Is Active - 35 - From db00a19abe412ee265f5e59e569193cf44583c51 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 2 Jun 2017 19:51:44 +0300 Subject: [PATCH 0098/1004] magento-engcom/magento2#3: Source Management UI - Minor refactoring --- .../Magento/Inventory/etc/adminhtml/menu.xml | 2 +- .../ui_component/inventory_source_listing.xml | 22 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Inventory/etc/adminhtml/menu.xml b/app/code/Magento/Inventory/etc/adminhtml/menu.xml index 87ff2237ffa9a..4843bfc0b9cae 100644 --- a/app/code/Magento/Inventory/etc/adminhtml/menu.xml +++ b/app/code/Magento/Inventory/etc/adminhtml/menu.xml @@ -1,6 +1,6 @@ - + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml index 04ceb9e0b1985..fbb0afd856a82 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml @@ -14,7 +14,7 @@ @@ -91,19 +91,15 @@ select select + + + + - - - - 1 - Active - - - 0 - Inactive - - - From 31f49a62a39e600a70999204153dc53e72b81a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20R=C3=B6ttig?= Date: Mon, 5 Jun 2017 13:39:52 +0200 Subject: [PATCH 0099/1004] Review Fixes --- .../Inventory/Model/SourceRepository.php | 32 ++++++------------- .../Api/SourceRepositoryInterface.php | 2 ++ .../InventoryApi/Api/SourceRepositoryTest.php | 6 ++-- 3 files changed, 14 insertions(+), 26 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index f16ae071906f8..994fee729e2a8 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -117,8 +117,15 @@ public function __construct( public function save(SourceInterface $source) { try { - $this->saveSource($source); - $this->saveSourceCarrierLinks($source); + /** @var SourceInterface|AbstractModel $source */ + $this->resourceSource->save($source); + + /** @var SourceCarrierLinkInterface|AbstractModel $carrierLink */ + foreach ($source->getCarrierLinks() as $carrierLink) { + $carrierLink->setData(SourceInterface::SOURCE_ID, $source->getSourceId()); + $this->resourceSourceCarrierLink->save($carrierLink); + } + return $source->getSourceId(); } catch (\Exception $exception) { $this->logger->error($exception->getMessage()); @@ -126,27 +133,6 @@ public function save(SourceInterface $source) } } - /** - * @param SourceInterface $source - */ - private function saveSource(SourceInterface $source) - { - /** @var SourceInterface|AbstractModel $source */ - $this->resourceSource->save($source); - } - - /** - * @param SourceInterface $source - */ - private function saveSourceCarrierLinks(SourceInterface $source) - { - /** @var SourceCarrierLinkInterface|AbstractModel $carrierLink */ - foreach ($source->getCarrierLinks() as $carrierLink) { - $carrierLink->setData(SourceInterface::SOURCE_ID, $source->getSourceId()); - $this->resourceSourceCarrierLink->save($carrierLink); - } - } - /** * @inheritdoc */ diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index 3bc8947a4cec0..5df65d06cb467 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -16,6 +16,8 @@ interface SourceRepositoryInterface * @param \Magento\InventoryApi\Api\Data\SourceInterface $source * @return int * + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\StateException * @throws \Magento\Framework\Exception\CouldNotSaveException */ public function save(\Magento\InventoryApi\Api\Data\SourceInterface $source); diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index d01340e4ecadd..109ed0dd2c1da 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -14,8 +14,8 @@ use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterfaceFactory; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; -use Magento\TestFramework\TestCase\WebapiAbstract; use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\WebapiAbstract; class SourceRepositoryTest extends WebapiAbstract { @@ -151,7 +151,7 @@ private function createRandomSource($countCarrier = 2, $postcode = '54321', $isA { $country = $this->countryInformationAcquirer->getCountryInfo('US'); $regions = $country->getAvailableRegions(); - $region = $regions[rand(0, count($regions)-1)]; + $region = $regions[mt_rand(0, count($regions)-1)]; $name = 'Api Test ' . uniqid(); $description = 'This is an inventory source created by api-functional tests'; @@ -163,7 +163,7 @@ private function createRandomSource($countCarrier = 2, $postcode = '54321', $isA $phone = '01660002020044'; $latitude = 51.343479; $longitude = 12.387772; - $priority = rand(1,999); + $priority = mt_rand(1,999); $carriers = []; for ($index = 1; $index <= $countCarrier; $index++) { From fe5ced8fd2d4fc4f0625f815efe0ddd0e198f42c Mon Sep 17 00:00:00 2001 From: larsroettig Date: Mon, 5 Jun 2017 15:03:56 +0200 Subject: [PATCH 0100/1004] magento-engcom/magento2#25 Add Bugfix for testGetSourcesList test and complete this test case --- .../InventoryApi/Api/SourceRepositoryTest.php | 39 ++++--------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index 109ed0dd2c1da..0a6b09d7ac2dd 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -264,7 +264,7 @@ public function testGetSource() */ public function testGetSourcesList() { - $this->markTestSkipped('WIP: Search seems to ignore filter criterias!'); + //$this->markTestSkipped('WIP: Search seems to ignore filter criterias!'); /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ $searchCriteriaBuilder = Bootstrap::getObjectManager() @@ -274,7 +274,7 @@ public function testGetSourcesList() $postcode2 = uniqid('APITEST'); $source1 = $this->createRandomSource(2, $postcode1, true); - $source1->setSourceId($this->sourceRepository->save($source1)); + $this->sourceRepository->save($source1); $source2 = $this->createRandomSource(3, $postcode1, false); $this->sourceRepository->save($source2); @@ -285,29 +285,10 @@ public function testGetSourcesList() $source4 = $this->createRandomSource(3, $postcode2, true); $this->sourceRepository->save($source4); - $filter1 = $this->filterBuilder->setField(SourceInterface::POSTCODE) - ->setValue($postcode1); - - $filter2 = $this->filterBuilder->setField(SourceInterface::POSTCODE) - ->setValue($postcode2); - - $filter3 = $this->filterBuilder->setField(SourceInterface::IS_ACTIVE) - ->setValue(true); - - // where postcode = $postcode1 - // or postcode = $postcode2 - // and is_active = true - $searchCriteriaBuilder->addFilters([$filter1, $filter3]); - $searchCriteriaBuilder->addFilters([$filter2, $filter3]); - - $searchCriteriaBuilder->setPageSize(2); - - /** @var SortOrder $sortOrder */ - $sortOrder = $this->sortOrderBuilder->setField(SourceInterface::SOURCE_ID) - ->setDirection(SortOrder::SORT_ASC) - ->create(); - - $searchCriteriaBuilder->setSortOrders([$sortOrder]); + // add filters to find all active items with created postcode + $postcodeFilter = implode(',', [$postcode1, $postcode2]); + $searchCriteriaBuilder->addFilter('postcode', $postcodeFilter, 'in'); + $searchCriteriaBuilder->addFilter('is_active', 1, 'eq'); $searchData = $searchCriteriaBuilder->create()->__toArray(); $requestData = ['searchCriteria' => $searchData]; @@ -324,20 +305,16 @@ public function testGetSourcesList() ], ]; - var_dump($serviceInfo); - $searchResult = $this->_webApiCall($serviceInfo, $requestData); - var_dump($searchResult); - $this->assertEquals(3, $searchResult['page_size']); - $this->assertEquals(2, count($searchResult['items'])); + $this->assertEquals(3, count($searchResult['items'])); $this->assertEquals( $searchResult['items'][0][SourceInterface::SOURCE_ID], $source1->getSourceId() ); $this->assertEquals( $searchResult['items'][1][SourceInterface::SOURCE_ID], - $source2->getSourceId() + $source3->getSourceId() ); } From 385541a3f9ccdc2f8acbfb8c9df5e540a417f79c Mon Sep 17 00:00:00 2001 From: larsroettig Date: Mon, 5 Jun 2017 18:10:51 +0200 Subject: [PATCH 0101/1004] magento-engcom/magento2#25 Add new testcases and bugfix for SourceRepository save method --- .../Model/Resource/SourceCarrierLink.php | 22 +++++ .../Inventory/Model/SourceRepository.php | 31 +++++-- .../InventoryApi/Api/SourceRepositoryTest.php | 93 +++++++++++++++++-- 3 files changed, 127 insertions(+), 19 deletions(-) diff --git a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php index 5c927aa985b09..d3a071265e993 100644 --- a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php @@ -6,6 +6,7 @@ namespace Magento\Inventory\Model\Resource; +use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Inventory\Setup\InstallSchema; @@ -20,4 +21,25 @@ protected function _construct() { $this->_init(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK, 'source_carrier_link_id'); } + + /** + * Delete all source carrier links by sourceId. + * + * @param SourceInterface $sourceId + * + * @throws \Exception + * + * @return $this + */ + public function deleteBySource(SourceInterface $source) + { + $connection = $this->getConnection(); + + $connection->delete( + $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK), + $connection->quoteInto('source_id = ?', $source->getId()) + ); + + return $this; + } } diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 994fee729e2a8..26b7144a09ea0 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -6,23 +6,23 @@ namespace Magento\Inventory\Model; +use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotSaveException; -use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Model\AbstractModel; +use Magento\Inventory\Model\Resource\Source as ResourceSource; +use Magento\Inventory\Model\Resource\Source\CollectionFactory; +use Magento\Inventory\Model\Resource\SourceCarrierLink as ResourceSourceCarrierLink; +use Magento\Inventory\Model\Resource\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterfaceFactory; use Magento\InventoryApi\Api\SourceRepositoryInterface; -use Magento\Inventory\Model\Resource\Source as ResourceSource; -use Magento\Inventory\Model\Resource\SourceCarrierLink as ResourceSourceCarrierLink; -use Magento\Inventory\Model\Resource\Source\CollectionFactory; -use Magento\Inventory\Model\Resource\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; -use \Psr\Log\LoggerInterface; +use Psr\Log\LoggerInterface; /** * Class SourceRepository @@ -120,6 +120,13 @@ public function save(SourceInterface $source) /** @var SourceInterface|AbstractModel $source */ $this->resourceSource->save($source); + if ($source->getCarrierLinks() === null) { + return $source->getSourceId(); + } + + // clean up for the old carrier links + $this->resourceSourceCarrierLink->deleteBySource($source); + /** @var SourceCarrierLinkInterface|AbstractModel $carrierLink */ foreach ($source->getCarrierLinks() as $carrierLink) { $carrierLink->setData(SourceInterface::SOURCE_ID, $source->getSourceId()); @@ -141,7 +148,9 @@ public function get($sourceId) /** @var SourceInterface|AbstractModel $source */ $source = $this->sourceFactory->create(); $this->resourceSource->load($source, $sourceId, SourceInterface::SOURCE_ID); - $this->addCarrierLinks($source); + + $carrierLinks = $this->loadCarrierLinksBySource($source); + $source->setCarrierLinks($carrierLinks); if (!$source->getSourceId()) { throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); @@ -151,9 +160,13 @@ public function get($sourceId) } /** + * Loads the carrier links by given source. + * * @param SourceInterface $source + * + * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] */ - private function addCarrierLinks(SourceInterface $source) + private function loadCarrierLinksBySource(SourceInterface $source) { /** @var ResourceSourceCarrierLink\Collection $collection */ $collection = $this->carrierLinkCollectionFactory->create(); @@ -163,7 +176,7 @@ private function addCarrierLinks(SourceInterface $source) ->create(); $this->collectionProcessor->process($searchCriteria, $collection); - $source->setCarrierLinks($collection->getItems()); + return $collection->getItems(); } /** diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index 0a6b09d7ac2dd..a0dcc2b692913 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -8,7 +8,6 @@ use Magento\Directory\Api\CountryInformationAcquirerInterface; use Magento\Framework\Api\FilterBuilder; use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Framework\Api\SortOrder; use Magento\Framework\Api\SortOrderBuilder; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterfaceFactory; @@ -22,6 +21,7 @@ class SourceRepositoryTest extends WebapiAbstract const SERVICE_VERSION = 'V1'; const SERVICE_NAME = 'inventoryApiSourceRepositoryV1'; const RESOURCE_PATH = '/V1/inventory/source/'; + const TEST_PREFIX = 'SOURCE_APITEST_'; /** * @var SourceInterfaceFactory @@ -153,7 +153,7 @@ private function createRandomSource($countCarrier = 2, $postcode = '54321', $isA $regions = $country->getAvailableRegions(); $region = $regions[mt_rand(0, count($regions)-1)]; - $name = 'Api Test ' . uniqid(); + $name = uniqid(self::TEST_PREFIX, false); $description = 'This is an inventory source created by api-functional tests'; $city = 'Exampletown'; $street = 'Some Street 455'; @@ -197,6 +197,35 @@ private function createRandomSource($countCarrier = 2, $postcode = '54321', $isA return $source; } + /** + * Update the given source in magento + * + * @param SourceInterface $expectedSource + * + * @return int + */ + private function updateSource($expectedSource) + { + $requestData = [ + 'source' => $this->getSourceDataArray($expectedSource) + ]; + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $expectedSource->getSourceId(), + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Save', + ], + ]; + + // call the webservice to update the source + return $this->_webApiCall($serviceInfo, $requestData); + } + /** * Create new Inventory Source using Web API and verify it's integrity. */ @@ -270,8 +299,8 @@ public function testGetSourcesList() $searchCriteriaBuilder = Bootstrap::getObjectManager() ->create(SearchCriteriaBuilder::class); - $postcode1 = uniqid('APITEST'); - $postcode2 = uniqid('APITEST'); + $postcode1 = uniqid(self::TEST_PREFIX, false); + $postcode2 = uniqid(self::TEST_PREFIX, false); $source1 = $this->createRandomSource(2, $postcode1, true); $this->sourceRepository->save($source1); @@ -308,8 +337,7 @@ public function testGetSourcesList() $searchResult = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals(3, count($searchResult['items'])); - $this->assertEquals( - $searchResult['items'][0][SourceInterface::SOURCE_ID], + $this->assertEquals($searchResult['items'][0][SourceInterface::SOURCE_ID], $source1->getSourceId() ); $this->assertEquals( @@ -323,8 +351,33 @@ public function testGetSourcesList() */ public function testUpdateSource() { - //TODO: Implement testUpdateSource - $this->fail(__METHOD__ . " is not implemented yet."); + // create a new source + $expectedSource = $this->createRandomSource(2); + $this->sourceRepository->save($expectedSource); + + // set name and city property's in the source to update them + $expectedName = uniqid('UpdatedName_', false); + $expectedCity = uniqid('UpdatedCity_', false); + $expectedSource->setName($expectedName); + $expectedSource->setCity($expectedCity); + $updateSourceId = $this->updateSource($expectedSource); + + // verify it's integrity + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $updateSourceId, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Get', + ], + ]; + + $result = $this->_webApiCall($serviceInfo, [SourceInterface::SOURCE_ID => $updateSourceId]); + $this->assertEquals($expectedName, $result[SourceInterface::NAME]); + $this->assertEquals($expectedCity, $result[SourceInterface::CITY]); } /** @@ -332,7 +385,27 @@ public function testUpdateSource() */ public function testUpdateSourceWithoutCarriers() { - //TODO: Implement testUpdateSourceWithoutCarriers - $this->fail(__METHOD__ . " is not implemented yet."); + $expectedSource = $this->createRandomSource(2); + $this->sourceRepository->save($expectedSource); + + $carriers = []; + $expectedSource->setCarrierLinks($carriers); + $updateSourceId = $this->updateSource($expectedSource); + + // verify it's integrity + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $updateSourceId, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'Get', + ], + ]; + + $result = $this->_webApiCall($serviceInfo, [SourceInterface::SOURCE_ID => $updateSourceId]); + $this->assertEquals($carriers, $result[SourceInterface::CARRIER_LINKS]); } } From 9aae5e1859e53f41f6917c46395abad112ca6ea2 Mon Sep 17 00:00:00 2001 From: larsroettig Date: Mon, 5 Jun 2017 18:51:03 +0200 Subject: [PATCH 0102/1004] magento-engcom/magento2#25 Add testcase for GetSourcesList with CarrierLinks --- app/code/Magento/Inventory/Model/SourceRepository.php | 8 +++++++- .../Magento/InventoryApi/Api/SourceRepositoryTest.php | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 26b7144a09ea0..56ffd3c0cbfd0 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -196,7 +196,13 @@ public function getList(SearchCriteriaInterface $searchCriteria = null) $searchResults->setSearchCriteria($searchCriteria); } - $searchResults->setItems($collection->getItems()); + /** @var \Magento\InventoryApi\Api\Data\SourceInterface[] $sourceItems */ + $sourceItems = $collection->getItems(); + foreach ($sourceItems as $sourceItem) { + $sourceItem->setCarrierLinks($this->loadCarrierLinksBySource($sourceItem)); + } + + $searchResults->setItems($sourceItems); $searchResults->setTotalCount($collection->getSize()); return $searchResults; } diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index a0dcc2b692913..c3b308928117a 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -344,6 +344,16 @@ public function testGetSourcesList() $searchResult['items'][1][SourceInterface::SOURCE_ID], $source3->getSourceId() ); + + /** @var SourceCarrierLinkInterface[] $carrierLinks */ + $resultCarrierLink = $searchResult['items'][0][SourceInterface::CARRIER_LINKS]; + + $counter = 0; + foreach ($source1->getCarrierLinks() as $carrierLink) { + $carrierCode = $resultCarrierLink[$counter][SourceCarrierLinkInterface::CARRIER_CODE]; + $this->assertEquals($carrierLink->getCarrierCode(), $carrierCode); + $counter++; + } } /** From 73d64422050c0d0ad3ba23a6cd89dece9746fbbc Mon Sep 17 00:00:00 2001 From: larsroettig Date: Mon, 5 Jun 2017 20:19:06 +0200 Subject: [PATCH 0103/1004] magento-engcom/magento2#25 Add Fixes for Review Coments --- app/code/Magento/Inventory/Model/SourceRepository.php | 4 ++-- app/code/Magento/Inventory/Setup/InstallSchema.php | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 56ffd3c0cbfd0..4783834d24e7d 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -117,7 +117,7 @@ public function __construct( public function save(SourceInterface $source) { try { - /** @var SourceInterface|AbstractModel $source */ + /** @var SourceInterface $source */ $this->resourceSource->save($source); if ($source->getCarrierLinks() === null) { @@ -127,7 +127,7 @@ public function save(SourceInterface $source) // clean up for the old carrier links $this->resourceSourceCarrierLink->deleteBySource($source); - /** @var SourceCarrierLinkInterface|AbstractModel $carrierLink */ + /** @var SourceCarrierLinkInterface $carrierLink */ foreach ($source->getCarrierLinks() as $carrierLink) { $carrierLink->setData(SourceInterface::SOURCE_ID, $source->getSourceId()); $this->resourceSourceCarrierLink->save($carrierLink); diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index e3fc9360650fa..d8b7548861588 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -25,7 +25,8 @@ class InstallSchema implements InstallSchemaInterface /** * Constant for decimal precision for latitude and longitude */ - const LATLON_PRECISION = 10; + const LATLON_PRECISION_LAT = 8; + const LATLON_PRECISION_LON = 9; const LATLON_SCALE = 6; /** @@ -118,8 +119,9 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con Table::TYPE_DECIMAL, null, [ - InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION, + InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LAT, InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, + InstallSchema::OPTION_UNSIGNED => false, InstallSchema::OPTION_NULLABLE => true ], 'Latitude' @@ -128,8 +130,9 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con Table::TYPE_DECIMAL, null, [ - InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION, + InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LON, InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, + InstallSchema::OPTION_UNSIGNED => false, InstallSchema::OPTION_NULLABLE => true ], 'Longitude' From f6cbd5b90c32255500ccafae8788713e65396fe7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Mon, 5 Jun 2017 18:58:32 -0300 Subject: [PATCH 0104/1004] Bugfix > Adding Success Message > Recent Ordered --- app/code/Magento/Checkout/Controller/Cart/Addgroup.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Checkout/Controller/Cart/Addgroup.php b/app/code/Magento/Checkout/Controller/Cart/Addgroup.php index 046dd0b8082c1..6c0da47889767 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Addgroup.php +++ b/app/code/Magento/Checkout/Controller/Cart/Addgroup.php @@ -23,6 +23,10 @@ public function execute() foreach ($itemsCollection as $item) { try { $this->cart->addOrderItem($item, 1); + if (!$this->cart->getQuote()->getHasError()) { + $message = __('You added %1 to your shopping cart.', $item->getName()); + $this->messageManager->addSuccessMessage($message); + } } catch (\Magento\Framework\Exception\LocalizedException $e) { if ($this->_checkoutSession->getUseNotice(true)) { $this->messageManager->addNotice($e->getMessage()); From 203320bd760ff7111d2fac39456130faf5421182 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 6 Jun 2017 11:02:09 +0300 Subject: [PATCH 0105/1004] magento-engcom/magento2#25: Source API implementation - Unit tests fixed --- .../Inventory/Test/Unit/Model/SourceRepositoryTest.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index d93181bc57679..6632636d6cb16 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -19,6 +19,7 @@ use Magento\Inventory\Model\Resource\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Inventory\Model\Resource\SourceCarrierLink\Collection as CarrierLinkCollection; /** * Class SourceRepositoryTest @@ -244,12 +245,20 @@ public function testGetList() $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(), $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock() ]; + $carrierLinkCollectionMock = $this->getMockBuilder(CarrierLinkCollection::class) + ->disableOriginalConstructor() + ->getMock(); $this->collectionFactory->expects($this->once())->method('create')->willReturn($sourceCollection); $sourceCollection->expects($this->atLeastOnce())->method('getItems')->willReturn($sources); $this->sourceSearchResultsFactory->expects($this->once())->method('create')->willReturn($searchResults); $searchResults->expects($this->once())->method('setItems')->with($sources); + $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf(); + $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('create')->willReturn($searchCriteria); + $this->carrierLinkCollectionFactory->expects($this->atLeastOnce())->method('create') + ->willReturn($carrierLinkCollectionMock); + $this->assertSame($searchResults, $this->model->getList($searchCriteria)); } } From bceb81bf32c7619f5015412dd0a2e0e688d66716 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 6 Jun 2017 12:02:00 +0300 Subject: [PATCH 0106/1004] magento-engcom/magento2#25: Source API implementation --- composer.json | 2 ++ composer.lock | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 083a4918a5c71..b7e1f146445c3 100644 --- a/composer.json +++ b/composer.json @@ -137,6 +137,8 @@ "magento/module-import-export": "100.2.0-dev", "magento/module-indexer": "100.2.0-dev", "magento/module-integration": "100.2.0-dev", + "magento/module-inventory": "100.0.0-dev", + "magento/module-inventory-api": "100.0.0-dev", "magento/module-layered-navigation": "100.2.0-dev", "magento/module-media-storage": "100.2.0-dev", "magento/module-msrp": "100.2.0-dev", diff --git a/composer.lock b/composer.lock index 119ad0b8059c3..0c57f183a30f0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "468277cb85ede262e3dd3155da88a15a", - "content-hash": "83b07861c465af490d6cf0c75adc78fd", + "hash": "75007f16bc2cd0f07bcadac88243d2ad", + "content-hash": "934bfcd14838f5b573dde3d8c9bd564a", "packages": [ { "name": "braintree/braintree_php", From 9abf23dab44479c7640271b5b8185c571f725180 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 6 Jun 2017 12:48:55 +0300 Subject: [PATCH 0107/1004] magento-engcom/magento2#25: Source API implementation --- .../Model/{Resource => ResourceModel}/Source.php | 2 +- .../Source/Collection.php | 4 ++-- .../SourceCarrierLink.php | 2 +- .../SourceCarrierLink/Collection.php | 4 ++-- app/code/Magento/Inventory/Model/Source.php | 2 +- .../Inventory/Model/SourceCarrierLink.php | 2 +- .../Magento/Inventory/Model/SourceRepository.php | 10 +++++----- .../Magento/Inventory/Setup/InstallSchema.php | 15 ++++++++++----- .../Test/Unit/Model/SourceRepositoryTest.php | 16 ++++++++-------- 9 files changed, 31 insertions(+), 26 deletions(-) rename app/code/Magento/Inventory/Model/{Resource => ResourceModel}/Source.php (90%) rename app/code/Magento/Inventory/Model/{Resource => ResourceModel}/Source/Collection.php (79%) rename app/code/Magento/Inventory/Model/{Resource => ResourceModel}/SourceCarrierLink.php (95%) rename app/code/Magento/Inventory/Model/{Resource => ResourceModel}/SourceCarrierLink/Collection.php (81%) diff --git a/app/code/Magento/Inventory/Model/Resource/Source.php b/app/code/Magento/Inventory/Model/ResourceModel/Source.php similarity index 90% rename from app/code/Magento/Inventory/Model/Resource/Source.php rename to app/code/Magento/Inventory/Model/ResourceModel/Source.php index 2859a5935dd93..44a65dc7fe211 100644 --- a/app/code/Magento/Inventory/Model/Resource/Source.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Source.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Inventory\Model\Resource; +namespace Magento\Inventory\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Inventory\Setup\InstallSchema; diff --git a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php similarity index 79% rename from app/code/Magento/Inventory/Model/Resource/Source/Collection.php rename to app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php index d149d175115e7..a38a23889531a 100644 --- a/app/code/Magento/Inventory/Model/Resource/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php @@ -3,9 +3,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Inventory\Model\Resource\Source; +namespace Magento\Inventory\Model\ResourceModel\Source; -use Magento\Inventory\Model\Resource\Source as ResourceSource; +use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Inventory\Model\Source as SourceModel; diff --git a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php similarity index 95% rename from app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php rename to app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php index d3a071265e993..f639436053956 100644 --- a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Inventory\Model\Resource; +namespace Magento\Inventory\Model\ResourceModel; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; diff --git a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php similarity index 81% rename from app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php rename to app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php index aec2ab9577af3..cb5ecd67a1716 100644 --- a/app/code/Magento/Inventory/Model/Resource/SourceCarrierLink/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php @@ -4,9 +4,9 @@ * See COPYING.txt for license details. */ -namespace Magento\Inventory\Model\Resource\SourceCarrierLink; +namespace Magento\Inventory\Model\ResourceModel\SourceCarrierLink; -use Magento\Inventory\Model\Resource\SourceCarrierLink as ResourceSourceCarrierLink; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as ResourceSourceCarrierLink; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Inventory\Model\SourceCarrierLink as SourceCarrierLinkModel; diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index f07dda86daf6f..7dab07822b39c 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -24,7 +24,7 @@ class Source extends AbstractExtensibleModel implements SourceInterface */ protected function _construct() { - $this->_init(\Magento\Inventory\Model\Resource\Source::class); + $this->_init(\Magento\Inventory\Model\ResourceModel\Source::class); } /** diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php index d79fcbaed25b1..e538e5a74eadd 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php @@ -21,7 +21,7 @@ class SourceCarrierLink extends AbstractExtensibleModel implements SourceCarrier */ protected function _construct() { - $this->_init(\Magento\Inventory\Model\Resource\SourceCarrierLink::class); + $this->_init(\Magento\Inventory\Model\ResourceModel\SourceCarrierLink::class); } /** diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 4783834d24e7d..657e0857f70c9 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -12,10 +12,10 @@ use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Model\AbstractModel; -use Magento\Inventory\Model\Resource\Source as ResourceSource; -use Magento\Inventory\Model\Resource\Source\CollectionFactory; -use Magento\Inventory\Model\Resource\SourceCarrierLink as ResourceSourceCarrierLink; -use Magento\Inventory\Model\Resource\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; +use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; +use Magento\Inventory\Model\ResourceModel\Source\CollectionFactory; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as ResourceSourceCarrierLink; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; @@ -184,7 +184,7 @@ private function loadCarrierLinksBySource(SourceInterface $source) */ public function getList(SearchCriteriaInterface $searchCriteria = null) { - /** @var \Magento\Inventory\Model\Resource\Source\Collection $collection */ + /** @var \Magento\Inventory\Model\ResourceModel\Source\Collection $collection */ $collection = $this->collectionFactory->create(); /** @var SourceSearchResultsInterface $searchResults */ diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index d8b7548861588..05138043575d2 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -1,5 +1,8 @@ disableOriginalConstructor() ->getMock(); $carrierLinkCollectionMock = $this->getMockBuilder( - \Magento\Inventory\Model\Resource\SourceCarrierLink\Collection::class + \Magento\Inventory\Model\ResourceModel\SourceCarrierLink\Collection::class )->disableOriginalConstructor()->getMock(); $this->carrierLinkCollectionFactory->expects($this->atLeastOnce())->method('create') @@ -211,7 +211,7 @@ public function testGetErrorExpectsException() ->disableOriginalConstructor() ->getMock(); $carrierLinkCollectionMock = $this->getMockBuilder( - \Magento\Inventory\Model\Resource\SourceCarrierLink\Collection::class + \Magento\Inventory\Model\ResourceModel\SourceCarrierLink\Collection::class )->disableOriginalConstructor()->getMock(); $this->carrierLinkCollectionFactory->expects($this->atLeastOnce())->method('create') From 705c758bb0eb98177a2276a31d439880419b60e7 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 6 Jun 2017 15:44:37 +0300 Subject: [PATCH 0108/1004] magento-engcom/magento2#25: Source API Implementation -- global refactoring --- .../Model/ResourceModel/Source/Collection.php | 1 - app/code/Magento/Inventory/Model/Source.php | 33 +- .../Inventory/Model/SourceCarrierLink.php | 12 +- .../Inventory/Model/SourceSearchResults.php | 17 - .../Magento/Inventory/Setup/InstallSchema.php | 460 +++++++++--------- app/code/Magento/Inventory/etc/di.xml | 2 +- .../Api/Data/SourceCarrierLinkInterface.php | 8 +- .../InventoryApi/Api/Data/SourceInterface.php | 100 ++-- .../Api/Data/SourceSearchResultsInterface.php | 2 +- .../InventoryApi/Api/SourceRepositoryTest.php | 44 +- 10 files changed, 321 insertions(+), 358 deletions(-) delete mode 100644 app/code/Magento/Inventory/Model/SourceSearchResults.php diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php index a38a23889531a..f36c5e5618bd9 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php @@ -6,7 +6,6 @@ namespace Magento\Inventory\Model\ResourceModel\Source; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; -use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Inventory\Model\Source as SourceModel; diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index 7dab07822b39c..90ac93212c659 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -41,7 +41,6 @@ public function getSourceId() public function setSourceId($sourceId) { $this->setData(SourceInterface::SOURCE_ID, $sourceId); - return $this; } /** @@ -58,7 +57,6 @@ public function getName() public function setName($name) { $this->setData(SourceInterface::NAME, $name); - return $this; } /** @@ -75,7 +73,6 @@ public function getEmail() public function setEmail($email) { $this->setData(SourceInterface::EMAIL, $email); - return $this; } /** @@ -92,24 +89,22 @@ public function getContactName() public function setContactName($contactName) { $this->setData(SourceInterface::CONTACT_NAME, $contactName); - return $this; } /** * @inheritdoc */ - public function getIsActive() + public function isEnabled() { - return $this->getData(SourceInterface::IS_ACTIVE); + return $this->getData(SourceInterface::ENABLED); } /** * @inheritdoc */ - public function setIsActive($active) + public function setEnabled($enabled) { - $this->setData(SourceInterface::IS_ACTIVE, $active); - return $this; + $this->setData(SourceInterface::ENABLED, $enabled); } /** @@ -126,7 +121,6 @@ public function getDescription() public function setDescription($description) { $this->setData(SourceInterface::DESCRIPTION, $description); - return $this; } /** @@ -143,7 +137,6 @@ public function getLatitude() public function setLatitude($latitude) { $this->setData(SourceInterface::LATITUDE, $latitude); - return $this; } /** @@ -160,7 +153,6 @@ public function getLongitude() public function setLongitude($longitude) { $this->setData(SourceInterface::LONGITUDE, $longitude); - return $this; } /** @@ -177,7 +169,6 @@ public function getCountryId() public function setCountryId($countryId) { $this->setData(SourceInterface::COUNTRY_ID, $countryId); - return $this; } /** @@ -194,7 +185,6 @@ public function getRegionId() public function setRegionId($regionId) { $this->setData(SourceInterface::REGION_ID, $regionId); - return $this; } /** @@ -211,7 +201,6 @@ public function getRegion() public function setRegion($region) { $this->setData(SourceInterface::REGION, $region); - return $this; } /** @@ -228,7 +217,6 @@ public function getCity() public function setCity($city) { $this->setData(SourceInterface::CITY, $city); - return $this; } /** @@ -245,7 +233,6 @@ public function getStreet() public function setStreet($street) { $this->setData(SourceInterface::STREET, $street); - return $this; } /** @@ -262,7 +249,6 @@ public function getPostcode() public function setPostcode($postcode) { $this->setData(SourceInterface::POSTCODE, $postcode); - return $this; } /** @@ -279,7 +265,6 @@ public function getPhone() public function setPhone($phone) { $this->setData(SourceInterface::PHONE, $phone); - return $this; } /** @@ -296,7 +281,6 @@ public function getFax() public function setFax($fax) { $this->setData(SourceInterface::FAX, $fax); - return $this; } /** @@ -313,7 +297,6 @@ public function getPriority() public function setPriority($priority) { $this->setData(SourceInterface::PRIORITY, $priority); - return $this; } /** @@ -330,7 +313,6 @@ public function getCarrierLinks() public function setCarrierLinks($carrierLinks) { $this->setData(SourceInterface::CARRIER_LINKS, $carrierLinks); - return $this; } /** @@ -338,7 +320,12 @@ public function setCarrierLinks($carrierLinks) */ public function getExtensionAttributes() { - return $this->_getExtensionAttributes(); + $extensionAttributes = $this->_getExtensionAttributes(); + if (null === $extensionAttributes) { + $extensionAttributes = $this->extensionAttributesFactory->create(SourceInterface::class); + $this->setExtensionAttributes($extensionAttributes); + } + return $extensionAttributes; } /** diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php index e538e5a74eadd..a1f3043a5357c 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php @@ -3,11 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Inventory\Model; use Magento\Framework\Model\AbstractExtensibleModel; -use \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; +use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; /** * @codeCoverageIgnore @@ -38,7 +37,6 @@ public function getCarrierCode() public function setCarrierCode($carrierCode) { $this->setData(SourceCarrierLinkInterface::CARRIER_CODE, $carrierCode); - return $this; } /** @@ -55,7 +53,6 @@ public function getPosition() public function setPosition($position) { $this->setData(SourceCarrierLinkInterface::POSITION, $position); - return $this; } /** @@ -63,7 +60,12 @@ public function setPosition($position) */ public function getExtensionAttributes() { - return $this->_getExtensionAttributes(); + $extensionAttributes = $this->_getExtensionAttributes(); + if (null === $extensionAttributes) { + $extensionAttributes = $this->extensionAttributesFactory->create(SourceCarrierLinkInterface::class); + $this->setExtensionAttributes($extensionAttributes); + } + return $extensionAttributes; } /** diff --git a/app/code/Magento/Inventory/Model/SourceSearchResults.php b/app/code/Magento/Inventory/Model/SourceSearchResults.php deleted file mode 100644 index ed3ebe129d326..0000000000000 --- a/app/code/Magento/Inventory/Model/SourceSearchResults.php +++ /dev/null @@ -1,17 +0,0 @@ -startSetup(); - - $tableNameSourceEntity = $installer->getTable(InstallSchema::TABLE_NAME_SOURCE); - if (!$installer->getConnection()->isTableExists($tableNameSourceEntity)) { - $table = $installer->getConnection()->newTable($tableNameSourceEntity); - - $table->addColumn( - SourceInterface::SOURCE_ID, - Table::TYPE_INTEGER, - null, - [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true - ], - 'Source ID' - )->addColumn( - SourceInterface::NAME, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Source Name' - )->addColumn( - SourceInterface::CONTACT_NAME, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Contact Name' - )->addColumn( - SourceInterface::EMAIL, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Email' - )->addColumn( - SourceInterface::IS_ACTIVE, - Table::TYPE_SMALLINT, - null, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_DEFAULT => 1 - ], - 'Defines Is Source Active' - )->addColumn( - SourceInterface::DESCRIPTION, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Description' - )->addColumn( - SourceInterface::LATITUDE, - Table::TYPE_DECIMAL, - null, - [ - InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LAT, - InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, - InstallSchema::OPTION_UNSIGNED => false, - InstallSchema::OPTION_NULLABLE => true - ], - 'Latitude' - )->addColumn( - SourceInterface::LONGITUDE, - Table::TYPE_DECIMAL, - null, - [ - InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LON, - InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, - InstallSchema::OPTION_UNSIGNED => false, - InstallSchema::OPTION_NULLABLE => true - ], - 'Longitude' - )->addColumn( - SourceInterface::COUNTRY_ID, - Table::TYPE_TEXT, - 30, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Country Id' - )->addColumn( - SourceInterface::REGION_ID, - Table::TYPE_SMALLINT, - null, - [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true - ], - 'Region Id' - )->addColumn( - SourceInterface::REGION, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Region' - )->addColumn( - SourceInterface::CITY, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'City' - )->addColumn( - SourceInterface::STREET, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Street' - )->addColumn( - SourceInterface::POSTCODE, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Postcode' - )->addColumn( - SourceInterface::PHONE, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Phone' - )->addColumn( - SourceInterface::FAX, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Fax' - )->addColumn( - SourceInterface::PRIORITY, - Table::TYPE_SMALLINT, - null, - [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true, - ], - 'Priority' - ); + $setup->startSetup(); + $setup->getConnection()->createTable($this->createSourceTable($setup)); + $setup->getConnection()->createTable($this->createSourceCarrierLinkTable($setup)); + $setup->endSetup(); + } - $table->setComment('Inventory Source Entity Table') - ->setOption('type', 'InnoDB') - ->setOption('charset', 'utf8'); - $installer->getConnection()->createTable($table); - } + /** + * @param SchemaSetupInterface $setup + * @return Table + */ + private function createSourceTable(SchemaSetupInterface $setup) + { + $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE); - $tableNameCarrierLinkEntity = $installer->getTable(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK); - if (!$installer->getConnection()->isTableExists($tableNameCarrierLinkEntity)) { + return $setup->getConnection()->newTable( + $sourceTable + )->setComment( + 'Inventory Source Table' + )->addColumn( + SourceInterface::SOURCE_ID, + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_PRIMARY => true, + ], + 'Source ID' + )->addColumn( + SourceInterface::NAME, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + ], + 'Source Name' + )->addColumn( + SourceInterface::CONTACT_NAME, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => true, + ], + 'Contact Name' + )->addColumn( + SourceInterface::EMAIL, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => true, + ], + 'Email' + )->addColumn( + SourceInterface::ENABLED, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_DEFAULT => 1, + ], + 'Defines Is Source Enabled' + )->addColumn( + SourceInterface::DESCRIPTION, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => true, + ], + 'Description' + )->addColumn( + SourceInterface::LATITUDE, + Table::TYPE_DECIMAL, + null, + [ + InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LAT, + InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, + InstallSchema::OPTION_UNSIGNED => false, + InstallSchema::OPTION_NULLABLE => true, + ], + 'Latitude' + )->addColumn( + SourceInterface::LONGITUDE, + Table::TYPE_DECIMAL, + null, + [ + InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LON, + InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, + InstallSchema::OPTION_UNSIGNED => false, + InstallSchema::OPTION_NULLABLE => true, + ], + 'Longitude' + )->addColumn( + SourceInterface::COUNTRY_ID, + Table::TYPE_TEXT, + 2, + [ + InstallSchema::OPTION_NULLABLE => false, + ], + 'Country Id' + )->addColumn( + SourceInterface::REGION_ID, + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_NULLABLE => true, + InstallSchema::OPTION_UNSIGNED => true, + ], + 'Region Id' + )->addColumn( + SourceInterface::REGION, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => true, + ], + 'Region' + )->addColumn( + SourceInterface::CITY, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => true, + ], + 'City' + )->addColumn( + SourceInterface::STREET, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => true, + ], + 'Street' + )->addColumn( + SourceInterface::POSTCODE, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + ], + 'Postcode' + )->addColumn( + SourceInterface::PHONE, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => true, + ], + 'Phone' + )->addColumn( + SourceInterface::FAX, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => true, + ], + 'Fax' + )->addColumn( + SourceInterface::PRIORITY, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => true, + InstallSchema::OPTION_UNSIGNED => true, + ], + 'Priority' + ); + } - $table = $installer->getConnection()->newTable($tableNameCarrierLinkEntity); - $table->addColumn( - 'source_carrier_link_id', - Table::TYPE_INTEGER, - null, - [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true - ], - 'Source Carrier Link ID' - )->addColumn( - SourceInterface::SOURCE_ID, - Table::TYPE_INTEGER, null, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - ], - 'Source ID' - )->addColumn( - SourceCarrierLinkInterface::CARRIER_CODE, - Table::TYPE_TEXT, 255, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => '' - ], - 'Carrier Code' - )->addColumn( - 'position', Table::TYPE_SMALLINT, - null, - [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - ], - 'Position' - ); + /** + * @param SchemaSetupInterface $setup + * @return Table + */ + private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) + { + $sourceCarrierLinkTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK); + $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE); - // Add foreign key for Pipeline ID field - $foreignKeyName = $installer->getConnection()->getForeignKeyName( - $tableNameCarrierLinkEntity, + return $setup->getConnection()->newTable( + $sourceCarrierLinkTable + )->setComment( + 'Inventory Source Carrier Link Table' + )->addColumn( + 'source_carrier_link_id', + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_PRIMARY => true, + ], + 'Source Carrier Link ID' + )->addColumn( + SourceInterface::SOURCE_ID, + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_UNSIGNED => true, + ], + 'Source ID' + )->addColumn( + SourceCarrierLinkInterface::CARRIER_CODE, + Table::TYPE_TEXT, 255, + [ + InstallSchema::OPTION_NULLABLE => false, + ], + 'Carrier Code' + )->addColumn( + 'position', + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => true, + InstallSchema::OPTION_UNSIGNED => true, + ], + 'Position' + )->addForeignKey( + $setup->getFkName( + $sourceCarrierLinkTable, SourceInterface::SOURCE_ID, - $tableNameCarrierLinkEntity, + $sourceTable, SourceInterface::SOURCE_ID - ); - $table->addForeignKey( - $foreignKeyName, - SourceInterface::SOURCE_ID, - $tableNameSourceEntity, - SourceInterface::SOURCE_ID, - Table::ACTION_CASCADE - ); - - $table->setComment('Inventory Source Carrier Link Entity Table') - ->setOption('type', 'InnoDB') - ->setOption('charset', 'utf8'); - $installer->getConnection()->createTable($table); - } - $setup->endSetup(); + ), + SourceInterface::SOURCE_ID, + $sourceTable, + SourceInterface::SOURCE_ID, + AdapterInterface::FK_ACTION_CASCADE + ); } } diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index f5685c7eb7592..83f969554a86c 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -9,5 +9,5 @@ - + diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index 44bcb68d6b3e4..63c8308411e0a 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -5,7 +5,7 @@ */ namespace Magento\InventoryApi\Api\Data; -use \Magento\Framework\Api\ExtensibleDataInterface; +use Magento\Framework\Api\ExtensibleDataInterface; /** * SourceCarrierLink interface @@ -31,7 +31,7 @@ public function getCarrierCode(); * Set carrier code. * * @param string $carrierCode - * @return $this + * @return void */ public function setCarrierCode($carrierCode); @@ -46,14 +46,14 @@ public function getPosition(); * Set position. * * @param int|null $position - * @return $this + * @return void */ public function setPosition($position); /** * Retrieve existing extension attributes object or create a new one. * - * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface|null + * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface */ public function getExtensionAttributes(); diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php index 0d544391f86a6..e39f2808dbd13 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php @@ -19,7 +19,7 @@ interface SourceInterface extends ExtensibleDataInterface const NAME = 'name'; const CONTACT_NAME = 'contact_name'; const EMAIL = 'email'; - const IS_ACTIVE = 'is_active'; + const ENABLED = 'enabled'; const DESCRIPTION = 'description'; const LATITUDE = 'latitude'; const LONGITUDE = 'longitude'; @@ -46,7 +46,7 @@ public function getSourceId(); * Set source id. * * @param int $sourceId - * @return $this + * @return void */ public function setSourceId($sourceId); @@ -61,37 +61,37 @@ public function getName(); * Set source name. * * @param string $name - * @return $this + * @return void */ public function setName($name); /** * Get source email * - * @return string + * @return string|null */ public function getEmail(); /** * Set source email * - * @param string $email - * @return $this + * @param string|null $email + * @return void */ public function setEmail($email); /** * Get source contact name. * - * @return string + * @return string|null */ public function getContactName(); /** * Set source contact name. * - * @param string $contactName - * @return $this + * @param string|null $contactName + * @return void */ public function setContactName($contactName); @@ -100,58 +100,58 @@ public function setContactName($contactName); * * @return bool */ - public function getIsActive(); + public function isEnabled(); /** * Enable or disable source. * - * @param bool $active - * @return $this + * @param bool $enabled + * @return void */ - public function setIsActive($active); + public function setEnabled($enabled); /** * Get source description. * - * @return string + * @return string|null */ public function getDescription(); /** * Set source description. * - * @param string $description - * @return $this + * @param string|null $description + * @return void */ public function setDescription($description); /** * Get source latitude. * - * @return float + * @return float|null */ public function getLatitude(); /** * Set source latitude. * - * @param float $latitude - * @return $this + * @param float|null $latitude + * @return void */ public function setLatitude($latitude); /** * Get source longitude. * - * @return float + * @return float|null */ public function getLongitude(); /** * Set source longitude. * - * @param float $longitude - * @return $this + * @param float|null $longitude + * @return void */ public function setLongitude($longitude); @@ -166,67 +166,67 @@ public function getCountryId(); * Set source country id. * * @param string $countryId - * @return $this + * @return void */ public function setCountryId($countryId); /** * Get region id if source has registered region. * - * @return int + * @return int|null */ public function getRegionId(); /** * Set region id if source has registered region. * - * @param int $regionId - * @return $this + * @param int|null $regionId + * @return void */ public function setRegionId($regionId); /** * Get region title if source has custom region * - * @return string + * @return string|null */ public function getRegion(); /** * Set source region title. * - * @param string $region - * @return $this + * @param string|null $region + * @return void */ public function setRegion($region); /** * Get source city. * - * @return string + * @return string|null */ public function getCity(); /** * Set source city. * - * @param string $city - * @return $this + * @param string|null $city + * @return void */ public function setCity($city); /** * Get source street name. * - * @return string + * @return string|null */ public function getStreet(); /** * Set source street name. * - * @param string $street - * @return $this + * @param string|null $street + * @return void */ public function setStreet($street); @@ -241,29 +241,29 @@ public function getPostcode(); * Set source post code. * * @param string $postcode - * @return $this + * @return void */ public function setPostcode($postcode); /** * Get source phone number. * - * @return string + * @return string|null */ public function getPhone(); /** * Set source phone number. * - * @param string $phone - * @return $this + * @param string|null $phone + * @return void */ public function setPhone($phone); /** * Get source fax. * - * @return string + * @return string|null */ public function getFax(); @@ -271,7 +271,7 @@ public function getFax(); * Set source fax. * * @param string $fax - * @return $this + * @return void|null */ public function setFax($fax); @@ -286,25 +286,25 @@ public function getPriority(); * Set source priority * * @param int $priority - * @return $this + * @return void */ public function setPriority($priority); /** - * @param \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] $carrierLinks - * @return $this + * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] */ - public function setCarrierLinks($carrierLinks); + public function getCarrierLinks(); /** - * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] + * @param \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] $carrierLinks + * @return void */ - public function getCarrierLinks(); + public function setCarrierLinks($carrierLinks); /** - * Retrieve existing extension attributes object or create a new one. + * Retrieve existing extension attributes object. * - * @return \Magento\InventoryApi\Api\Data\SourceExtensionInterface|null + * @return \Magento\InventoryApi\Api\Data\SourceExtensionInterface */ public function getExtensionAttributes(); @@ -312,7 +312,7 @@ public function getExtensionAttributes(); * Set an extension attributes object. * * @param \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes - * @return $this + * @return void */ public function setExtensionAttributes( \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php index 2a24ead8fe56a..28d9e09569441 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php @@ -23,7 +23,7 @@ public function getItems(); * Set sources list. * * @param \Magento\InventoryApi\Api\Data\SourceInterface[] $items - * @return $this + * @return void */ public function setItems(array $items); } diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index c3b308928117a..0d9f917712285 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -124,7 +124,7 @@ private function getSourceDataArray(SourceInterface $source) SourceInterface::REGION_ID => $source->getRegionId(), SourceInterface::LATITUDE => $source->getLatitude(), SourceInterface::LONGITUDE => $source->getLongitude(), - SourceInterface::IS_ACTIVE => $source->getIsActive(), + SourceInterface::ENABLED => $source->isEnabled(), SourceInterface::PRIORITY => $source->getPriority(), SourceInterface::CARRIER_LINKS => [] ]; @@ -147,7 +147,7 @@ private function getSourceDataArray(SourceInterface $source) * @param string $postcode * @return SourceInterface */ - private function createRandomSource($countCarrier = 2, $postcode = '54321', $isActive = true) + private function createRandomSource($countCarrier = 2, $postcode = '54321', $enabled = true) { $country = $this->countryInformationAcquirer->getCountryInfo('US'); $regions = $country->getAvailableRegions(); @@ -169,30 +169,30 @@ private function createRandomSource($countCarrier = 2, $postcode = '54321', $isA for ($index = 1; $index <= $countCarrier; $index++) { $carrierCode = 'CAR-' . $index; $carrier = $this->sourceCarrierLinkFactory->create(); - $carrier->setPosition($index) - ->setCarrierCode($carrierCode); + $carrier->setPosition($index); + $carrier->setCarrierCode($carrierCode); $carriers[] = $carrier; } /** @var \Magento\InventoryApi\Api\Data\SourceInterface $source */ $source = $this->sourceFactory->create(); - $source->setName($name) - ->setCity($city) - ->setPostcode($postcode) - ->setContactName($contactName) - ->setCountryId($country->getId()) - ->setDescription($description) - ->setEmail($email) - ->setStreet($street) - ->setFax($fax) - ->setPhone($phone) - ->setRegion($region->getName()) - ->setRegionId($region->getId()) - ->setLatitude($latitude) - ->setLongitude($longitude) - ->setIsActive($isActive) - ->setPriority($priority) - ->setCarrierLinks($carriers); + $source->setName($name); + $source->setCity($city); + $source->setPostcode($postcode); + $source->setContactName($contactName); + $source->setCountryId($country->getId()); + $source->setDescription($description); + $source->setEmail($email); + $source->setStreet($street); + $source->setFax($fax); + $source->setPhone($phone); + $source->setRegion($region->getName()); + $source->setRegionId($region->getId()); + $source->setLatitude($latitude); + $source->setLongitude($longitude); + $source->setEnabled($enabled); + $source->setPriority($priority); + $source->setCarrierLinks($carriers); return $source; } @@ -317,7 +317,7 @@ public function testGetSourcesList() // add filters to find all active items with created postcode $postcodeFilter = implode(',', [$postcode1, $postcode2]); $searchCriteriaBuilder->addFilter('postcode', $postcodeFilter, 'in'); - $searchCriteriaBuilder->addFilter('is_active', 1, 'eq'); + $searchCriteriaBuilder->addFilter('enabled', 1, 'eq'); $searchData = $searchCriteriaBuilder->create()->__toArray(); $requestData = ['searchCriteria' => $searchData]; From f3849ccbcd1c18776d7f035e499749492799676e Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 6 Jun 2017 17:54:32 +0300 Subject: [PATCH 0109/1004] magento-engcom/magento2#25: Source API Implementation -- global refactoring --- .../Inventory/Model/ResourceModel/Source.php | 55 ++++++++- .../Model/ResourceModel/Source/Collection.php | 46 ++++++++ .../Model/SourceCarrierLinkManagement.php | 107 ++++++++++++++++++ .../SourceCarrierLinkManagementInterface.php | 34 ++++++ .../Inventory/Model/SourceRepository.php | 105 ++++------------- app/code/Magento/Inventory/etc/di.xml | 1 + .../InventoryApi/Api/Data/SourceInterface.php | 2 +- .../Api/SourceRepositoryInterface.php | 7 +- 8 files changed, 267 insertions(+), 90 deletions(-) create mode 100644 app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php create mode 100644 app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Source.php b/app/code/Magento/Inventory/Model/ResourceModel/Source.php index 44a65dc7fe211..abcfdd180a660 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/Source.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Source.php @@ -3,15 +3,38 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Inventory\Model\ResourceModel; +use Magento\Framework\Model\AbstractModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; +use Magento\Framework\Model\ResourceModel\Db\Context; +use Magento\Inventory\Model\SourceCarrierLinkManagementInterface; use Magento\Inventory\Setup\InstallSchema; use Magento\InventoryApi\Api\Data\SourceInterface; class Source extends AbstractDb { + /** + * @var SourceCarrierLinkManagementInterface + */ + private $sourceCarrierLinkManagement; + + /** + * Source constructor + * + * @param Context $context + * @param SourceCarrierLinkManagementInterface $sourceCarrierLinkManagement + * @param null $connectionName + */ + public function __construct( + Context $context, + SourceCarrierLinkManagementInterface $sourceCarrierLinkManagement, + $connectionName = null + ) { + parent::__construct($context, $connectionName); + $this->sourceCarrierLinkManagement = $sourceCarrierLinkManagement; + } + /** * @inheritdoc */ @@ -19,4 +42,34 @@ protected function _construct() { $this->_init(InstallSchema::TABLE_NAME_SOURCE, SourceInterface::SOURCE_ID); } + + /** + * @inheritdoc + */ + public function load(AbstractModel $object, $value, $field = null) + { + parent::load($object, $value, $field); + /** @var SourceInterface $object */ + $this->sourceCarrierLinkManagement->loadCarrierLinksBySource($object); + return $this; + } + + /** + * @inheritdoc + */ + public function save(AbstractModel $object) + { + $connection = $this->getConnection(); + $connection->beginTransaction(); + try { + parent::save($object); + /** @var SourceInterface $object */ + $this->sourceCarrierLinkManagement->saveCarrierLinksBySource($object); + $connection->commit(); + } catch (\Exception $e) { + $connection->rollBack(); + throw $e; + } + return $this; + } } diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php index f36c5e5618bd9..7e78a2d12cb83 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php @@ -8,9 +8,41 @@ use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Inventory\Model\Source as SourceModel; +use Magento\Inventory\Model\SourceCarrierLinkManagementInterface; +use Magento\InventoryApi\Api\Data\SourceInterface; class Collection extends AbstractCollection { + /** + * @var SourceCarrierLinkManagementInterface + */ + private $sourceCarrierLinkManagement; + + /** + * Collection constructor + * + * @param SourceCarrierLinkManagementInterface $sourceCarrierLinkManagement + */ + public function __construct( + \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, + \Psr\Log\LoggerInterface $logger, + \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, + \Magento\Framework\Event\ManagerInterface $eventManager, + SourceCarrierLinkManagementInterface $sourceCarrierLinkManagement, + \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, + \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null + ) { + parent::__construct( + $entityFactory, + $logger, + $fetchStrategy, + $eventManager, + $connection, + $resource + ); + $this->sourceCarrierLinkManagement = $sourceCarrierLinkManagement; + } + /** * @inheritdoc */ @@ -18,4 +50,18 @@ protected function _construct() { $this->_init(SourceModel::class, ResourceSource::class); } + + /** + * @inheritdoc + */ + public function load($printQuery = false, $logQuery = false) + { + parent::load($printQuery, $logQuery); + + foreach ($this->_items as $item) { + /** @var SourceInterface $item */ + $this->sourceCarrierLinkManagement->loadCarrierLinksBySource($item); + } + return $this; + } } diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php new file mode 100644 index 0000000000000..a8970720cc3f3 --- /dev/null +++ b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php @@ -0,0 +1,107 @@ +connection = $connection; + $this->resourceSourceCarrierLink = $resourceSourceCarrierLink; + $this->collectionProcessor = $collectionProcessor; + $this->carrierLinkCollectionFactory = $carrierLinkCollectionFactory; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + } + + /** + * @inheritdoc + */ + public function saveCarrierLinksBySource(SourceInterface $source) + { + if ($source->getCarrierLinks() !== null) { + $connection = $this->connection->getConnection(); + $connection->delete( + $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK), + $connection->quoteInto('source_id = ?', $source->getSourceId()) + ); + + /** @var SourceCarrierLinkInterface|AbstractModel $carrierLink */ + foreach ($source->getCarrierLinks() as $carrierLink) { + $carrierLink->setData(SourceInterface::SOURCE_ID, $source->getSourceId()); + $this->resourceSourceCarrierLink->save($carrierLink); + } + } + } + + /** + * @inheritdoc + */ + public function loadCarrierLinksBySource(SourceInterface $source) + { + $searchCriteria = $this->searchCriteriaBuilder + ->addFilter(SourceInterface::SOURCE_ID, $source->getSourceId()) + ->create(); + + /** @var ResourceSourceCarrierLink\Collection $collection */ + $collection = $this->carrierLinkCollectionFactory->create(); + $this->collectionProcessor->process($searchCriteria, $collection); + + $source->setCarrierLinks($collection->getItems()); + } +} diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php new file mode 100644 index 0000000000000..9fbcd8dfa0a82 --- /dev/null +++ b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php @@ -0,0 +1,34 @@ +resourceSource = $resourceSource; - $this->resourceSourceCarrierLink = $resourceSourceCarrierLink; $this->sourceFactory = $sourceFactory; $this->collectionProcessor = $collectionProcessor; - $this->collectionFactory = $collectionFactory; - $this->carrierLinkCollectionFactory = $carrierLinkCollectionFactory; + $this->sourceCollectionFactory = $sourceCollectionFactory; $this->sourceSearchResultsFactory = $sourceSearchResultsFactory; $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->logger = $logger; @@ -117,26 +96,12 @@ public function __construct( public function save(SourceInterface $source) { try { - /** @var SourceInterface $source */ + /** @var SourceInterface|AbstractModel $source */ $this->resourceSource->save($source); - - if ($source->getCarrierLinks() === null) { - return $source->getSourceId(); - } - - // clean up for the old carrier links - $this->resourceSourceCarrierLink->deleteBySource($source); - - /** @var SourceCarrierLinkInterface $carrierLink */ - foreach ($source->getCarrierLinks() as $carrierLink) { - $carrierLink->setData(SourceInterface::SOURCE_ID, $source->getSourceId()); - $this->resourceSourceCarrierLink->save($carrierLink); - } - return $source->getSourceId(); } catch (\Exception $exception) { $this->logger->error($exception->getMessage()); - throw new CouldNotSaveException(__('Could not save source')); + throw new CouldNotSaveException(__('Could not save source'), $exception); } } @@ -149,61 +114,31 @@ public function get($sourceId) $source = $this->sourceFactory->create(); $this->resourceSource->load($source, $sourceId, SourceInterface::SOURCE_ID); - $carrierLinks = $this->loadCarrierLinksBySource($source); - $source->setCarrierLinks($carrierLinks); - if (!$source->getSourceId()) { throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); } - return $source; } - /** - * Loads the carrier links by given source. - * - * @param SourceInterface $source - * - * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] - */ - private function loadCarrierLinksBySource(SourceInterface $source) - { - /** @var ResourceSourceCarrierLink\Collection $collection */ - $collection = $this->carrierLinkCollectionFactory->create(); - - $searchCriteria = $this->searchCriteriaBuilder - ->addFilter(SourceInterface::SOURCE_ID, $source->getSourceId()) - ->create(); - - $this->collectionProcessor->process($searchCriteria, $collection); - return $collection->getItems(); - } - /** * @inheritdoc */ public function getList(SearchCriteriaInterface $searchCriteria = null) { - /** @var \Magento\Inventory\Model\ResourceModel\Source\Collection $collection */ - $collection = $this->collectionFactory->create(); + /** @var SourceCollection $collection */ + $collection = $this->sourceCollectionFactory->create(); - /** @var SourceSearchResultsInterface $searchResults */ - $searchResults = $this->sourceSearchResultsFactory->create(); - - // if there is a searchCriteria defined, use it to add its creterias to the collection - if (!is_null($searchCriteria)) { + if (null === $searchCriteria) { + $searchCriteria = $this->searchCriteriaBuilder->create(); + } else { $this->collectionProcessor->process($searchCriteria, $collection); - $searchResults->setSearchCriteria($searchCriteria); - } - - /** @var \Magento\InventoryApi\Api\Data\SourceInterface[] $sourceItems */ - $sourceItems = $collection->getItems(); - foreach ($sourceItems as $sourceItem) { - $sourceItem->setCarrierLinks($this->loadCarrierLinksBySource($sourceItem)); } - $searchResults->setItems($sourceItems); - $searchResults->setTotalCount($collection->getSize()); - return $searchResults; + /** @var SourceSearchResultsInterface $searchResult */ + $searchResult = $this->sourceSearchResultsFactory->create(); + $searchResult->setItems($collection->getItems()); + $searchResult->setTotalCount($collection->getSize()); + $searchResult->setSearchCriteria($searchCriteria); + return $searchResult; } } diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index 83f969554a86c..3c6091ff5561c 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -10,4 +10,5 @@ + diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php index e39f2808dbd13..a391977d0fe76 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php @@ -304,7 +304,7 @@ public function setCarrierLinks($carrierLinks); /** * Retrieve existing extension attributes object. * - * @return \Magento\InventoryApi\Api\Data\SourceExtensionInterface + * @return \Magento\InventoryApi\Api\Data\SourceExtensionInterface|null */ public function getExtensionAttributes(); diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index 5df65d06cb467..3c065576730ed 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -11,7 +11,8 @@ interface SourceRepositoryInterface { /** - * Save Source data. + * Save Source data. If you want to create plugin on get method, also you need to create separate plugin + * on getList method, because entity loading way is different for these methods * * @param \Magento\InventoryApi\Api\Data\SourceInterface $source * @return int @@ -23,7 +24,7 @@ interface SourceRepositoryInterface public function save(\Magento\InventoryApi\Api\Data\SourceInterface $source); /** - * Load Source data by given sourceId. + * Get Source data by given sourceId. * * @param int $sourceId * @return \Magento\InventoryApi\Api\Data\SourceInterface @@ -32,7 +33,7 @@ public function save(\Magento\InventoryApi\Api\Data\SourceInterface $source); public function get($sourceId); /** - * Load Source data collection by given search criteria + * Load Source data collection by given search criteria. * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\InventoryApi\Api\Data\SourceSearchResultsInterface From ee0201ae3b939d046b7e7fbbbc59fe4da0e329ea Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 6 Jun 2017 19:17:41 +0300 Subject: [PATCH 0110/1004] magento-engcom/magento2#25: Source API Implementation -- global refactoring -- fix unit tests --- .../Test/Unit/Model/SourceRepositoryTest.php | 266 +++++++++++------- 1 file changed, 157 insertions(+), 109 deletions(-) diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 58e294cb78d82..6dd646ca93272 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -3,9 +3,9 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Inventory\Test\Unit\Model; +use Magento\Framework\Api\SearchCriteriaInterface; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterfaceFactory; @@ -14,12 +14,8 @@ use Magento\Inventory\Model\ResourceModel\Source as SourceResource; use Magento\Inventory\Model\ResourceModel\Source\CollectionFactory as SourceCollectionFactory; use Magento\Inventory\Model\ResourceModel\Source\Collection as SourceCollection; -use Magento\Inventory\Model\SourceCarrierLink; -use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as ResourceSourceCarrierLink; -use Magento\Inventory\Model\ResourceModel\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Inventory\Model\ResourceModel\SourceCarrierLink\Collection as CarrierLinkCollection; /** * Class SourceRepositoryTest @@ -29,12 +25,7 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var SourceResource|\PHPUnit_Framework_MockObject_MockObject */ - private $sourceResource; - - /** - * @var ResourceSourceCarrierLink|\PHPUnit_Framework_MockObject_MockObject - */ - private $carrierLinkResource; + private $resourceSource; /** * @var SourceInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject @@ -49,18 +40,13 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var SourceCollectionFactory|\PHPUnit_Framework_MockObject_MockObject */ - private $collectionFactory; + private $sourceCollectionFactory; /** * @var SourceSearchResultsInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject */ private $sourceSearchResultsFactory; - /** - * @var CarrierLinkCollectionFactory|\PHPUnit_Framework_MockObject_MockObject - */ - private $carrierLinkCollectionFactory; - /** * @var SearchCriteriaBuilder|\PHPUnit_Framework_MockObject_MockObject */ @@ -71,6 +57,11 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase */ private $loggerMock; + /** + * @var Source|\PHPUnit_Framework_MockObject_MockObject + */ + private $source; + /** * @var \Magento\Inventory\Model\SourceRepository */ @@ -78,14 +69,7 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->sourceResource = $this->getMockBuilder(SourceResource::class)->disableOriginalConstructor()->getMock(); - $this->carrierLinkResource = $this->getMockBuilder(ResourceSourceCarrierLink::class) - ->disableOriginalConstructor() - ->getMock(); - $this->carrierLinkCollectionFactory = $this->getMockBuilder(CarrierLinkCollectionFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); + $this->resourceSource = $this->getMockBuilder(SourceResource::class)->disableOriginalConstructor()->getMock(); $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) ->disableOriginalConstructor() ->getMock(); @@ -97,7 +81,7 @@ protected function setUp() ->disableOriginalConstructor() ->setMethods(['process']) ->getMock(); - $this->collectionFactory = $this->getMockBuilder(SourceCollectionFactory::class) + $this->sourceCollectionFactory = $this->getMockBuilder(SourceCollectionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -108,17 +92,18 @@ protected function setUp() $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class) ->disableOriginalConstructor() ->getMock(); + $this->source = $this->getMockBuilder(Source::class) + ->disableOriginalConstructor() + ->getMock(); $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->model = $objectManager->getObject( \Magento\Inventory\Model\SourceRepository::class, [ - 'resourceSource' => $this->sourceResource, - 'resourceSourceCarrierLink' => $this->carrierLinkResource, + 'resourceSource' => $this->resourceSource, 'sourceFactory' => $this->sourceFactory, 'collectionProcessor' => $this->collectionProcessor, - 'collectionFactory' => $this->collectionFactory, - 'carrierLinkCollectionFactory' => $this->carrierLinkCollectionFactory, + 'sourceCollectionFactory' => $this->sourceCollectionFactory, 'sourceSearchResultsFactory' => $this->sourceSearchResultsFactory, 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, 'logger' => $this->loggerMock, @@ -126,24 +111,20 @@ protected function setUp() ); } - public function testSaveSuccessful() + public function testSave() { $sourceId = 42; - /** @var \Magento\Inventory\Model\Source|\PHPUnit_Framework_MockObject_MockObject $sourceMock */ - $sourceMock = $this->getMockBuilder(\Magento\Inventory\Model\Source::class) - ->disableOriginalConstructor() - ->getMock(); - $carrierLinkMock = $this->getMockBuilder(SourceCarrierLink::class) - ->disableOriginalConstructor() - ->getMock(); - $sourceMock->expects($this->atLeastOnce())->method('getSourceId')->willReturn($sourceId); - $sourceMock->expects($this->atLeastOnce())->method('getCarrierLinks')->willReturn([$carrierLinkMock]); - - $this->sourceResource->expects($this->once())->method('save')->with($sourceMock); - $this->carrierLinkResource->expects($this->once())->method('save')->with($carrierLinkMock); + $this->source + ->expects($this->once()) + ->method('getSourceId') + ->willReturn($sourceId); + $this->resourceSource + ->expects($this->once()) + ->method('save') + ->with($this->source); - $this->assertEquals($sourceId, $this->model->save($sourceMock)); + self::assertEquals($sourceId, $this->model->save($this->source)); } /** @@ -151,51 +132,42 @@ public function testSaveSuccessful() */ public function testSaveErrorExpectsException() { - /** @var Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(); - $this->sourceResource->expects($this->atLeastOnce())->method('save'); - $this->sourceResource->expects($this->atLeastOnce()) + $message = 'some message'; + + $this->resourceSource + ->expects($this->once()) ->method('save') - ->will($this->throwException(new \Exception('Some unit test Exception'))); + ->willThrowException(new \Exception($message)); + + $this->loggerMock + ->expects($this->once()) + ->method('error') + ->with($message); - $this->model->save($sourceModel); + $this->model->save($this->source); } - public function testGetSuccessful() + public function testGet() { $sourceId = 345; - /** @var Source|\PHPUnit_Framework_MockObject_MockObject $sourceMock */ - $sourceMock = $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(); - $searchCriteriaMock = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteria::class) - ->disableOriginalConstructor() - ->getMock(); - $carrierLinkCollectionMock = $this->getMockBuilder( - \Magento\Inventory\Model\ResourceModel\SourceCarrierLink\Collection::class - )->disableOriginalConstructor()->getMock(); - - $this->carrierLinkCollectionFactory->expects($this->atLeastOnce())->method('create') - ->willReturn($carrierLinkCollectionMock); - $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf(); - $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('create')->willReturn($searchCriteriaMock); - - $carrierLinkCollectionMock->expects($this->atLeastOnce())->method('getItems')->willReturn([]); - $sourceMock->expects($this->atLeastOnce())->method('setCarrierLinks')->with([]); - - $sourceMock->expects($this->atLeastOnce()) + $this->source + ->expects($this->once()) ->method('getSourceId') - ->will($this->returnValue($sourceId)); - $this->sourceFactory->expects($this->once())->method('create')->willReturn($sourceMock); - $this->sourceResource->expects($this->once()) + ->willReturn($sourceId); + $this->sourceFactory + ->expects($this->once()) + ->method('create') + ->willReturn($this->source); + $this->resourceSource->expects($this->once()) ->method('load') ->with( - $sourceMock, + $this->source, $sourceId, SourceInterface::SOURCE_ID ); - - $this->assertSame($sourceMock, $this->model->get($sourceId)); + self::assertSame($this->source, $this->model->get($sourceId)); } /** @@ -205,26 +177,18 @@ public function testGetErrorExpectsException() { $sourceId = 345; - /** @var Source|\PHPUnit_Framework_MockObject_MockObject $sourceModel */ - $sourceModel = $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(); - $searchCriteriaMock = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteria::class) - ->disableOriginalConstructor() - ->getMock(); - $carrierLinkCollectionMock = $this->getMockBuilder( - \Magento\Inventory\Model\ResourceModel\SourceCarrierLink\Collection::class - )->disableOriginalConstructor()->getMock(); - - $this->carrierLinkCollectionFactory->expects($this->atLeastOnce())->method('create') - ->willReturn($carrierLinkCollectionMock); - $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf(); - $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('create')->willReturn($searchCriteriaMock); - - $sourceModel->expects($this->atLeastOnce())->method('getSourceId')->willReturn(null); - $this->sourceFactory->expects($this->once())->method('create')->willReturn($sourceModel); - $this->sourceResource->expects($this->once()) + $this->source + ->expects($this->once()) + ->method('getSourceId') + ->willReturn(null); + $this->sourceFactory + ->expects($this->once()) + ->method('create') + ->willReturn($this->source); + $this->resourceSource->expects($this->once()) ->method('load') ->with( - $sourceModel, + $this->source, $sourceId, SourceInterface::SOURCE_ID ); @@ -232,33 +196,117 @@ public function testGetErrorExpectsException() $this->model->get($sourceId); } - public function testGetList() + public function testGetListWithSearchCriteria() { - $sourceCollection = $this->getMockBuilder(SourceCollection::class)->disableOriginalConstructor()->getMock(); - $searchResults = $this->getMockBuilder(SourceSearchResultsInterface::class) + $items = [ + $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(), + $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock() + ]; + $totalCount = 2; + $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) ->disableOriginalConstructor() ->getMock(); - $searchCriteria = $this->getMockBuilder(\Magento\Framework\Api\SearchCriteriaInterface::class) + + $sourceCollection = $this->getMockBuilder(SourceCollection::class) ->disableOriginalConstructor() ->getMock(); - $sources = [ + $sourceCollection + ->expects($this->once()) + ->method('getItems') + ->willReturn($items); + $sourceCollection + ->expects($this->once()) + ->method('getSize') + ->willReturn($totalCount); + $this->sourceCollectionFactory + ->expects($this->once()) + ->method('create') + ->willReturn($sourceCollection); + + $searchResults = $this->getMockBuilder(SourceSearchResultsInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $searchResults + ->expects($this->once()) + ->method('setItems') + ->with($items); + $searchResults + ->expects($this->once()) + ->method('setTotalCount') + ->with($totalCount); + $searchResults + ->expects($this->once()) + ->method('setSearchCriteria') + ->with($searchCriteria); + $this->sourceSearchResultsFactory + ->expects($this->once()) + ->method('create') + ->willReturn($searchResults); + + $this->collectionProcessor + ->expects($this->once()) + ->method('process') + ->with($searchCriteria, $sourceCollection); + + self::assertSame($searchResults, $this->model->getList($searchCriteria)); + } + + public function testGetListWithoutSearchCriteria() + { + $items = [ $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(), $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock() ]; - $carrierLinkCollectionMock = $this->getMockBuilder(CarrierLinkCollection::class) + $totalCount = 2; + + $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) ->disableOriginalConstructor() ->getMock(); + $this->searchCriteriaBuilder + ->expects($this->once()) + ->method('create') + ->willReturn($searchCriteria); - $this->collectionFactory->expects($this->once())->method('create')->willReturn($sourceCollection); - $sourceCollection->expects($this->atLeastOnce())->method('getItems')->willReturn($sources); - $this->sourceSearchResultsFactory->expects($this->once())->method('create')->willReturn($searchResults); - $searchResults->expects($this->once())->method('setItems')->with($sources); - - $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('addFilter')->willReturnSelf(); - $this->searchCriteriaBuilder->expects($this->atLeastOnce())->method('create')->willReturn($searchCriteria); - $this->carrierLinkCollectionFactory->expects($this->atLeastOnce())->method('create') - ->willReturn($carrierLinkCollectionMock); + $sourceCollection = $this->getMockBuilder(SourceCollection::class) + ->disableOriginalConstructor() + ->getMock(); + $sourceCollection + ->expects($this->once()) + ->method('getItems') + ->willReturn($items); + $sourceCollection + ->expects($this->once()) + ->method('getSize') + ->willReturn($totalCount); + $this->sourceCollectionFactory + ->expects($this->once()) + ->method('create') + ->willReturn($sourceCollection); - $this->assertSame($searchResults, $this->model->getList($searchCriteria)); + $searchResults = $this->getMockBuilder(SourceSearchResultsInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $searchResults + ->expects($this->once()) + ->method('setItems') + ->with($items); + $searchResults + ->expects($this->once()) + ->method('setTotalCount') + ->with($totalCount); + $searchResults + ->expects($this->once()) + ->method('setSearchCriteria') + ->with($searchCriteria); + $this->sourceSearchResultsFactory + ->expects($this->once()) + ->method('create') + ->willReturn($searchResults); + + $this->collectionProcessor + ->expects($this->never()) + ->method('process'); + + self::assertSame($searchResults, $this->model->getList()); } } From 8a9de28483c2288b5a3c4b182fb3ddc5be7ab496 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 7 Jun 2017 11:16:50 +0300 Subject: [PATCH 0111/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- .../Model/ResourceModel/Source/Collection.php | 21 +++-- .../Magento/Inventory/Setup/InstallSchema.php | 77 ++++++++++++------- 2 files changed, 67 insertions(+), 31 deletions(-) diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php index 7e78a2d12cb83..533b6fe7647c7 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php @@ -5,11 +5,16 @@ */ namespace Magento\Inventory\Model\ResourceModel\Source; +use Magento\Framework\Data\Collection\EntityFactoryInterface; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; use Magento\Inventory\Model\Source as SourceModel; use Magento\Inventory\Model\SourceCarrierLinkManagementInterface; use Magento\InventoryApi\Api\Data\SourceInterface; +use Psr\Log\LoggerInterface; class Collection extends AbstractCollection { @@ -21,16 +26,22 @@ class Collection extends AbstractCollection /** * Collection constructor * + * @param EntityFactoryInterface $entityFactory + * @param LoggerInterface $logger + * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy + * @param ManagerInterface $eventManager * @param SourceCarrierLinkManagementInterface $sourceCarrierLinkManagement + * @param AdapterInterface $connection + * @param AbstractDb $resource */ public function __construct( - \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, - \Psr\Log\LoggerInterface $logger, + EntityFactoryInterface $entityFactory, + LoggerInterface $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Framework\Event\ManagerInterface $eventManager, + ManagerInterface $eventManager, SourceCarrierLinkManagementInterface $sourceCarrierLinkManagement, - \Magento\Framework\DB\Adapter\AdapterInterface $connection = null, - \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null + AdapterInterface $connection = null, + AbstractDb $resource = null ) { parent::__construct( $entityFactory, diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index 644632b9e7b09..0f1859715ccf4 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -54,7 +54,12 @@ class InstallSchema implements InstallSchemaInterface public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $setup->startSetup(); - $setup->getConnection()->createTable($this->createSourceTable($setup)); + + $sourceTable = $this->createSourceTable($setup); + $sourceTable = $this->addAddressFields($sourceTable); + $sourceTable = $this->addContactInfoFields($sourceTable); + $setup->getConnection()->createTable($sourceTable); + $setup->getConnection()->createTable($this->createSourceCarrierLinkTable($setup)); $setup->endSetup(); } @@ -90,22 +95,6 @@ private function createSourceTable(SchemaSetupInterface $setup) InstallSchema::OPTION_NULLABLE => false, ], 'Source Name' - )->addColumn( - SourceInterface::CONTACT_NAME, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => true, - ], - 'Contact Name' - )->addColumn( - SourceInterface::EMAIL, - Table::TYPE_TEXT, - 255, - [ - InstallSchema::OPTION_NULLABLE => true, - ], - 'Email' )->addColumn( SourceInterface::ENABLED, Table::TYPE_SMALLINT, @@ -147,6 +136,24 @@ private function createSourceTable(SchemaSetupInterface $setup) ], 'Longitude' )->addColumn( + SourceInterface::PRIORITY, + Table::TYPE_SMALLINT, + null, + [ + InstallSchema::OPTION_NULLABLE => true, + InstallSchema::OPTION_UNSIGNED => true, + ], + 'Priority' + ); + } + + /** + * @param Table $sourceTable + * @return Table + */ + private function addAddressFields(Table $sourceTable) + { + $sourceTable->addColumn( SourceInterface::COUNTRY_ID, Table::TYPE_TEXT, 2, @@ -195,32 +202,50 @@ private function createSourceTable(SchemaSetupInterface $setup) InstallSchema::OPTION_NULLABLE => false, ], 'Postcode' + ); + return $sourceTable; + } + + /** + * @param Table $sourceTable + * @return Table + */ + private function addContactInfoFields(Table $sourceTable) + { + $sourceTable->addColumn( + SourceInterface::CONTACT_NAME, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => true, + ], + 'Contact Name' )->addColumn( - SourceInterface::PHONE, + SourceInterface::EMAIL, Table::TYPE_TEXT, 255, [ InstallSchema::OPTION_NULLABLE => true, ], - 'Phone' + 'Email' )->addColumn( - SourceInterface::FAX, + SourceInterface::PHONE, Table::TYPE_TEXT, 255, [ InstallSchema::OPTION_NULLABLE => true, ], - 'Fax' + 'Phone' )->addColumn( - SourceInterface::PRIORITY, - Table::TYPE_SMALLINT, - null, + SourceInterface::FAX, + Table::TYPE_TEXT, + 255, [ InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true, ], - 'Priority' + 'Fax' ); + return $sourceTable; } /** From 73877d2ef9a5f357145570d49fc5a0f67b8174f5 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 7 Jun 2017 11:17:47 +0300 Subject: [PATCH 0112/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests -- fix soap tests --- .../InventoryApi/Api/Data/SourceCarrierLinkInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index 63c8308411e0a..9d0fb91a8d9d0 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -53,7 +53,7 @@ public function setPosition($position); /** * Retrieve existing extension attributes object or create a new one. * - * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface + * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface|null */ public function getExtensionAttributes(); From a0df2b980715a37547ec96116911d336736742f2 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 7 Jun 2017 11:39:00 +0300 Subject: [PATCH 0113/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- app/code/Magento/Inventory/Setup/InstallSchema.php | 3 ++- .../Test/Unit/Model/SourceRepositoryTest.php | 11 ++++------- .../Magento/InventoryApi/Api/SourceRepositoryTest.php | 9 ++++----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index 0f1859715ccf4..fbe20664a8511 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -283,7 +283,8 @@ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) 'Source ID' )->addColumn( SourceCarrierLinkInterface::CARRIER_CODE, - Table::TYPE_TEXT, 255, + Table::TYPE_TEXT, + 255, [ InstallSchema::OPTION_NULLABLE => false, ], diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 6dd646ca93272..291b7ca2e6075 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -18,7 +18,7 @@ use Magento\Framework\Api\SearchCriteriaBuilder; /** - * Class SourceRepositoryTest + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase { @@ -159,13 +159,10 @@ public function testGet() ->expects($this->once()) ->method('create') ->willReturn($this->source); - $this->resourceSource->expects($this->once()) + $this->resourceSource + ->expects($this->once()) ->method('load') - ->with( - $this->source, - $sourceId, - SourceInterface::SOURCE_ID - ); + ->with($this->source, $sourceId, SourceInterface::SOURCE_ID); self::assertSame($this->source, $this->model->get($sourceId)); } diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index 0d9f917712285..7da8904c30919 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -151,7 +151,7 @@ private function createRandomSource($countCarrier = 2, $postcode = '54321', $ena { $country = $this->countryInformationAcquirer->getCountryInfo('US'); $regions = $country->getAvailableRegions(); - $region = $regions[mt_rand(0, count($regions)-1)]; + $region = $regions[mt_rand(0, count($regions) - 1)]; $name = uniqid(self::TEST_PREFIX, false); $description = 'This is an inventory source created by api-functional tests'; @@ -163,7 +163,7 @@ private function createRandomSource($countCarrier = 2, $postcode = '54321', $ena $phone = '01660002020044'; $latitude = 51.343479; $longitude = 12.387772; - $priority = mt_rand(1,999); + $priority = mt_rand(1, 999); $carriers = []; for ($index = 1; $index <= $countCarrier; $index++) { @@ -293,8 +293,6 @@ public function testGetSource() */ public function testGetSourcesList() { - //$this->markTestSkipped('WIP: Search seems to ignore filter criterias!'); - /** @var SearchCriteriaBuilder $searchCriteriaBuilder */ $searchCriteriaBuilder = Bootstrap::getObjectManager() ->create(SearchCriteriaBuilder::class); @@ -337,7 +335,8 @@ public function testGetSourcesList() $searchResult = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals(3, count($searchResult['items'])); - $this->assertEquals($searchResult['items'][0][SourceInterface::SOURCE_ID], + $this->assertEquals( + $searchResult['items'][0][SourceInterface::SOURCE_ID], $source1->getSourceId() ); $this->assertEquals( From 2eb0a778eff4870eabb09e03cd5656e04d053485 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 7 Jun 2017 12:50:02 +0300 Subject: [PATCH 0114/1004] magento-engcom/magento2#25: Source API Implementation -- global refactoring --- .../Model/SourceCarrierLinkManagement.php | 56 +++++++++++++++---- .../SourceCarrierLinkManagementInterface.php | 2 + .../Inventory/Model/SourceRepository.php | 10 +++- .../Api/SourceRepositoryInterface.php | 1 - 4 files changed, 54 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php index a8970720cc3f3..5635df07340c8 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php @@ -8,6 +8,7 @@ use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\App\ResourceConnection; +use Magento\Framework\Exception\StateException; use Magento\Framework\Model\AbstractModel; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as ResourceSourceCarrierLink; @@ -74,21 +75,54 @@ public function __construct( */ public function saveCarrierLinksBySource(SourceInterface $source) { - if ($source->getCarrierLinks() !== null) { - $connection = $this->connection->getConnection(); - $connection->delete( - $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK), - $connection->quoteInto('source_id = ?', $source->getSourceId()) - ); - - /** @var SourceCarrierLinkInterface|AbstractModel $carrierLink */ - foreach ($source->getCarrierLinks() as $carrierLink) { - $carrierLink->setData(SourceInterface::SOURCE_ID, $source->getSourceId()); - $this->resourceSourceCarrierLink->save($carrierLink); + if (is_array($source->getCarrierLinks())) { + try { + $this->deleteCurrentCarrierLinks($source); + if (!empty($source->getCarrierLinks())) { + $this->saveNewCarrierLinks($source); + } + } catch (\Exception $e) { + throw new StateException(__('Could not update Carrier Links'), $e); } } } + /** + * @param SourceInterface $source + * @return void + */ + private function deleteCurrentCarrierLinks(SourceInterface $source) + { + $connection = $this->connection->getConnection(); + $connection->delete( + $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK), + $connection->quoteInto('source_id = ?', $source->getSourceId()) + ); + } + + /** + * @param SourceInterface $source + * @return void + */ + private function saveNewCarrierLinks(SourceInterface $source) + { + $carrierLinkData = []; + /** @var SourceCarrierLinkInterface|AbstractModel $carrierLink */ + foreach ($source->getCarrierLinks() as $carrierLink) { + $carrierLinkData[] = [ + 'source_id' => $source->getSourceId(), + SourceCarrierLinkInterface::CARRIER_CODE => $carrierLink->getCarrierCode(), + SourceCarrierLinkInterface::POSITION => $carrierLink->getPosition(), + ]; + } + + $connection = $this->connection->getConnection(); + $connection->insertMultiple( + $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK), + $carrierLinkData + ); + } + /** * @inheritdoc */ diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php index 9fbcd8dfa0a82..3f5ae25d3d68f 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagementInterface.php @@ -5,6 +5,7 @@ */ namespace Magento\Inventory\Model; +use Magento\Framework\Exception\StateException; use Magento\InventoryApi\Api\Data\SourceInterface; /** @@ -21,6 +22,7 @@ interface SourceCarrierLinkManagementInterface * * @param SourceInterface $source * @return void + * @throws StateException */ public function saveCarrierLinksBySource(SourceInterface $source); diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 014baca7ed044..da4aa5feafc96 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -10,6 +10,7 @@ use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Exception\StateException; use Magento\Framework\Model\AbstractModel; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; use Magento\Inventory\Model\ResourceModel\Source\Collection as SourceCollection; @@ -99,9 +100,12 @@ public function save(SourceInterface $source) /** @var SourceInterface|AbstractModel $source */ $this->resourceSource->save($source); return $source->getSourceId(); - } catch (\Exception $exception) { - $this->logger->error($exception->getMessage()); - throw new CouldNotSaveException(__('Could not save source'), $exception); + } catch (StateException $e) { + $this->logger->error($e->getPrevious()->getMessage()); + throw $e; + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + throw new CouldNotSaveException(__('Could not save source'), $e); } } diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index 3c065576730ed..dc11198fec78a 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -17,7 +17,6 @@ interface SourceRepositoryInterface * @param \Magento\InventoryApi\Api\Data\SourceInterface $source * @return int * - * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\StateException * @throws \Magento\Framework\Exception\CouldNotSaveException */ From 2e2f443726a13307015bfaebd6fe524b18a645b6 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 7 Jun 2017 13:29:20 +0300 Subject: [PATCH 0115/1004] magento-engcom/magento2#25: Source API Implementation -- global refactoring --- app/code/Magento/Inventory/Model/SourceRepository.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index da4aa5feafc96..26c1276431a2e 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -13,7 +13,6 @@ use Magento\Framework\Exception\StateException; use Magento\Framework\Model\AbstractModel; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; -use Magento\Inventory\Model\ResourceModel\Source\Collection as SourceCollection; use Magento\Inventory\Model\ResourceModel\Source\CollectionFactory; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; @@ -129,7 +128,6 @@ public function get($sourceId) */ public function getList(SearchCriteriaInterface $searchCriteria = null) { - /** @var SourceCollection $collection */ $collection = $this->sourceCollectionFactory->create(); if (null === $searchCriteria) { From 7860aed0249ae482e0d10464c0278d2c23906ffe Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 7 Jun 2017 13:30:23 +0300 Subject: [PATCH 0116/1004] magento-engcom/magento2#25: Source API Implementation -- global refactoring --- app/code/Magento/Inventory/Model/SourceRepository.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 26c1276431a2e..da4aa5feafc96 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -13,6 +13,7 @@ use Magento\Framework\Exception\StateException; use Magento\Framework\Model\AbstractModel; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; +use Magento\Inventory\Model\ResourceModel\Source\Collection as SourceCollection; use Magento\Inventory\Model\ResourceModel\Source\CollectionFactory; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; @@ -128,6 +129,7 @@ public function get($sourceId) */ public function getList(SearchCriteriaInterface $searchCriteria = null) { + /** @var SourceCollection $collection */ $collection = $this->sourceCollectionFactory->create(); if (null === $searchCriteria) { From 82ce7efaf913168739139076ef8416f827fc503a Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 7 Jun 2017 15:30:43 +0300 Subject: [PATCH 0117/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- app/code/Magento/Inventory/Model/SourceRepository.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index da4aa5feafc96..b435b07019bb2 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -11,7 +11,6 @@ use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\StateException; -use Magento\Framework\Model\AbstractModel; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; use Magento\Inventory\Model\ResourceModel\Source\Collection as SourceCollection; use Magento\Inventory\Model\ResourceModel\Source\CollectionFactory; @@ -97,7 +96,7 @@ public function __construct( public function save(SourceInterface $source) { try { - /** @var SourceInterface|AbstractModel $source */ + /** @var SourceInterface $source */ $this->resourceSource->save($source); return $source->getSourceId(); } catch (StateException $e) { @@ -114,7 +113,7 @@ public function save(SourceInterface $source) */ public function get($sourceId) { - /** @var SourceInterface|AbstractModel $source */ + /** @var SourceInterface $source */ $source = $this->sourceFactory->create(); $this->resourceSource->load($source, $sourceId, SourceInterface::SOURCE_ID); From 759c935d82109392b91da409a1a316e5ae1ca0ea Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 7 Jun 2017 15:40:54 +0300 Subject: [PATCH 0118/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- app/code/Magento/Inventory/Model/SourceRepository.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index b435b07019bb2..da4aa5feafc96 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -11,6 +11,7 @@ use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\StateException; +use Magento\Framework\Model\AbstractModel; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; use Magento\Inventory\Model\ResourceModel\Source\Collection as SourceCollection; use Magento\Inventory\Model\ResourceModel\Source\CollectionFactory; @@ -96,7 +97,7 @@ public function __construct( public function save(SourceInterface $source) { try { - /** @var SourceInterface $source */ + /** @var SourceInterface|AbstractModel $source */ $this->resourceSource->save($source); return $source->getSourceId(); } catch (StateException $e) { @@ -113,7 +114,7 @@ public function save(SourceInterface $source) */ public function get($sourceId) { - /** @var SourceInterface $source */ + /** @var SourceInterface|AbstractModel $source */ $source = $this->sourceFactory->create(); $this->resourceSource->load($source, $sourceId, SourceInterface::SOURCE_ID); From 9eb37ab6e4293eabfd15604b9def73f2c21461fb Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 8 Jun 2017 13:44:24 +0300 Subject: [PATCH 0119/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- app/code/Magento/Inventory/Model/SourceRepository.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index da4aa5feafc96..6a2316c388fad 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -11,13 +11,10 @@ use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\StateException; -use Magento\Framework\Model\AbstractModel; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; -use Magento\Inventory\Model\ResourceModel\Source\Collection as SourceCollection; use Magento\Inventory\Model\ResourceModel\Source\CollectionFactory; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; -use Magento\InventoryApi\Api\Data\SourceSearchResultsInterface; use Magento\InventoryApi\Api\Data\SourceSearchResultsInterfaceFactory; use Magento\InventoryApi\Api\SourceRepositoryInterface; use Psr\Log\LoggerInterface; @@ -97,7 +94,6 @@ public function __construct( public function save(SourceInterface $source) { try { - /** @var SourceInterface|AbstractModel $source */ $this->resourceSource->save($source); return $source->getSourceId(); } catch (StateException $e) { @@ -114,7 +110,6 @@ public function save(SourceInterface $source) */ public function get($sourceId) { - /** @var SourceInterface|AbstractModel $source */ $source = $this->sourceFactory->create(); $this->resourceSource->load($source, $sourceId, SourceInterface::SOURCE_ID); @@ -129,7 +124,6 @@ public function get($sourceId) */ public function getList(SearchCriteriaInterface $searchCriteria = null) { - /** @var SourceCollection $collection */ $collection = $this->sourceCollectionFactory->create(); if (null === $searchCriteria) { @@ -138,7 +132,6 @@ public function getList(SearchCriteriaInterface $searchCriteria = null) $this->collectionProcessor->process($searchCriteria, $collection); } - /** @var SourceSearchResultsInterface $searchResult */ $searchResult = $this->sourceSearchResultsFactory->create(); $searchResult->setItems($collection->getItems()); $searchResult->setTotalCount($collection->getSize()); From 0626c3571c0458705774c8daa013b6caf530959f Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 8 Jun 2017 16:40:48 +0300 Subject: [PATCH 0120/1004] magento-engcom/magento2#25: Source API Implementation -- index action --- .../Controller/Adminhtml/Source/Index.php | 34 +++++++++++++++++ .../Controller/Adminhtml/Sources/Index.php | 38 ------------------- .../Magento/Inventory/Source.php | 17 --------- ...s_index.xml => inventory_source_index.xml} | 0 4 files changed, 34 insertions(+), 55 deletions(-) create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Source/Index.php delete mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php delete mode 100644 app/code/Magento/Inventory/Ui/Component/Listing/DataProviders/Magento/Inventory/Source.php rename app/code/Magento/Inventory/view/adminhtml/layout/{inventory_sources_index.xml => inventory_source_index.xml} (100%) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Index.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Index.php new file mode 100644 index 0000000000000..94c37beef49a8 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Index.php @@ -0,0 +1,34 @@ +resultFactory->create(ResultFactory::TYPE_PAGE); + $resultPage->setActiveMenu('Magento_Inventory::source') + ->addBreadcrumb(__('Sources'), __('List')); + $resultPage->getConfig()->getTitle()->prepend(__('Manage Sources')); + return $resultPage; + } +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php deleted file mode 100644 index 5715766a854e2..0000000000000 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Index.php +++ /dev/null @@ -1,38 +0,0 @@ -resultPageFactory = $resultPageFactory; - parent::__construct($context); - } - - /** - * @return \Magento\Framework\View\Result\Page - */ - public function execute() - { - return $this->resultPageFactory->create(); - } -} diff --git a/app/code/Magento/Inventory/Ui/Component/Listing/DataProviders/Magento/Inventory/Source.php b/app/code/Magento/Inventory/Ui/Component/Listing/DataProviders/Magento/Inventory/Source.php deleted file mode 100644 index ae95f5f305423..0000000000000 --- a/app/code/Magento/Inventory/Ui/Component/Listing/DataProviders/Magento/Inventory/Source.php +++ /dev/null @@ -1,17 +0,0 @@ -collection = $collectionFactory->create(); - } -} diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_index.xml similarity index 100% rename from app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_index.xml rename to app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_index.xml From 500e55de13674b2c4c1cc4c6794a50a7386b7b9c Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 8 Jun 2017 16:50:09 +0300 Subject: [PATCH 0121/1004] magento-engcom/magento2#25: Source API Implementation --- .../Block/Adminhtml/Edit/Button/Back.php | 45 ------------------- .../Magento/Inventory/etc/adminhtml/menu.xml | 15 ++++++- .../Inventory/etc/adminhtml/routes.xml | 6 +-- .../layout/inventory_source_index.xml | 1 - 4 files changed, 17 insertions(+), 50 deletions(-) delete mode 100644 app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php deleted file mode 100644 index 0921b74fe4a3c..0000000000000 --- a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Back.php +++ /dev/null @@ -1,45 +0,0 @@ -urlBuilder = $urlBuilder; - } - - /** - * @inheritdoc - */ - public function getButtonData() - { - $backUrl = $this->urlBuilder->getUrl('*/*/'); - - return [ - 'label' => __('Back'), - 'on_click' => sprintf("location.href = '%s';", $backUrl), - 'class' => 'back', - 'sort_order' => 10 - ]; - } -} diff --git a/app/code/Magento/Inventory/etc/adminhtml/menu.xml b/app/code/Magento/Inventory/etc/adminhtml/menu.xml index 4843bfc0b9cae..bd4c7e9e1e3f7 100644 --- a/app/code/Magento/Inventory/etc/adminhtml/menu.xml +++ b/app/code/Magento/Inventory/etc/adminhtml/menu.xml @@ -1,6 +1,19 @@ + - + diff --git a/app/code/Magento/Inventory/etc/adminhtml/routes.xml b/app/code/Magento/Inventory/etc/adminhtml/routes.xml index a6d6727d5d568..72e6c53b98575 100644 --- a/app/code/Magento/Inventory/etc/adminhtml/routes.xml +++ b/app/code/Magento/Inventory/etc/adminhtml/routes.xml @@ -1,9 +1,9 @@ diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_index.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_index.xml index 1553f7df01373..a1a413733288f 100644 --- a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_index.xml +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_index.xml @@ -7,7 +7,6 @@ --> - From 4de81a5d788fb986e8742367101b50e42168587c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Thu, 8 Jun 2017 14:33:15 -0300 Subject: [PATCH 0122/1004] escaping the product name --- app/code/Magento/Checkout/Controller/Cart/Addgroup.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Controller/Cart/Addgroup.php b/app/code/Magento/Checkout/Controller/Cart/Addgroup.php index 6c0da47889767..8f4b30f81b8c0 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Addgroup.php +++ b/app/code/Magento/Checkout/Controller/Cart/Addgroup.php @@ -24,7 +24,10 @@ public function execute() try { $this->cart->addOrderItem($item, 1); if (!$this->cart->getQuote()->getHasError()) { - $message = __('You added %1 to your shopping cart.', $item->getName()); + $message = __( + 'You added %1 to your shopping cart.', + $this->escaper->escapeHtml($item->getName()) + ); $this->messageManager->addSuccessMessage($message); } } catch (\Magento\Framework\Exception\LocalizedException $e) { From 193f92b5215e05070b132dfbd2e4f1c8057e1e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Thu, 8 Jun 2017 15:50:01 -0300 Subject: [PATCH 0123/1004] Add the Instance of the Escaper in Cart Controller --- app/code/Magento/Checkout/Controller/Cart.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Checkout/Controller/Cart.php b/app/code/Magento/Checkout/Controller/Cart.php index f6c59562ee942..0a54004442df0 100644 --- a/app/code/Magento/Checkout/Controller/Cart.php +++ b/app/code/Magento/Checkout/Controller/Cart.php @@ -7,6 +7,7 @@ use Magento\Catalog\Controller\Product\View\ViewInterface; use Magento\Checkout\Model\Cart as CustomerCart; +use Magento\Framework\Escaper; /** * Shopping cart controller @@ -38,6 +39,11 @@ abstract class Cart extends \Magento\Framework\App\Action\Action implements View */ protected $cart; + /** + * @var \Magento\Framework\Escaper + */ + protected $escaper; + /** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig @@ -53,13 +59,15 @@ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator, - CustomerCart $cart + CustomerCart $cart, + Escaper $escaper ) { $this->_formKeyValidator = $formKeyValidator; $this->_scopeConfig = $scopeConfig; $this->_checkoutSession = $checkoutSession; $this->_storeManager = $storeManager; - $this->cart = $cart; + $this->cart = $cart; + $this->escaper = $escaper; parent::__construct($context); } From 57c5fedbc1ff1107a8e3094a940139f68419c238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Thu, 8 Jun 2017 15:55:08 -0300 Subject: [PATCH 0124/1004] Add the Instance of the Escaper in Cart Controller Index --- app/code/Magento/Checkout/Controller/Cart/Index.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Controller/Cart/Index.php b/app/code/Magento/Checkout/Controller/Cart/Index.php index 3fb582d35e28a..438fa2b634c0a 100644 --- a/app/code/Magento/Checkout/Controller/Cart/Index.php +++ b/app/code/Magento/Checkout/Controller/Cart/Index.php @@ -21,6 +21,7 @@ class Index extends \Magento\Checkout\Controller\Cart * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator * @param \Magento\Checkout\Model\Cart $cart + * @param \Magento\Framework\Escaper $escaper * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory * @codeCoverageIgnore */ @@ -31,6 +32,7 @@ public function __construct( \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator, \Magento\Checkout\Model\Cart $cart, + \Magento\Framework\Escaper $escaper, \Magento\Framework\View\Result\PageFactory $resultPageFactory ) { parent::__construct( @@ -39,7 +41,8 @@ public function __construct( $checkoutSession, $storeManager, $formKeyValidator, - $cart + $cart, + $escaper ); $this->resultPageFactory = $resultPageFactory; } From 005100ec12f39af1cb555ea5e46b97e23fb471ad Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 9 Jun 2017 14:20:41 +0300 Subject: [PATCH 0125/1004] magento-engcom/magento2#25: Source API Implementation --- .../Ui/Component/Control/SaveSplitButton.php | 112 ++++++++++ .../Component/Listing/Column/EditAction.php | 65 ++++++ .../Block/Adminhtml/Edit/Button/Delete.php | 78 ------- .../Block/Adminhtml/Edit/Button/Save.php | 30 --- .../Controller/Adminhtml/Source/Edit.php | 70 ++++++ .../Controller/Adminhtml/Source/NewAction.php | 30 +++ .../Controller/Adminhtml/Source/Save.php | 131 +++++++++++ .../Controller/Adminhtml/Sources/Edit.php | 39 ---- .../Adminhtml/Sources/NewAction.php | 41 ---- .../Controller/Adminhtml/Sources/Save.php | 40 ---- .../Model/OptionSource/RegionSource.php | 51 +++++ app/code/Magento/Inventory/Model/Source.php | 6 +- .../Magento/Inventory/Setup/InstallSchema.php | 2 +- .../Component/Form/DataProviders/Source.php | 27 --- .../Listing/Columns/SourceActions.php | 44 ---- .../Ui/DataProvider/SourceDataProvider.php | 108 +++++++++ app/code/Magento/Inventory/composer.json | 5 +- .../Magento/Inventory/etc/adminhtml/di.xml | 15 ++ app/code/Magento/Inventory/etc/di.xml | 10 + ...ces_edit.xml => inventory_source_edit.xml} | 1 - ...urces_new.xml => inventory_source_new.xml} | 3 +- .../ui_component/inventory_source_form.xml | 208 ++++++++++++++---- .../ui_component/inventory_source_listing.xml | 205 +++++++++++++---- .../Ui/DataProvider/SearchResultFactory.php | 109 +++++++++ .../CollectionProcessor/SortingProcessor.php | 20 +- 25 files changed, 1054 insertions(+), 396 deletions(-) create mode 100644 app/code/Magento/Backend/Ui/Component/Control/SaveSplitButton.php create mode 100644 app/code/Magento/Backend/Ui/Component/Listing/Column/EditAction.php delete mode 100644 app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php delete mode 100644 app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php delete mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Sources/Edit.php delete mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Sources/NewAction.php delete mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Sources/Save.php create mode 100644 app/code/Magento/Inventory/Model/OptionSource/RegionSource.php delete mode 100644 app/code/Magento/Inventory/Ui/Component/Form/DataProviders/Source.php delete mode 100644 app/code/Magento/Inventory/Ui/Component/Listing/Columns/SourceActions.php create mode 100644 app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php create mode 100644 app/code/Magento/Inventory/etc/adminhtml/di.xml rename app/code/Magento/Inventory/view/adminhtml/layout/{inventory_sources_edit.xml => inventory_source_edit.xml} (93%) rename app/code/Magento/Inventory/view/adminhtml/layout/{inventory_sources_new.xml => inventory_source_new.xml} (83%) create mode 100644 app/code/Magento/Ui/DataProvider/SearchResultFactory.php diff --git a/app/code/Magento/Backend/Ui/Component/Control/SaveSplitButton.php b/app/code/Magento/Backend/Ui/Component/Control/SaveSplitButton.php new file mode 100644 index 0000000000000..c186fffbda19c --- /dev/null +++ b/app/code/Magento/Backend/Ui/Component/Control/SaveSplitButton.php @@ -0,0 +1,112 @@ +saveTarget = $saveTarget; + } + + /** + * {@inheritdoc} + */ + public function getButtonData() + { + return [ + 'label' => __('Save & Continue'), + 'class' => 'save primary', + 'data_attribute' => [ + 'mage-init' => [ + 'buttonAdapter' => [ + 'actions' => [ + [ + 'targetName' => $this->saveTarget, + 'actionName' => 'save', + 'params' => [ + // first param is redirect flag + false, + ] + ] + ] + ] + ] + ], + 'class_name' => Container::SPLIT_BUTTON, + 'options' => $this->getOptions(), + 'sort_order' => 40, + ]; + } + + /** + * @return array + */ + private function getOptions() + { + $options = [ + [ + 'label' => __('Save & Close'), + 'data_attribute' => [ + 'mage-init' => [ + 'buttonAdapter' => [ + 'actions' => [ + [ + 'targetName' => $this->saveTarget, + 'actionName' => 'save', + 'params' => [ + // first param is redirect flag + true, + ], + ], + ], + ], + ], + ], + 'sort_order' => 10, + ], + [ + 'label' => __('Save & New'), + 'data_attribute' => [ + 'mage-init' => [ + 'buttonAdapter' => [ + 'actions' => [ + [ + 'targetName' => $this->saveTarget, + 'actionName' => 'save', + 'params' => [ + // first param is redirect flag, second is data that will be added to post + // request + true, + [ + 'redirect_to_new' => 1, + ], + ], + ], + ], + ], + ], + ], + 'sort_order' => 20, + ], + ]; + return $options; + } +} \ No newline at end of file diff --git a/app/code/Magento/Backend/Ui/Component/Listing/Column/EditAction.php b/app/code/Magento/Backend/Ui/Component/Listing/Column/EditAction.php new file mode 100644 index 0000000000000..366eb9196d0af --- /dev/null +++ b/app/code/Magento/Backend/Ui/Component/Listing/Column/EditAction.php @@ -0,0 +1,65 @@ +urlBuilder = $urlBuilder; + parent::__construct($context, $uiComponentFactory, $components, $data); + } + + /** + * @param array $dataSource + * @return array + */ + public function prepareDataSource(array $dataSource) + { + if (isset($dataSource['data']['items'])) { + foreach ($dataSource['data']['items'] as &$item) { + if (isset($item[$item['id_field_name']])) { + $editUrlPath = $this->getData('config/editUrlPath') ?: '#'; + $item[$this->getData('name')] = [ + 'edit' => [ + 'href' => $this->urlBuilder->getUrl($editUrlPath, [ + $item['id_field_name'] => $item[$item['id_field_name']], + ]), + 'label' => __('Edit') + ] + ]; + unset($item); + } + } + } + return $dataSource; + } +} \ No newline at end of file diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php deleted file mode 100644 index ff34a817fcd48..0000000000000 --- a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Delete.php +++ /dev/null @@ -1,78 +0,0 @@ -urlBuilder = $urlBuilder; - $this->sourceRepository = $sourceRepository; - $this->context = $context; - } - - /** - * @inheritdoc - */ - public function getButtonData() - { - $data = []; - // This part should be refactored. Implemented for test purposes. - try { - $sourceId = $this->context->getRequest()->getParam('id'); - $sourceId = $this->sourceRepository->get($sourceId)->getSourceId(); - - } catch (NoSuchEntityException $exception) { - $sourceId = null; - } - - if ((bool)$sourceId) { - $deleteUrl = $this->urlBuilder->getUrl('*/*/delete', ['id' => $sourceId]); - $data = [ - 'label' => __('Delete Entry'), - 'class' => 'delete', - 'on_click' => 'deleteConfirm(\'' . __( - 'Are you sure you want to do this?' - ) . '\', \'' . $deleteUrl . '\')', - 'sort_order' => 20, - ]; - } - return $data; - } -} diff --git a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php b/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php deleted file mode 100644 index 7bdfd9ce7d562..0000000000000 --- a/app/code/Magento/Inventory/Block/Adminhtml/Edit/Button/Save.php +++ /dev/null @@ -1,30 +0,0 @@ - __('Save Entry'), - 'class' => 'save primary', - 'data_attribute' => [ - 'mage-init' => ['button' => ['event' => 'save']], - 'form-role' => 'save', - ], - 'sort_order' => 90, - ]; - } -} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php new file mode 100644 index 0000000000000..85f0e71d915ed --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php @@ -0,0 +1,70 @@ + + */ +class Edit extends Action +{ + /** + * @see _isAllowed() + */ + const ADMIN_RESOURCE = 'Magento_Inventory::source'; + + /** + * @var SourceRepositoryInterface + */ + private $sourceRepository; + + /** + * @param Context $context + * @param SourceRepositoryInterface $sourceRepository + */ + public function __construct( + Context $context, + SourceRepositoryInterface $sourceRepository + ) { + parent::__construct($context); + $this->sourceRepository = $sourceRepository; + } + + /** + * {@inheritdoc} + */ + public function execute() + { + $sourceId = $this->getRequest()->getParam(SourceInterface::SOURCE_ID); + try { + $source = $this->sourceRepository->get($sourceId); + + /** @var Page $result */ + $result = $this->resultFactory->create(ResultFactory::TYPE_PAGE); + $result->setActiveMenu('Magento_Inventory::source') + ->addBreadcrumb(__('Edit Source'), __('Edit Source')); + $result->getConfig() + ->getTitle() + ->prepend(__('Edit Source: %1', $source->getName())); + } catch (NoSuchEntityException $e) { + /** @var Redirect $result */ + $result = $this->resultRedirectFactory->create(); + $this->messageManager->addErrorMessage( + __('Source with id "%1" does not exist.', $sourceId) + ); + $result->setPath('*/*'); + } + return $result; + } +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php new file mode 100644 index 0000000000000..8c5b8d427df1b --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php @@ -0,0 +1,30 @@ +resultFactory->create(ResultFactory::TYPE_PAGE); + $resultPage->setActiveMenu('Magento_Inventory::source'); + $resultPage->getConfig()->getTitle()->prepend(__('New Source')); + return $resultPage; + } +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php new file mode 100644 index 0000000000000..aead87b56b1d8 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -0,0 +1,131 @@ +sourceFactory = $sourceFactory; + $this->sourceRepository = $sourceRepository; + $this->hydrator = $hydrator; + $this->registry = $registry; + } + + /** + * {@inheritdoc} + */ + public function execute() + { + $resultRedirect = $this->resultRedirectFactory->create(); + $requestData = $this->getRequest()->getParam('general'); + if ($this->getRequest()->isPost() && $requestData) { + try { + $sourceId = !empty($requestData[SourceInterface::SOURCE_ID]) + ? $requestData[SourceInterface::SOURCE_ID] : null; + + if ($sourceId) { + $source = $this->sourceRepository->get($sourceId); + } else { + /** @var SourceInterface $source */ + $source = $this->sourceFactory->create(); + } + $source = $this->hydrator->hydrate($source, $requestData); + $sourceId = $this->sourceRepository->save($source); + // Keep data for plugins on Save controller. Now we can not call separate services from one form. + $this->registry->register(self::REGISTRY_SOURCE_ID_KEY, $sourceId); + + $this->messageManager->addSuccessMessage(__('The Source has been saved.')); + if ($this->getRequest()->getParam('back')) { + $resultRedirect->setPath('*/*/edit', [ + SourceInterface::SOURCE_ID => $sourceId, + '_current' => true, + ]); + } elseif ($this->getRequest()->getParam('redirect_to_new')) { + $resultRedirect->setPath('*/*/new', [ + '_current' => true, + ]); + } else { + $resultRedirect->setPath('*/*/'); + } + } catch (NoSuchEntityException $e) { + $this->messageManager->addErrorMessage(__('The Source does not exist.')); + $resultRedirect->setPath('*/*/'); + } catch (StateException|CouldNotSaveException $e) { + $this->messageManager->addErrorMessage($e->getMessage()); + if (empty($sourceId)) { + $resultRedirect->setPath('*/*/'); + } else { + $resultRedirect->setPath('*/*/edit', [ + SourceInterface::SOURCE_ID => $sourceId, + '_current' => true, + ]); + } + } + } else { + $this->messageManager->addErrorMessage(__('Wrong request.')); + $resultRedirect->setPath('*/*'); + } + return $resultRedirect; + } +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Edit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Edit.php deleted file mode 100644 index f9db914ed656a..0000000000000 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Edit.php +++ /dev/null @@ -1,39 +0,0 @@ -resultPageFactory = $resultPageFactory; - parent::__construct($context); - } - - /** - * @return \Magento\Framework\View\Result\Page - */ - public function execute() - { - return $this->resultPageFactory->create(); - } -} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/NewAction.php b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/NewAction.php deleted file mode 100644 index 8b8d423b53cf7..0000000000000 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/NewAction.php +++ /dev/null @@ -1,41 +0,0 @@ -resultForwardFactory = $resultForwardFactory; - parent::__construct($context, $coreRegistry); - } - - /** - * Create new CMS block - * - * @return \Magento\Framework\Controller\ResultInterface - */ - public function execute() - { - /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ - $resultForward = $this->resultForwardFactory->create(); - return $resultForward->forward('edit'); - } -} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Save.php deleted file mode 100644 index 4d22db6c27043..0000000000000 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Sources/Save.php +++ /dev/null @@ -1,40 +0,0 @@ -resultPageFactory = $resultPageFactory; - parent::__construct($context); - } - - /** - * @return \Magento\Framework\View\Result\Page - */ - public function execute() - { - - } -} diff --git a/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php b/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php new file mode 100644 index 0000000000000..7e9a63093422f --- /dev/null +++ b/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php @@ -0,0 +1,51 @@ +regionCollectionFactory = $regionCollectionFactory; + } + + /** + * {@inheritdoc} + */ + public function toOptionArray() + { + if (null === $this->sourceData) { + $regionCollection = $this->regionCollectionFactory->create(); + $this->sourceData = $regionCollection->toOptionArray(); + } + return $this->sourceData; + } +} \ No newline at end of file diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index 90ac93212c659..087d60badfb8e 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -3,17 +3,13 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Inventory\Model; use Magento\Framework\Model\AbstractExtensibleModel; use \Magento\InventoryApi\Api\Data\SourceInterface; /** - * Class Source, - * provides implementation of the SourceInterface which adds the possibility - * for a Merchant to map existing physical sources to some particular sales channels - * this model holds the information like name and description of this physical sources. + * Class Source * * @codeCoverageIgnore */ diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index fbe20664a8511..bd386d47e81cc 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -108,7 +108,7 @@ private function createSourceTable(SchemaSetupInterface $setup) )->addColumn( SourceInterface::DESCRIPTION, Table::TYPE_TEXT, - 255, + 1000, [ InstallSchema::OPTION_NULLABLE => true, ], diff --git a/app/code/Magento/Inventory/Ui/Component/Form/DataProviders/Source.php b/app/code/Magento/Inventory/Ui/Component/Form/DataProviders/Source.php deleted file mode 100644 index 76c89b9408e44..0000000000000 --- a/app/code/Magento/Inventory/Ui/Component/Form/DataProviders/Source.php +++ /dev/null @@ -1,27 +0,0 @@ -collection = $collectionFactory->create(); - } - - /** - * Get data - * - * @return array - */ - public function getData() - { - return []; - } -} diff --git a/app/code/Magento/Inventory/Ui/Component/Listing/Columns/SourceActions.php b/app/code/Magento/Inventory/Ui/Component/Listing/Columns/SourceActions.php deleted file mode 100644 index 2dcfe789a8aa1..0000000000000 --- a/app/code/Magento/Inventory/Ui/Component/Listing/Columns/SourceActions.php +++ /dev/null @@ -1,44 +0,0 @@ -getData("name"); - $id = "X"; - - if (isset($item[SourceInterface::SOURCE_ID])) { - $id = $item[SourceInterface::SOURCE_ID]; - } - - $href = $this->getContext()->getUrl( - "inventory/sources/edit", - [SourceInterface::SOURCE_ID => $id] - ); - - $item[$name]["view"] = [ - "href" => $href, - "label" => __("Edit") - ]; - } - } - return $dataSource; - } -} diff --git a/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php new file mode 100644 index 0000000000000..d33bb12defb38 --- /dev/null +++ b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php @@ -0,0 +1,108 @@ +sourceRepository = $sourceRepository; + $this->searchResultFactory = $searchResultFactory; + } + + /** + * {@inheritdoc} + */ + public function getData() + { + $data = parent::getData(); + if ('inventory_source_form_data_source' === $this->name) { + // It is need for support of several fieldsets. + // For details see \Magento\Ui\Component\Form::getDataSourceData + if ($data['totalRecords'] > 0) { + $sourceId = $data['items'][0][SourceInterface::SOURCE_ID]; + $dataForSingle[$sourceId] = [ + 'general' => $data['items'][0], + ]; + $data = $dataForSingle; + } else { + $data = []; + } + } + return $data; + } + + /** + * {@inheritdoc} + */ + public function getSearchResult() + { + $searchCriteria = $this->getSearchCriteria(); + $result = $this->sourceRepository->getList($searchCriteria); + + $searchResult = $this->searchResultFactory->create( + $result->getItems(), + $result->getTotalCount(), + $searchCriteria, + SourceInterface::SOURCE_ID + ); + return $searchResult; + } +} diff --git a/app/code/Magento/Inventory/composer.json b/app/code/Magento/Inventory/composer.json index 2d2c539770841..7e3523d226c19 100644 --- a/app/code/Magento/Inventory/composer.json +++ b/app/code/Magento/Inventory/composer.json @@ -4,7 +4,10 @@ "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", "magento/framework": "100.2.*", - "magento/module-inventory-api": "100.0.*" + "magento/module-inventory-api": "100.0.*", + "magento/module-backend": "100.2.0-dev", + "magento/module-directory": "100.2.0-dev", + "magento/module-ui": "100.2.0-dev" }, "type": "magento2-module", "version": "100.0.0-dev", diff --git a/app/code/Magento/Inventory/etc/adminhtml/di.xml b/app/code/Magento/Inventory/etc/adminhtml/di.xml new file mode 100644 index 0000000000000..f1989475949e0 --- /dev/null +++ b/app/code/Magento/Inventory/etc/adminhtml/di.xml @@ -0,0 +1,15 @@ + + + + + + + inventory_source_form.inventory_source_form + + + diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index 3c6091ff5561c..57c3414ce62b8 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -11,4 +11,14 @@ + + + + + Magento\Inventory\Setup\InstallSchema::TABLE_NAME_SOURCE + Magento\InventoryApi\Api\Data\SourceInterface::SOURCE_ID + + + + diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_edit.xml similarity index 93% rename from app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml rename to app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_edit.xml index 5da8a215da176..8944441fd6930 100644 --- a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_edit.xml +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_edit.xml @@ -7,7 +7,6 @@ --> - diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_new.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_new.xml similarity index 83% rename from app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_new.xml rename to app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_new.xml index 139a4b22b9e67..68d4c1c00309a 100644 --- a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_sources_new.xml +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_source_new.xml @@ -7,6 +7,5 @@ --> - - + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index c2fc3fa608ce0..6783210b0c090 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -5,24 +5,32 @@ * See COPYING.txt for license details. */ --> -
+ inventory_source_form.inventory_source_form_data_source - General Information + Source Information templates/form/collapsible - - + + inventory_source_listing_columns @@ -24,26 +24,20 @@ inventory_source_listing.inventory_source_listing_data_source
- - - - - Magento_Ui/js/grid/provider - - + + + + source_id + + + + - Magento\Inventory\Ui\Component\Listing\DataProviders\Magento\Inventory\Source - inventory_source_listing_data_source - source_id id - - - source_id - + source_id - true @@ -51,7 +45,18 @@ - + + + + + + + + + @@ -84,26 +89,20 @@ text - -
- - - - select - select - - - - + + text + + true + + text + + text + false @@ -111,23 +110,57 @@ text + + text + + true + + false - + + + + select + select + + + + + + + text - + + text + + true + + + false - + + text + + text + + true + + + false - select - select - @@ -138,10 +171,100 @@ - + - source_id + false + select + select + + + + + + text + + false + + + + + text + + text + + + false + + + + + text + + text + + + false + + + + + text + + text + + true + + + + false + + + + text + + text + + true + + + + false + + + + + text + + text + + true + + + + false + + + + + text + + text + + true + + + + + + + + + + source_id + inventory/source/edit + + diff --git a/app/code/Magento/Ui/DataProvider/SearchResultFactory.php b/app/code/Magento/Ui/DataProvider/SearchResultFactory.php new file mode 100644 index 0000000000000..d86c4c828a58e --- /dev/null +++ b/app/code/Magento/Ui/DataProvider/SearchResultFactory.php @@ -0,0 +1,109 @@ +hydrator = $hydrator; + $this->documentFactory = $documentFactory; + $this->searchResultFactory = $searchResultFactory; + $this->attributeValueFactory = $attributeValueFactory; + } + + /** + * @param array $items + * @param int $totalCount + * @param SearchCriteriaInterface SearchCriteriaInterface $searchCriteria + * @param string $idFieldName + * @return SearchResultInterface + */ + public function create(array $items, $totalCount, SearchCriteriaInterface $searchCriteria, $idFieldName) + { + $documents = []; + foreach ($items as $item) { + $itemData = $this->hydrator->extract($item); + $itemId = $itemData[$idFieldName]; + $attributes = $this->createAttributes($idFieldName, $itemData); + + $document = $this->documentFactory->create(); + $document->setId($itemId); + $document->setCustomAttributes($attributes); + $documents[] = $document; + } + + $searchResult = $this->searchResultFactory->create(); + $searchResult->setItems($documents); + $searchResult->setTotalCount($totalCount); + $searchResult->setSearchCriteria($searchCriteria); + return $searchResult; + } + + /** + * @param string $idFieldName + * @param array $itemData + * @return array + */ + private function createAttributes($idFieldName, $itemData) + { + $attributes = []; + + $idFieldNameAttribute = $this->attributeValueFactory->create(); + $idFieldNameAttribute->setAttributeCode('id_field_name'); + $idFieldNameAttribute->setValue($idFieldName); + $attributes[] = $idFieldNameAttribute; + + foreach ($itemData as $key => $value) { + $attribute = $this->attributeValueFactory->create(); + $attribute->setAttributeCode($key); + if (is_bool($value)) { + // for proper work of form and grid (for example for Yes/No properties) + $value = (string)(int)$value; + } + $attribute->setValue($value); + $attributes[] = $attribute; + } + return $attributes; + } +} diff --git a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php index 8a69f7123781a..85a6d6f570d5e 100644 --- a/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php +++ b/lib/internal/Magento/Framework/Api/SearchCriteria/CollectionProcessor/SortingProcessor.php @@ -74,10 +74,12 @@ private function applyOrders(array $sortOrders, AbstractDb $collection) /** @var SortOrder $sortOrder */ foreach ($sortOrders as $sortOrder) { $field = $this->getFieldMapping($sortOrder->getField()); - $order = $sortOrder->getDirection() == SortOrder::SORT_ASC - ? Collection::SORT_ORDER_ASC - : Collection::SORT_ORDER_DESC; - $collection->addOrder($field, $order); + if (null !== $field) { + $order = $sortOrder->getDirection() == SortOrder::SORT_ASC + ? Collection::SORT_ORDER_ASC + : Collection::SORT_ORDER_DESC; + $collection->addOrder($field, $order); + } } } @@ -91,10 +93,12 @@ private function applyDefaultOrders(AbstractDb $collection) { foreach ($this->defaultOrders as $field => $direction) { $field = $this->getFieldMapping($field); - $order = $direction == SortOrder::SORT_ASC - ? Collection::SORT_ORDER_ASC - : Collection::SORT_ORDER_DESC; - $collection->addOrder($field, $order); + if (null !== $field) { + $order = $direction == SortOrder::SORT_ASC + ? Collection::SORT_ORDER_ASC + : Collection::SORT_ORDER_DESC; + $collection->addOrder($field, $order); + } } } } From e14a5d5c0442cf9b4ab56d1f4829ec0b394f0beb Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 9 Jun 2017 18:14:54 +0300 Subject: [PATCH 0126/1004] magento-engcom/magento2#25: Source API Implementation --- .../ui_component/inventory_source_form.xml | 95 +++++++++++++++++++ .../ui_component/inventory_source_listing.xml | 35 ++++--- 2 files changed, 117 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index 6783210b0c090..9b85e8223e7ab 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -53,14 +53,21 @@ true true + general + + + source + + true text + name @@ -73,6 +80,7 @@ boolean + enabled @@ -87,39 +95,63 @@ + + + source + + 1000 text + description + + + source + + true number + latitude + + + source + + true number + longitude + + + source + + true number + priority
@@ -128,38 +160,63 @@ true false + general + + + source + + text + contact_name + + + source + + true text + email + + + source + + true text + phone + + + source + + true text + fax @@ -168,11 +225,18 @@ true false + general + + + source + + text + country_id @@ -196,27 +266,52 @@ + + + source + + text + region + + + source + + text + city + + + source + + text + street + + + source + Magento_Ui/js/form/element/post-code + + text + postcode true diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml index 60c511523b730..ab2b875c3feff 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml @@ -57,22 +57,31 @@ - - - - - Delete selected items? - Delete items - - - delete - - - - + + + + + + false + + source_id + true + inventory_source_listing.inventory_source_listing.inventory_source_listing_columns.ids + + + + inventory_source_listing.inventory_source_listing.inventory_source_listing_columns_editor + startEdit + + ${ $.$data.rowIndex } + true + + + + source_id From 3c9b7ba5f8b3135b4f9b6f92c7026e25dbbec25f Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 9 Jun 2017 18:21:52 +0300 Subject: [PATCH 0127/1004] magento-engcom/magento2#25: Source API Implementation --- .../ui_component/inventory_source_form.xml | 92 ------------------- 1 file changed, 92 deletions(-) diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index 9b85e8223e7ab..5728b4040954e 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -56,18 +56,12 @@ general - - - source - - true text - name @@ -80,7 +74,6 @@ boolean - enabled @@ -95,63 +88,39 @@ - - - source - - 1000 text - description - - - source - - true number - latitude - - - source - - true number - longitude - - - source - - true number - priority @@ -163,60 +132,36 @@ general - - - source - - text - contact_name - - - source - - true text - email - - - source - - true text - phone - - - source - - true text - fax @@ -228,15 +173,9 @@ general - - - source - - text - country_id @@ -266,52 +199,27 @@ - - - source - - text - region - - - source - - text - city - - - source - - text - street - - - source - Magento_Ui/js/form/element/post-code - - text - postcode true From 6b652724dd4c16f6dc2a97be8dd6faca0d292437 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 9 Jun 2017 18:24:24 +0300 Subject: [PATCH 0128/1004] magento-engcom/magento2#25: Source API Implementation add InlineEdit controller --- .../Adminhtml/Source/InlineEdit.php | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php new file mode 100644 index 0000000000000..cffa6d2b87d77 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php @@ -0,0 +1,94 @@ + + */ +class InlineEdit extends Action +{ + /** + * @see _isAllowed() + */ + const ADMIN_RESOURCE = 'Magento_Inventory::source'; + + /** + * @var HydratorInterface + */ + private $hydrator; + + /** + * @var SourceRepositoryInterface + */ + private $sourceRepository; + + /** + * @param Context $context + * @param HydratorInterface $hydrator + * @param SourceRepositoryInterface $sourceRepository + */ + public function __construct( + Context $context, + HydratorInterface $hydrator, + SourceRepositoryInterface $sourceRepository + ) { + parent::__construct($context); + $this->hydrator = $hydrator; + $this->sourceRepository = $sourceRepository; + } + + /** + * {@inheritdoc} + */ + public function execute() + { + $errorMessages = []; + $request = $this->getRequest(); + $requestData = $request->getParam('items', []); + + if ($request->isXmlHttpRequest() && $request->isPost() && $requestData) { + foreach ($requestData as $itemData) { + try { + $source = $this->sourceRepository->get( + $itemData[SourceInterface::SOURCE_ID] + ); + $source = $this->hydrator->hydrate($source, $itemData); + $this->sourceRepository->save($source); + } catch (StateException|NoSuchEntityException $e) { + $errorMessages[] = __( + '[ID: %1] The Source does not exist.', + $itemData[SourceInterface::SOURCE_ID] + ); + } catch (CouldNotSaveException $e) { + $errorMessages[] = + __('[ID: %1] ', $itemData[SourceInterface::SOURCE_ID]) + . $e->getMessage(); + } + } + } else { + $errorMessages[] = __('Please correct the data sent.'); + } + + /** @var Json $resultJson */ + $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON); + $resultJson->setData([ + 'messages' => $errorMessages, + 'error' => count($errorMessages), + ]); + return $resultJson; + } +} From 54993ffbe67bbef5c41dde22b404d13f1cb57c17 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 9 Jun 2017 18:59:53 +0300 Subject: [PATCH 0129/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- app/code/Magento/Inventory/Model/SourceRepository.php | 2 ++ .../view/adminhtml/ui_component/inventory_source_listing.xml | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index 6a2316c388fad..ab7b9d71fd2a6 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -21,6 +21,8 @@ /** * Class SourceRepository + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * TODO: resolve CouplingBetweenObjects */ class SourceRepository implements SourceRepositoryInterface { diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml index ab2b875c3feff..cca94ff9318a6 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml @@ -270,10 +270,12 @@ - source_id inventory/source/edit + + source_id + From b4f3c6fbc6f0220ec34800861b685af4bd8d31cb Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 9 Jun 2017 19:01:21 +0300 Subject: [PATCH 0130/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- .../Magento/Backend/Ui/Component/Control/SaveSplitButton.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Ui/Component/Control/SaveSplitButton.php b/app/code/Magento/Backend/Ui/Component/Control/SaveSplitButton.php index c186fffbda19c..9c6a1ad727c17 100644 --- a/app/code/Magento/Backend/Ui/Component/Control/SaveSplitButton.php +++ b/app/code/Magento/Backend/Ui/Component/Control/SaveSplitButton.php @@ -109,4 +109,4 @@ private function getOptions() ]; return $options; } -} \ No newline at end of file +} From 3ec78b12acd8fa1c42afdd8ed8a2a57f784e7a7e Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 9 Jun 2017 19:05:04 +0300 Subject: [PATCH 0131/1004] magento-engcom/magento2#25: Source API Implementation -- fix composer.json --- app/code/Magento/Backend/composer.json | 1 + app/code/Magento/Inventory/composer.json | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index d3c94c1e286e0..bee4021963fa5 100644 --- a/app/code/Magento/Backend/composer.json +++ b/app/code/Magento/Backend/composer.json @@ -18,6 +18,7 @@ "magento/module-translation": "100.2.*", "magento/module-require-js": "100.2.*", "magento/module-config": "100.2.*", + "magento/module-ui": "100.2.*", "magento/framework": "100.2.*" }, "suggest": { diff --git a/app/code/Magento/Inventory/composer.json b/app/code/Magento/Inventory/composer.json index 7e3523d226c19..4ef710aca9fb8 100644 --- a/app/code/Magento/Inventory/composer.json +++ b/app/code/Magento/Inventory/composer.json @@ -5,9 +5,9 @@ "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", "magento/framework": "100.2.*", "magento/module-inventory-api": "100.0.*", - "magento/module-backend": "100.2.0-dev", - "magento/module-directory": "100.2.0-dev", - "magento/module-ui": "100.2.0-dev" + "magento/module-backend": "100.2.*", + "magento/module-directory": "100.2.*", + "magento/module-ui": "100.2.*" }, "type": "magento2-module", "version": "100.0.0-dev", From 148c5cdc67f0b77f6369041917e3b94e45d3ce95 Mon Sep 17 00:00:00 2001 From: Ranjith VK Date: Mon, 12 Jun 2017 10:59:28 +0530 Subject: [PATCH 0132/1004] magento/magento2 #9196 - separated simple products of a configurable in product ordered report --- .../Model/ResourceModel/Product/Sold/Collection.php | 7 +++---- .../layout/reports_report_product_sold_grid.xml | 10 ++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php index c45d2a3480cde..b75c1c985f9b6 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php @@ -46,6 +46,7 @@ public function setDateRange($from, $to) */ public function addOrderedQty($from = '', $to = '') { + //return $this; $connection = $this->getConnection(); $orderTableAliasName = $connection->quoteIdentifier('order'); @@ -61,17 +62,15 @@ public function addOrderedQty($from = '', $to = '') $this->getSelect()->reset()->from( ['order_items' => $this->getTable('sales_order_item')], - ['ordered_qty' => 'SUM(order_items.qty_ordered)', 'order_items_name' => 'order_items.name'] + ['ordered_qty' => 'order_items.qty_ordered', 'order_items_name' => 'order_items.name', 'order_items_sku' => 'order_items.sku'] )->joinInner( ['order' => $this->getTable('sales_order')], implode(' AND ', $orderJoinCondition), [] )->where( 'parent_item_id IS NULL' - )->group( - 'order_items.product_id' )->having( - 'SUM(order_items.qty_ordered) > ?', + 'order_items.qty_ordered > ?', 0 ); return $this; diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml index 6d13fa2d7c9e2..143d605461b67 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_product_sold_grid.xml @@ -41,6 +41,16 @@ col-product + + + SKU + text + order_items_sku + sku + col-sku + col-sku + + Ordered Quantity From 9ab4a825ad6551797bb01de18f533d4c312ca60a Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 12 Jun 2017 11:15:28 +0300 Subject: [PATCH 0133/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- .../Backend/Ui/Component/Listing/Column/EditAction.php | 2 +- .../Magento/Inventory/Controller/Adminhtml/Source/Edit.php | 2 +- .../Inventory/Controller/Adminhtml/Source/InlineEdit.php | 2 +- .../Inventory/Controller/Adminhtml/Source/NewAction.php | 6 +++++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Backend/Ui/Component/Listing/Column/EditAction.php b/app/code/Magento/Backend/Ui/Component/Listing/Column/EditAction.php index 366eb9196d0af..ce51fa1bb35a2 100644 --- a/app/code/Magento/Backend/Ui/Component/Listing/Column/EditAction.php +++ b/app/code/Magento/Backend/Ui/Component/Listing/Column/EditAction.php @@ -62,4 +62,4 @@ public function prepareDataSource(array $dataSource) } return $dataSource; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php index 85f0e71d915ed..d3711442fa241 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Edit.php @@ -15,7 +15,7 @@ use Magento\InventoryApi\Api\Data\SourceInterface; /** - * @author naydav + * Class Edit */ class Edit extends Action { diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php index cffa6d2b87d77..debbe98b863ab 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php @@ -17,7 +17,7 @@ use Magento\InventoryApi\Api\Data\SourceInterface; /** - * @author naydav + * Class InlineEdit */ class InlineEdit extends Action { diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php index 8c5b8d427df1b..a9b96061a8ae6 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/NewAction.php @@ -6,10 +6,14 @@ */ namespace Magento\Inventory\Controller\Adminhtml\Source; +use Magento\Backend\App\Action; use Magento\Backend\Model\View\Result\Page; use Magento\Framework\Controller\ResultFactory; -class NewAction extends \Magento\Cms\Controller\Adminhtml\Block +/** + * Class NewAction + */ +class NewAction extends Action { /** * @see _isAllowed() From e5ab63d1d1518c258a04de92338360420846e93a Mon Sep 17 00:00:00 2001 From: Ranjith VK Date: Mon, 12 Jun 2017 13:54:31 +0530 Subject: [PATCH 0134/1004] removed a unwanted comment line and broke a line into multiple lines due to character limit --- .../Model/ResourceModel/Product/Sold/Collection.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php index b75c1c985f9b6..35d8c892aa2e2 100644 --- a/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php +++ b/app/code/Magento/Reports/Model/ResourceModel/Product/Sold/Collection.php @@ -46,7 +46,6 @@ public function setDateRange($from, $to) */ public function addOrderedQty($from = '', $to = '') { - //return $this; $connection = $this->getConnection(); $orderTableAliasName = $connection->quoteIdentifier('order'); @@ -62,7 +61,11 @@ public function addOrderedQty($from = '', $to = '') $this->getSelect()->reset()->from( ['order_items' => $this->getTable('sales_order_item')], - ['ordered_qty' => 'order_items.qty_ordered', 'order_items_name' => 'order_items.name', 'order_items_sku' => 'order_items.sku'] + [ + 'ordered_qty' => 'order_items.qty_ordered', + 'order_items_name' => 'order_items.name', + 'order_items_sku' => 'order_items.sku' + ] )->joinInner( ['order' => $this->getTable('sales_order')], implode(' AND ', $orderJoinCondition), From d56d15d21a0ef41a84df30abe3135171b1664a64 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 12 Jun 2017 13:10:26 +0300 Subject: [PATCH 0135/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- .../Inventory/Controller/Adminhtml/Source/InlineEdit.php | 3 +-- .../Inventory/Controller/Adminhtml/Source/Save.php | 3 +-- .../Magento/Inventory/Model/OptionSource/RegionSource.php | 2 +- app/code/Magento/Inventory/Model/SourceRepository.php | 8 +------- .../Inventory/Ui/DataProvider/SourceDataProvider.php | 1 + .../InventoryApi/Api/SourceRepositoryInterface.php | 2 -- 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php index debbe98b863ab..46a2d67fd08a7 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php @@ -12,7 +12,6 @@ use Magento\Framework\EntityManager\HydratorInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Exception\StateException; use Magento\InventoryApi\Api\SourceRepositoryInterface; use Magento\InventoryApi\Api\Data\SourceInterface; @@ -68,7 +67,7 @@ public function execute() ); $source = $this->hydrator->hydrate($source, $itemData); $this->sourceRepository->save($source); - } catch (StateException|NoSuchEntityException $e) { + } catch (NoSuchEntityException $e) { $errorMessages[] = __( '[ID: %1] The Source does not exist.', $itemData[SourceInterface::SOURCE_ID] diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index aead87b56b1d8..9e8642ff03637 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -7,7 +7,6 @@ use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; -use Magento\Framework\Exception\StateException; use Magento\Framework\EntityManager\HydratorInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; @@ -111,7 +110,7 @@ public function execute() } catch (NoSuchEntityException $e) { $this->messageManager->addErrorMessage(__('The Source does not exist.')); $resultRedirect->setPath('*/*/'); - } catch (StateException|CouldNotSaveException $e) { + } catch (CouldNotSaveException $e) { $this->messageManager->addErrorMessage($e->getMessage()); if (empty($sourceId)) { $resultRedirect->setPath('*/*/'); diff --git a/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php b/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php index 7e9a63093422f..f352bac25079c 100644 --- a/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php +++ b/app/code/Magento/Inventory/Model/OptionSource/RegionSource.php @@ -48,4 +48,4 @@ public function toOptionArray() } return $this->sourceData; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index ab7b9d71fd2a6..e95dee91c26bd 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -10,7 +10,6 @@ use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Exception\StateException; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; use Magento\Inventory\Model\ResourceModel\Source\CollectionFactory; use Magento\InventoryApi\Api\Data\SourceInterface; @@ -21,8 +20,6 @@ /** * Class SourceRepository - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - * TODO: resolve CouplingBetweenObjects */ class SourceRepository implements SourceRepositoryInterface { @@ -98,10 +95,7 @@ public function save(SourceInterface $source) try { $this->resourceSource->save($source); return $source->getSourceId(); - } catch (StateException $e) { - $this->logger->error($e->getPrevious()->getMessage()); - throw $e; - } catch (\Exception $e) { + } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotSaveException(__('Could not save source'), $e); } diff --git a/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php index d33bb12defb38..19eac3bdac6ba 100644 --- a/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php +++ b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php @@ -38,6 +38,7 @@ class SourceDataProvider extends DataProvider * @param SearchResultFactory $searchResultFactory * @param array $meta * @param array $data + * @SuppressWarnings(PHPMD.ExcessiveParameterList) All parameters are needed for backward compatibility */ public function __construct( $name, diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index dc11198fec78a..ad8ee29b13bc8 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -16,8 +16,6 @@ interface SourceRepositoryInterface * * @param \Magento\InventoryApi\Api\Data\SourceInterface $source * @return int - * - * @throws \Magento\Framework\Exception\StateException * @throws \Magento\Framework\Exception\CouldNotSaveException */ public function save(\Magento\InventoryApi\Api\Data\SourceInterface $source); From 433c9c3a322e494b85dc4369001ab87126ffb8b9 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Mon, 6 Jun 2016 13:44:26 +0200 Subject: [PATCH 0136/1004] Prevent change log entry when nothing has changed Fixes #2987 If an entry has no changes but did get a MySQL UPDATE the trigger will not fire. This prevents entities from being reindexed when they haven't changed. This way the refresh index cron job finishes faster without any loss of functionality. This updated_at column is ignored because this is the only column that will always change, even if no attribute has been edited. --- .../Framework/Mview/View/Subscription.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Mview/View/Subscription.php b/lib/internal/Magento/Framework/Mview/View/Subscription.php index e621909ec99b6..0352749d78366 100644 --- a/lib/internal/Magento/Framework/Mview/View/Subscription.php +++ b/lib/internal/Magento/Framework/Mview/View/Subscription.php @@ -183,15 +183,32 @@ protected function getLinkedViews() */ protected function buildStatement($event, $changelog) { + $skipColumns = ['updated_at']; + $describe = $this->connection->describeTable($this->getTableName()); + $columns = []; + foreach ($describe as $column) { + if (!in_array($column['COLUMN_NAME'], $skipColumns)) { + $columns[] = sprintf('NEW.%1$s <> OLD.%1$s', + $this->connection->quoteIdentifier($column['COLUMN_NAME'])); + } + } + switch ($event) { case Trigger::EVENT_INSERT: - case Trigger::EVENT_UPDATE: return sprintf( "INSERT IGNORE INTO %s (%s) VALUES (NEW.%s);", $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), $this->connection->quoteIdentifier($changelog->getColumnName()), $this->connection->quoteIdentifier($this->getColumnName()) ); + case Trigger::EVENT_UPDATE: + return sprintf( + "IF (%s) THEN INSERT IGNORE INTO %s (%s) VALUES (NEW.%s); END IF;", + implode(' OR ', $columns), + $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), + $this->connection->quoteIdentifier($changelog->getColumnName()), + $this->connection->quoteIdentifier($this->getColumnName()) + ); case Trigger::EVENT_DELETE: return sprintf( From 1fe5e51d634e4e71856cb33b2fb1dbec44396b8f Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 12 Jun 2017 14:57:29 +0300 Subject: [PATCH 0137/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- .../Controller/Adminhtml/Source/Save.php | 36 ++++++++++++------- .../Inventory/Model/SourceRepository.php | 2 +- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index 9e8642ff03637..1be7ccd66dbc7 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -7,6 +7,7 @@ use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; +use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\EntityManager\HydratorInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; @@ -95,18 +96,8 @@ public function execute() $this->registry->register(self::REGISTRY_SOURCE_ID_KEY, $sourceId); $this->messageManager->addSuccessMessage(__('The Source has been saved.')); - if ($this->getRequest()->getParam('back')) { - $resultRedirect->setPath('*/*/edit', [ - SourceInterface::SOURCE_ID => $sourceId, - '_current' => true, - ]); - } elseif ($this->getRequest()->getParam('redirect_to_new')) { - $resultRedirect->setPath('*/*/new', [ - '_current' => true, - ]); - } else { - $resultRedirect->setPath('*/*/'); - } + $this->setRedirectOnSuccessSave($resultRedirect, $sourceId); + } catch (NoSuchEntityException $e) { $this->messageManager->addErrorMessage(__('The Source does not exist.')); $resultRedirect->setPath('*/*/'); @@ -127,4 +118,25 @@ public function execute() } return $resultRedirect; } + + /** + * @param Redirect $resultRedirect + * @param int $sourceId + * @return void + */ + private function setRedirectOnSuccessSave(Redirect $resultRedirect, $sourceId) + { + if ($this->getRequest()->getParam('back')) { + $resultRedirect->setPath('*/*/edit', [ + SourceInterface::SOURCE_ID => $sourceId, + '_current' => true, + ]); + } elseif ($this->getRequest()->getParam('redirect_to_new')) { + $resultRedirect->setPath('*/*/new', [ + '_current' => true, + ]); + } else { + $resultRedirect->setPath('*/*/'); + } + } } diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index e95dee91c26bd..e7f06789f0434 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -95,7 +95,7 @@ public function save(SourceInterface $source) try { $this->resourceSource->save($source); return $source->getSourceId(); - } catch (\Exception $e) { + } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotSaveException(__('Could not save source'), $e); } From 0028ce6abd5ff38269fbddaa49a1fe0c79b20490 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Mon, 12 Jun 2017 19:09:14 +0600 Subject: [PATCH 0138/1004] Prevent unit tests from failing --- .../Framework/Mview/View/Subscription.php | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Mview/View/Subscription.php b/lib/internal/Magento/Framework/Mview/View/Subscription.php index 0352749d78366..54a69861d7136 100644 --- a/lib/internal/Magento/Framework/Mview/View/Subscription.php +++ b/lib/internal/Magento/Framework/Mview/View/Subscription.php @@ -186,10 +186,12 @@ protected function buildStatement($event, $changelog) $skipColumns = ['updated_at']; $describe = $this->connection->describeTable($this->getTableName()); $columns = []; - foreach ($describe as $column) { - if (!in_array($column['COLUMN_NAME'], $skipColumns)) { - $columns[] = sprintf('NEW.%1$s <> OLD.%1$s', - $this->connection->quoteIdentifier($column['COLUMN_NAME'])); + if (is_array($describe)) { + foreach ($describe as $column) { + if (!in_array($column['COLUMN_NAME'], $skipColumns)) { + $columns[] = sprintf('NEW.%1$s != OLD.%1$s', + $this->connection->quoteIdentifier($column['COLUMN_NAME'])); + } } } @@ -202,9 +204,17 @@ protected function buildStatement($event, $changelog) $this->connection->quoteIdentifier($this->getColumnName()) ); case Trigger::EVENT_UPDATE: + if ($columns) { + return sprintf( + "IF (%s) THEN INSERT IGNORE INTO %s (%s) VALUES (NEW.%s); END IF;", + implode(' OR ', $columns), + $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), + $this->connection->quoteIdentifier($changelog->getColumnName()), + $this->connection->quoteIdentifier($this->getColumnName()) + ); + } return sprintf( - "IF (%s) THEN INSERT IGNORE INTO %s (%s) VALUES (NEW.%s); END IF;", - implode(' OR ', $columns), + "INSERT IGNORE INTO %s (%s) VALUES (NEW.%s);", $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), $this->connection->quoteIdentifier($changelog->getColumnName()), $this->connection->quoteIdentifier($this->getColumnName()) From b8c81dbb89511096292a462884925ad9fac1ad84 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 12 Jun 2017 16:12:08 +0300 Subject: [PATCH 0139/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- .../Controller/Adminhtml/Source/Save.php | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index 1be7ccd66dbc7..b794b617a8f5b 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -7,7 +7,6 @@ use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; -use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\EntityManager\HydratorInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; @@ -81,23 +80,24 @@ public function execute() $requestData = $this->getRequest()->getParam('general'); if ($this->getRequest()->isPost() && $requestData) { try { - $sourceId = !empty($requestData[SourceInterface::SOURCE_ID]) - ? $requestData[SourceInterface::SOURCE_ID] : null; + $sourceId = $this->processSave($requestData); - if ($sourceId) { - $source = $this->sourceRepository->get($sourceId); - } else { - /** @var SourceInterface $source */ - $source = $this->sourceFactory->create(); - } - $source = $this->hydrator->hydrate($source, $requestData); - $sourceId = $this->sourceRepository->save($source); // Keep data for plugins on Save controller. Now we can not call separate services from one form. $this->registry->register(self::REGISTRY_SOURCE_ID_KEY, $sourceId); $this->messageManager->addSuccessMessage(__('The Source has been saved.')); - $this->setRedirectOnSuccessSave($resultRedirect, $sourceId); - + if ($this->getRequest()->getParam('back')) { + $resultRedirect->setPath('*/*/edit', [ + SourceInterface::SOURCE_ID => $sourceId, + '_current' => true, + ]); + } elseif ($this->getRequest()->getParam('redirect_to_new')) { + $resultRedirect->setPath('*/*/new', [ + '_current' => true, + ]); + } else { + $resultRedirect->setPath('*/*/'); + } } catch (NoSuchEntityException $e) { $this->messageManager->addErrorMessage(__('The Source does not exist.')); $resultRedirect->setPath('*/*/'); @@ -120,23 +120,22 @@ public function execute() } /** - * @param Redirect $resultRedirect - * @param int $sourceId - * @return void + * @param array $requestData + * @return int */ - private function setRedirectOnSuccessSave(Redirect $resultRedirect, $sourceId) + private function processSave(array $requestData) { - if ($this->getRequest()->getParam('back')) { - $resultRedirect->setPath('*/*/edit', [ - SourceInterface::SOURCE_ID => $sourceId, - '_current' => true, - ]); - } elseif ($this->getRequest()->getParam('redirect_to_new')) { - $resultRedirect->setPath('*/*/new', [ - '_current' => true, - ]); + $sourceId = !empty($requestData[SourceInterface::SOURCE_ID]) + ? $requestData[SourceInterface::SOURCE_ID] : null; + + if ($sourceId) { + $source = $this->sourceRepository->get($sourceId); } else { - $resultRedirect->setPath('*/*/'); + /** @var SourceInterface $source */ + $source = $this->sourceFactory->create(); } + $source = $this->hydrator->hydrate($source, $requestData); + $sourceId = $this->sourceRepository->save($source); + return $sourceId; } } From 949048945625e7ec1e89e93fe65d565a6ad65b90 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 12 Jun 2017 18:12:13 +0300 Subject: [PATCH 0140/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- .../Magento/Inventory/Ui/DataProvider/SourceDataProvider.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php index 19eac3bdac6ba..5d076da3102ac 100644 --- a/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php +++ b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php @@ -1,4 +1,8 @@ Date: Tue, 13 Jun 2017 09:19:06 +0600 Subject: [PATCH 0141/1004] prevent unit tests from failing add documentation and increase readability --- .../Framework/Mview/View/Subscription.php | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/internal/Magento/Framework/Mview/View/Subscription.php b/lib/internal/Magento/Framework/Mview/View/Subscription.php index 54a69861d7136..c396115e74842 100644 --- a/lib/internal/Magento/Framework/Mview/View/Subscription.php +++ b/lib/internal/Magento/Framework/Mview/View/Subscription.php @@ -52,6 +52,14 @@ class Subscription implements SubscriptionInterface */ protected $linkedViews = []; + /** + * List of columns that can be updated in a subscribed table + * without creating a new change log entry + * + * @var array + */ + protected $ignoredUpdateColumns = ['updated_at']; + /** * @var Resource */ @@ -175,7 +183,7 @@ protected function getLinkedViews() } /** - * Build trigger statement for INSER, UPDATE, DELETE events + * Build trigger statement for INSERT, UPDATE, DELETE events * * @param string $event * @param \Magento\Framework\Mview\View\ChangelogInterface $changelog @@ -183,54 +191,46 @@ protected function getLinkedViews() */ protected function buildStatement($event, $changelog) { - $skipColumns = ['updated_at']; - $describe = $this->connection->describeTable($this->getTableName()); $columns = []; - if (is_array($describe)) { + if ($describe = $this->connection->describeTable($this->getTableName())) { foreach ($describe as $column) { - if (!in_array($column['COLUMN_NAME'], $skipColumns)) { - $columns[] = sprintf('NEW.%1$s != OLD.%1$s', - $this->connection->quoteIdentifier($column['COLUMN_NAME'])); + if (in_array($column['COLUMN_NAME'], $this->ignoredUpdateColumns)) { + continue; } + $columns[] = sprintf( + 'NEW.%1$s != OLD.%1$s', + $this->connection->quoteIdentifier($column['COLUMN_NAME']) + ); } } switch ($event) { case Trigger::EVENT_INSERT: - return sprintf( - "INSERT IGNORE INTO %s (%s) VALUES (NEW.%s);", - $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), - $this->connection->quoteIdentifier($changelog->getColumnName()), - $this->connection->quoteIdentifier($this->getColumnName()) - ); + $trigger = "INSERT IGNORE INTO %s (%s) VALUES (NEW.%s);"; + break; case Trigger::EVENT_UPDATE: + $trigger = "INSERT IGNORE INTO %s (%s) VALUES (NEW.%s);"; if ($columns) { - return sprintf( - "IF (%s) THEN INSERT IGNORE INTO %s (%s) VALUES (NEW.%s); END IF;", + $trigger = sprintf( + "IF (%s) THEN %s END IF;", implode(' OR ', $columns), - $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), - $this->connection->quoteIdentifier($changelog->getColumnName()), - $this->connection->quoteIdentifier($this->getColumnName()) + $trigger ); } - return sprintf( - "INSERT IGNORE INTO %s (%s) VALUES (NEW.%s);", - $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), - $this->connection->quoteIdentifier($changelog->getColumnName()), - $this->connection->quoteIdentifier($this->getColumnName()) - ); - + break; case Trigger::EVENT_DELETE: - return sprintf( - "INSERT IGNORE INTO %s (%s) VALUES (OLD.%s);", - $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), - $this->connection->quoteIdentifier($changelog->getColumnName()), - $this->connection->quoteIdentifier($this->getColumnName()) - ); - + $trigger = "INSERT IGNORE INTO %s (%s) VALUES (OLD.%s);"; + break; default: return ''; + } + return sprintf( + $trigger, + $this->connection->quoteIdentifier($this->resource->getTableName($changelog->getName())), + $this->connection->quoteIdentifier($changelog->getColumnName()), + $this->connection->quoteIdentifier($this->getColumnName()) + ); } /** From d41bc5be83c41ea983e7d67e15c927fa38958577 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Tue, 13 Jun 2017 10:43:26 +0600 Subject: [PATCH 0142/1004] Possible fix for integration test scenarios --- lib/internal/Magento/Framework/Mview/View/Subscription.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Mview/View/Subscription.php b/lib/internal/Magento/Framework/Mview/View/Subscription.php index c396115e74842..b443389495872 100644 --- a/lib/internal/Magento/Framework/Mview/View/Subscription.php +++ b/lib/internal/Magento/Framework/Mview/View/Subscription.php @@ -192,7 +192,9 @@ protected function getLinkedViews() protected function buildStatement($event, $changelog) { $columns = []; - if ($describe = $this->connection->describeTable($this->getTableName())) { + if ($this->connection->isTableExists($this->getTableName()) + && $describe = $this->connection->describeTable($this->getTableName()) + ) { foreach ($describe as $column) { if (in_array($column['COLUMN_NAME'], $this->ignoredUpdateColumns)) { continue; From ea510c16b7d92cb88bb3eeb167d01212d8e5b543 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 13 Jun 2017 12:33:32 +0300 Subject: [PATCH 0143/1004] magento-engcom/magento2#25: Source API Implementation -- fix static tests --- app/code/Magento/Ui/DataProvider/SearchResultFactory.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Ui/DataProvider/SearchResultFactory.php b/app/code/Magento/Ui/DataProvider/SearchResultFactory.php index d86c4c828a58e..3f54b06b6b192 100644 --- a/app/code/Magento/Ui/DataProvider/SearchResultFactory.php +++ b/app/code/Magento/Ui/DataProvider/SearchResultFactory.php @@ -1,4 +1,8 @@ Date: Wed, 14 Jun 2017 12:36:49 +0100 Subject: [PATCH 0144/1004] Add AfterCommitException MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a callback in commit throws an excecption, the calling plugin needs to be able to distinguish this from a unsuccessful commit, so that it doesn't attempt a rollback on an already commited transaction. (Which would cause an “Asymmetric transaction rollback" error) --- .../Framework/Exception/AfterCommitException.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/internal/Magento/Framework/Exception/AfterCommitException.php diff --git a/lib/internal/Magento/Framework/Exception/AfterCommitException.php b/lib/internal/Magento/Framework/Exception/AfterCommitException.php new file mode 100644 index 0000000000000..4baa5aaf0d6fe --- /dev/null +++ b/lib/internal/Magento/Framework/Exception/AfterCommitException.php @@ -0,0 +1,15 @@ + Date: Wed, 14 Jun 2017 13:49:56 +0100 Subject: [PATCH 0145/1004] Throw new AfterCommitException from AbstractResource.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a callback in commit throws an excecption, the calling plugin needs to be able to distinguish this from a unsuccessful commit, so that it doesn't attempt a rollback on an already commited transaction. (Which would cause an “Asymmetric transaction rollback" error) --- .../Magento/Framework/Model/ResourceModel/AbstractResource.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/AbstractResource.php b/lib/internal/Magento/Framework/Model/ResourceModel/AbstractResource.php index 1e3de56f495bf..90cc88bfc0817 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/AbstractResource.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/AbstractResource.php @@ -9,6 +9,7 @@ use Magento\Framework\DataObject; use Magento\Framework\Model\CallbackPool; use Magento\Framework\Serialize\Serializer\Json; +use Magento\Framework\Exception\AfterCommitException; /** * Abstract resource model @@ -91,7 +92,7 @@ public function commit() call_user_func($callback); } } catch (\Exception $e) { - throw $e; + throw new AfterCommitException(null, null, $e); } } return $this; From 1cc3787e4c446dfa65af9d06d754208da1b816b7 Mon Sep 17 00:00:00 2001 From: waynemowdirect Date: Wed, 14 Jun 2017 16:12:32 +0100 Subject: [PATCH 0146/1004] Catch AfterCommitException from AbstractResource.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a callback in commit throws an excecption, the calling plugin needs to be able to distinguish this from a unsuccessful commit, so that it doesn't attempt a rollback on an already commited transaction. (Which would cause an “Asymmetric transaction rollback" error) --- .../Magento/Authorization/Model/ResourceModel/Rules.php | 2 ++ .../Catalog/Console/Command/ProductAttributesCleanUp.php | 2 ++ app/code/Magento/Catalog/Model/Category.php | 2 ++ .../Model/Plugin/ProductRepository/TransactionWrapper.php | 6 ++++++ .../Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php | 2 ++ .../ResourceModel/Product/Indexer/Price/DefaultPrice.php | 2 ++ .../Model/ResourceModel/Indexer/Stock/DefaultStock.php | 2 ++ .../Model/Indexer/Fulltext/Plugin/Category.php | 2 ++ .../CatalogSearch/Model/Indexer/Fulltext/Plugin/Product.php | 2 ++ .../Model/Plugin/CustomerRepository/TransactionWrapper.php | 2 ++ app/code/Magento/Eav/Model/Entity/AbstractEntity.php | 2 ++ app/code/Magento/Eav/Model/Entity/Type.php | 2 ++ .../Eav/Model/Entity/VersionControl/AbstractEntity.php | 2 ++ .../EncryptionKey/Model/ResourceModel/Key/Change.php | 2 ++ .../Indexer/Model/ResourceModel/AbstractResource.php | 2 ++ app/code/Magento/Sitemap/Model/ResourceModel/Cms/Page.php | 2 ++ 16 files changed, 36 insertions(+) diff --git a/app/code/Magento/Authorization/Model/ResourceModel/Rules.php b/app/code/Magento/Authorization/Model/ResourceModel/Rules.php index e888b81e002df..1ed44f405ccb9 100644 --- a/app/code/Magento/Authorization/Model/ResourceModel/Rules.php +++ b/app/code/Magento/Authorization/Model/ResourceModel/Rules.php @@ -121,6 +121,8 @@ public function saveRel(\Magento\Authorization\Model\Rules $rule) $connection->commit(); $this->aclDataCache->clean(); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Magento\Framework\Exception\LocalizedException $e) { $connection->rollBack(); throw $e; diff --git a/app/code/Magento/Catalog/Console/Command/ProductAttributesCleanUp.php b/app/code/Magento/Catalog/Console/Command/ProductAttributesCleanUp.php index 4fc63d1d662c0..0291f0ba6921a 100644 --- a/app/code/Magento/Catalog/Console/Command/ProductAttributesCleanUp.php +++ b/app/code/Magento/Catalog/Console/Command/ProductAttributesCleanUp.php @@ -102,6 +102,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $output->writeln("Unused product attributes successfully cleaned up:"); $output->writeln(" " . implode("\n ", $attributeTables) . ""); return \Magento\Framework\Console\Cli::RETURN_SUCCESS; + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $exception) { $this->attributeResource->rollBack(); diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index 311bd4f9422fd..833e26be706cc 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -429,6 +429,8 @@ public function move($parentId, $afterCategoryId) // Set data for indexer $this->setAffectedCategoryIds([$this->getId(), $oldParentId, $parentId]); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->_getResource()->rollBack(); throw $e; diff --git a/app/code/Magento/Catalog/Model/Plugin/ProductRepository/TransactionWrapper.php b/app/code/Magento/Catalog/Model/Plugin/ProductRepository/TransactionWrapper.php index c88215d92357e..c437e2220844a 100644 --- a/app/code/Magento/Catalog/Model/Plugin/ProductRepository/TransactionWrapper.php +++ b/app/code/Magento/Catalog/Model/Plugin/ProductRepository/TransactionWrapper.php @@ -44,6 +44,8 @@ public function aroundSave( $result = $proceed($product, $saveOptions); $this->resourceModel->commit(); return $result; + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->resourceModel->rollBack(); throw $e; @@ -69,6 +71,8 @@ public function aroundDelete( $result = $proceed($product); $this->resourceModel->commit(); return $result; + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->resourceModel->rollBack(); throw $e; @@ -94,6 +98,8 @@ public function aroundDeleteById( $result = $proceed($productSku); $this->resourceModel->commit(); return $result; + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->resourceModel->rollBack(); throw $e; diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php index 8f4a47804c8ae..3bdf244077b8a 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php @@ -77,6 +77,8 @@ public function reindexAll() $this->_removeNotVisibleEntityFromIndex(); $this->syncData(); $this->commit(); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->rollBack(); throw $e; diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php index a613690209432..dca51a181ef89 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php @@ -167,6 +167,8 @@ public function reindexAll() try { $this->reindex(); $this->commit(); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->rollBack(); throw $e; diff --git a/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php b/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php index 650dfc5bcdbb5..adef85115b69c 100644 --- a/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php +++ b/app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php @@ -119,6 +119,8 @@ public function reindexAll() try { $this->_prepareIndexTable(); $this->commit(); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->rollBack(); throw $e; diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Category.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Category.php index e9c0e06ac38a0..59227fb200db7 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Category.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Category.php @@ -48,6 +48,8 @@ private function addCommitCallback(ResourceCategory $resourceCategory, \Closure } }); $resourceCategory->commit(); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $resourceCategory->rollBack(); throw $e; diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product.php index 949033bb338e0..e4bbcdf048107 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext/Plugin/Product.php @@ -53,6 +53,8 @@ private function addCommitCallback(ResourceProduct $productResource, \Closure $p $this->reindexRow($product->getEntityId()); }); $productResource->commit(); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $productResource->rollBack(); throw $e; diff --git a/app/code/Magento/Customer/Model/Plugin/CustomerRepository/TransactionWrapper.php b/app/code/Magento/Customer/Model/Plugin/CustomerRepository/TransactionWrapper.php index 45041b10c9c7b..eeecdd3bb7783 100644 --- a/app/code/Magento/Customer/Model/Plugin/CustomerRepository/TransactionWrapper.php +++ b/app/code/Magento/Customer/Model/Plugin/CustomerRepository/TransactionWrapper.php @@ -44,6 +44,8 @@ public function aroundSave( $result = $proceed($customer, $passwordHash); $this->resourceModel->commit(); return $result; + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->resourceModel->rollBack(); throw $e; diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index 071f5167b5870..ef0b06b569d65 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -1142,6 +1142,8 @@ public function save(\Magento\Framework\Model\AbstractModel $object) } $this->addCommitCallback([$object, 'afterCommitCallback'])->commit(); $object->setHasDataChanges(false); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (DuplicateException $e) { $this->rollBack(); $object->setHasDataChanges(true); diff --git a/app/code/Magento/Eav/Model/Entity/Type.php b/app/code/Magento/Eav/Model/Entity/Type.php index e8f2a30804efd..e29d713530302 100644 --- a/app/code/Magento/Eav/Model/Entity/Type.php +++ b/app/code/Magento/Eav/Model/Entity/Type.php @@ -254,6 +254,8 @@ public function fetchNewIncrementId($storeId = null) // Commit increment_last_id changes $this->_getResource()->commit(); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $exception) { $this->_getResource()->rollBack(); throw $exception; diff --git a/app/code/Magento/Eav/Model/Entity/VersionControl/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/VersionControl/AbstractEntity.php index 7b44749273e4a..0815d5021f478 100644 --- a/app/code/Magento/Eav/Model/Entity/VersionControl/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/VersionControl/AbstractEntity.php @@ -97,6 +97,8 @@ public function save(\Magento\Framework\Model\AbstractModel $object) $this->addCommitCallback([$object, 'afterCommitCallback'])->commit(); $object->setHasDataChanges(false); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->rollBack(); $object->setHasDataChanges(true); diff --git a/app/code/Magento/EncryptionKey/Model/ResourceModel/Key/Change.php b/app/code/Magento/EncryptionKey/Model/ResourceModel/Key/Change.php index aaa3551e9e04c..268eda33f7143 100644 --- a/app/code/Magento/EncryptionKey/Model/ResourceModel/Key/Change.php +++ b/app/code/Magento/EncryptionKey/Model/ResourceModel/Key/Change.php @@ -123,6 +123,8 @@ public function changeEncryptionKey($key = null) $this->writer->saveConfig($configData); $this->commit(); return $key; + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->rollBack(); throw $e; diff --git a/app/code/Magento/Indexer/Model/ResourceModel/AbstractResource.php b/app/code/Magento/Indexer/Model/ResourceModel/AbstractResource.php index 3294ed5fcaba8..143c53f86af57 100644 --- a/app/code/Magento/Indexer/Model/ResourceModel/AbstractResource.php +++ b/app/code/Magento/Indexer/Model/ResourceModel/AbstractResource.php @@ -89,6 +89,8 @@ public function syncData() $this->getConnection()->delete($this->getMainTable()); $this->insertFromTable($this->getIdxTable(), $this->getMainTable(), false); $this->commit(); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->rollBack(); throw $e; diff --git a/app/code/Magento/Sitemap/Model/ResourceModel/Cms/Page.php b/app/code/Magento/Sitemap/Model/ResourceModel/Cms/Page.php index e542e32b9d75d..fc937c9c94394 100644 --- a/app/code/Magento/Sitemap/Model/ResourceModel/Cms/Page.php +++ b/app/code/Magento/Sitemap/Model/ResourceModel/Cms/Page.php @@ -185,6 +185,8 @@ public function save(AbstractModel $object) } $this->addCommitCallback([$object, 'afterCommitCallback'])->commit(); $object->setHasDataChanges(false); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $this->rollBack(); $object->setHasDataChanges(true); From 466358112693170d95936ae1c4a80bc1d1ed2b00 Mon Sep 17 00:00:00 2001 From: Wayne Theisinger Date: Wed, 14 Jun 2017 16:19:32 +0100 Subject: [PATCH 0147/1004] Delete forcing file that was used to nudge travis --- forceBuild.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 forceBuild.txt diff --git a/forceBuild.txt b/forceBuild.txt deleted file mode 100644 index 6dacae433f39f..0000000000000 --- a/forceBuild.txt +++ /dev/null @@ -1 +0,0 @@ -forcing From 465b591f8d03ea4eabb4f1671f37a81ab0301c1a Mon Sep 17 00:00:00 2001 From: waynemowdirect Date: Wed, 14 Jun 2017 17:30:03 +0100 Subject: [PATCH 0148/1004] Fix Code Style --- .../Magento/Framework/Exception/AfterCommitException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Exception/AfterCommitException.php b/lib/internal/Magento/Framework/Exception/AfterCommitException.php index 4baa5aaf0d6fe..129e66fe19e7d 100644 --- a/lib/internal/Magento/Framework/Exception/AfterCommitException.php +++ b/lib/internal/Magento/Framework/Exception/AfterCommitException.php @@ -12,4 +12,4 @@ */ class AfterCommitException extends \Exception { -} \ No newline at end of file +} From 7e309677231f2fc5541be7c599bc1cb3144f0f49 Mon Sep 17 00:00:00 2001 From: waynemowdirect Date: Wed, 14 Jun 2017 18:12:29 +0100 Subject: [PATCH 0149/1004] Suppress CyclomaticComplexity Warning - Discuss with Core Team --- app/code/Magento/Eav/Model/Entity/AbstractEntity.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index ef0b06b569d65..3a473a130320d 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -31,6 +31,7 @@ * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ abstract class AbstractEntity extends AbstractResource implements EntityInterface, DefaultAttributesProvider { From 95c2ae9ec4063d0b7452e300e2c824119136a877 Mon Sep 17 00:00:00 2001 From: waynemowdirect Date: Thu, 15 Jun 2017 08:06:26 +0100 Subject: [PATCH 0150/1004] Alter Tests to add new exception catches (plus a few main catches) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a callback in commit throws an excecption, the calling plugin needs to be able to distinguish this from a unsuccessful commit, so that it doesn't attempt a rollback on an already commited transaction. (Which would cause an “Asymmetric transaction rollback" error) --- app/code/Magento/Authorization/Model/ResourceModel/Rules.php | 2 -- app/code/Magento/Sales/Model/Order/Status.php | 2 ++ app/code/Magento/Store/Model/Config/Importer.php | 2 ++ .../testsuite/Magento/Reports/_files/viewed_products.php | 2 ++ .../testsuite/Magento/Sales/_files/report_bestsellers.php | 2 ++ .../testsuite/Magento/Sales/_files/report_invoiced.php | 2 ++ .../testsuite/Magento/Sales/_files/report_refunded.php | 2 ++ .../testsuite/Magento/Sales/_files/report_shipping.php | 2 ++ .../testsuite/Magento/SalesRule/_files/report_coupons.php | 2 ++ .../integration/testsuite/Magento/Tax/_files/report_tax.php | 2 ++ .../Magento/Framework/Model/ResourceModel/Db/AbstractDb.php | 2 ++ 11 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Authorization/Model/ResourceModel/Rules.php b/app/code/Magento/Authorization/Model/ResourceModel/Rules.php index 1ed44f405ccb9..e888b81e002df 100644 --- a/app/code/Magento/Authorization/Model/ResourceModel/Rules.php +++ b/app/code/Magento/Authorization/Model/ResourceModel/Rules.php @@ -121,8 +121,6 @@ public function saveRel(\Magento\Authorization\Model\Rules $rule) $connection->commit(); $this->aclDataCache->clean(); - } catch (\Magento\Framework\Exception\AfterCommitException $e) { - throw $e->getPrevious(); } catch (\Magento\Framework\Exception\LocalizedException $e) { $connection->rollBack(); throw $e; diff --git a/app/code/Magento/Sales/Model/Order/Status.php b/app/code/Magento/Sales/Model/Order/Status.php index bdd15d4d844c6..02ea70b0141a1 100644 --- a/app/code/Magento/Sales/Model/Order/Status.php +++ b/app/code/Magento/Sales/Model/Order/Status.php @@ -77,6 +77,8 @@ public function assignState($state, $isDefault = false, $visibleOnFront = false) try { $resource->assignState($this->getStatus(), $state, $isDefault, $visibleOnFront); $resource->commit(); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $resource->rollBack(); throw $e; diff --git a/app/code/Magento/Store/Model/Config/Importer.php b/app/code/Magento/Store/Model/Config/Importer.php index 130e523ab53df..f255a471fd74b 100644 --- a/app/code/Magento/Store/Model/Config/Importer.php +++ b/app/code/Magento/Store/Model/Config/Importer.php @@ -105,6 +105,8 @@ public function import(array $data) foreach ($actions as $action) { $this->processFactory->create($action)->run($data); } + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $exception) { $this->resource->rollBack(); $this->reinitStores(); diff --git a/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php b/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php index 3cf81d910cfdf..553890cac86e8 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php +++ b/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php @@ -54,6 +54,8 @@ try { $reportResource->aggregate(); $reportResource->commit(); +} catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $reportResource->rollBack(); throw $e; diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/report_bestsellers.php b/dev/tests/integration/testsuite/Magento/Sales/_files/report_bestsellers.php index 870bb3195c6dd..580f648c709bf 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/report_bestsellers.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/report_bestsellers.php @@ -14,6 +14,8 @@ try { $reportResource->aggregate(); $reportResource->commit(); +} catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $reportResource->rollBack(); throw $e; diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/report_invoiced.php b/dev/tests/integration/testsuite/Magento/Sales/_files/report_invoiced.php index d75a96c8d7b4b..192ca45d42c10 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/report_invoiced.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/report_invoiced.php @@ -14,6 +14,8 @@ try { $reportResource->aggregate(); $reportResource->commit(); +} catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $reportResource->rollBack(); throw $e; diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/report_refunded.php b/dev/tests/integration/testsuite/Magento/Sales/_files/report_refunded.php index 34a83de03747b..57c81b623dabd 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/report_refunded.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/report_refunded.php @@ -14,6 +14,8 @@ try { $reportResource->aggregate(); $reportResource->commit(); +} catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $reportResource->rollBack(); throw $e; diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/report_shipping.php b/dev/tests/integration/testsuite/Magento/Sales/_files/report_shipping.php index c2411fbf02049..a48758a164412 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/report_shipping.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/report_shipping.php @@ -14,6 +14,8 @@ try { $reportResource->aggregate(); $reportResource->commit(); +} catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $reportResource->rollBack(); throw $e; diff --git a/dev/tests/integration/testsuite/Magento/SalesRule/_files/report_coupons.php b/dev/tests/integration/testsuite/Magento/SalesRule/_files/report_coupons.php index 21222e3bd26ab..5059bee84d0ea 100644 --- a/dev/tests/integration/testsuite/Magento/SalesRule/_files/report_coupons.php +++ b/dev/tests/integration/testsuite/Magento/SalesRule/_files/report_coupons.php @@ -14,6 +14,8 @@ try { $reportResource->aggregate(); $reportResource->commit(); +} catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $reportResource->rollBack(); throw $e; diff --git a/dev/tests/integration/testsuite/Magento/Tax/_files/report_tax.php b/dev/tests/integration/testsuite/Magento/Tax/_files/report_tax.php index c4b22617bbd5c..080b48f19711e 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/_files/report_tax.php +++ b/dev/tests/integration/testsuite/Magento/Tax/_files/report_tax.php @@ -13,6 +13,8 @@ try { $reportResource->aggregate(); $reportResource->commit(); +} catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (\Exception $e) { $reportResource->rollBack(); throw $e; diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php index 01bfed5059553..30f35ee32e941 100644 --- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php +++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/AbstractDb.php @@ -419,6 +419,8 @@ public function save(\Magento\Framework\Model\AbstractModel $object) } $this->addCommitCallback([$object, 'afterCommitCallback'])->commit(); $object->setHasDataChanges(false); + } catch (\Magento\Framework\Exception\AfterCommitException $e) { + throw $e->getPrevious(); } catch (DuplicateException $e) { $this->rollBack(); $object->setHasDataChanges(true); From faa53bed67d185f823287dbfb02eb0bb887b0dd2 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 15 Jun 2017 18:13:16 +0300 Subject: [PATCH 0151/1004] magento-engcom/magento2#25: Source API Implementation -- add carriers links assignment --- .../Source/CarrierRequestDataHydrator.php | 113 ++++++++++++++++++ .../Controller/Adminhtml/Source/Save.php | 12 +- .../Model/OptionSource/CarrierSource.php | 56 +++++++++ .../Model/ResourceModel/SourceCarrierLink.php | 26 +--- app/code/Magento/Inventory/Model/Source.php | 16 +++ .../Model/SourceCarrierLinkManagement.php | 2 - .../Magento/Inventory/Setup/InstallSchema.php | 21 ++++ .../Ui/DataProvider/SourceDataProvider.php | 19 ++- .../ui_component/inventory_source_form.xml | 45 ++++++- .../InventoryApi/Api/Data/SourceInterface.php | 12 ++ app/code/Magento/Shipping/Model/Config.php | 6 +- 11 files changed, 298 insertions(+), 30 deletions(-) create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php create mode 100644 app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php new file mode 100644 index 0000000000000..7b9fa6947159f --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php @@ -0,0 +1,113 @@ +carrierLinkFactory = $carrierLinkFactory; + $this->dataObjectHelper = $dataObjectHelper; + $this->shippingConfig = $shippingConfig; + } + + /** + * @param SourceInterface $source + * @param array $requestData + * @return SourceInterface + * @throws InputException + */ + public function hydrate(SourceInterface $source, array $requestData) + { + $useDefaultCarrierConfig = isset($requestData[SourceInterface::USE_DEFAULT_CARRIER_CONFIG]) + && true === (bool)$requestData[SourceInterface::USE_DEFAULT_CARRIER_CONFIG]; + + $carrierLinks = []; + if (false === $useDefaultCarrierConfig + && isset($requestData['carrier_codes']) + && is_array($requestData['carrier_codes']) + ) { + $this->checkCarrierCodes($requestData['carrier_codes']); + $carrierLinks = $this->createCarrierLinks($requestData['carrier_codes']); + } + + $source->setUseDefaultCarrierConfig($useDefaultCarrierConfig); + $source->setCarrierLinks($carrierLinks); + return $source; + } + + /** + * @param array $carrierCodes + * @throws InputException + */ + private function checkCarrierCodes(array $carrierCodes) + { + $availableCarriers = $this->shippingConfig->getActiveCarriers(); + + if (count(array_intersect_key(array_flip($carrierCodes), $availableCarriers)) !== count($carrierCodes)) { + throw new InputException(__('Wrong carrier codes data')); + } + } + + /** + * @param array $carrierCodes + * @return SourceCarrierLinkInterface[] + */ + private function createCarrierLinks(array $carrierCodes) + { + $carrierLinks = []; + foreach ($carrierCodes as $carrierCode) { + /** @var SourceCarrierLinkInterface $carrierLink */ + $carrierLink = $this->carrierLinkFactory->create(); + $this->dataObjectHelper->populateWithArray( + $carrierLink, + [ + SourceCarrierLinkInterface::CARRIER_CODE => $carrierCode, + ], + SourceCarrierLinkInterface::class + ); + $carrierLinks[] = $carrierLink; + } + return $carrierLinks; + } +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index b794b617a8f5b..e1632205bea06 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -50,11 +50,17 @@ class Save extends Action */ private $registry; + /** + * @var CarrierRequestDataHydrator + */ + private $carrierRequestDataHydrator; + /** * @param Context $context * @param SourceInterfaceFactory $sourceFactory * @param SourceRepositoryInterface $sourceRepository * @param HydratorInterface $hydrator + * @param CarrierRequestDataHydrator $carrierRequestDataHydrator * @param Registry $registry */ public function __construct( @@ -62,13 +68,15 @@ public function __construct( SourceInterfaceFactory $sourceFactory, SourceRepositoryInterface $sourceRepository, HydratorInterface $hydrator, - Registry $registry + Registry $registry, + CarrierRequestDataHydrator $carrierRequestDataHydrator ) { parent::__construct($context); $this->sourceFactory = $sourceFactory; $this->sourceRepository = $sourceRepository; $this->hydrator = $hydrator; $this->registry = $registry; + $this->carrierRequestDataHydrator = $carrierRequestDataHydrator; } /** @@ -135,6 +143,8 @@ private function processSave(array $requestData) $source = $this->sourceFactory->create(); } $source = $this->hydrator->hydrate($source, $requestData); + $source = $this->carrierRequestDataHydrator->hydrate($source, $requestData); + $sourceId = $this->sourceRepository->save($source); return $sourceId; } diff --git a/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php b/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php new file mode 100644 index 0000000000000..6f4d65183fedb --- /dev/null +++ b/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php @@ -0,0 +1,56 @@ +shippingConfig = $shippingConfig; + } + + /** + * {@inheritdoc} + */ + public function toOptionArray() + { + if (null === $this->sourceData) { + $carriers = $this->shippingConfig->getActiveCarriers(); + foreach ($carriers as $carrier) { + $this->sourceData[] = [ + 'value' => $carrier->getCarrierCode(), + 'label' => $carrier->getConfigData('title'), + ]; + } + } + return $this->sourceData; + } +} diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php index f639436053956..bb2d9f225bbee 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php @@ -3,13 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Inventory\Model\ResourceModel; -use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Inventory\Setup\InstallSchema; +/** + * This class is needed only for collection working + */ class SourceCarrierLink extends AbstractDb { /** @@ -21,25 +22,4 @@ protected function _construct() { $this->_init(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK, 'source_carrier_link_id'); } - - /** - * Delete all source carrier links by sourceId. - * - * @param SourceInterface $sourceId - * - * @throws \Exception - * - * @return $this - */ - public function deleteBySource(SourceInterface $source) - { - $connection = $this->getConnection(); - - $connection->delete( - $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK), - $connection->quoteInto('source_id = ?', $source->getId()) - ); - - return $this; - } } diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index 087d60badfb8e..8d37778f00afb 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -295,6 +295,22 @@ public function setPriority($priority) $this->setData(SourceInterface::PRIORITY, $priority); } + /** + * {@inheritdoc} + */ + public function isUseDefaultCarrierConfig() + { + return $this->getData(self::USE_DEFAULT_CARRIER_CONFIG); + } + + /** + * {@inheritdoc} + */ + public function setUseDefaultCarrierConfig($useDefaultCarrierConfig) + { + return $this->setData(self::USE_DEFAULT_CARRIER_CONFIG, $useDefaultCarrierConfig); + } + /** * @inheritdoc */ diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php index 5635df07340c8..c71ced6523d67 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php @@ -9,7 +9,6 @@ use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\App\ResourceConnection; use Magento\Framework\Exception\StateException; -use Magento\Framework\Model\AbstractModel; use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as ResourceSourceCarrierLink; use Magento\Inventory\Model\ResourceModel\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; @@ -107,7 +106,6 @@ private function deleteCurrentCarrierLinks(SourceInterface $source) private function saveNewCarrierLinks(SourceInterface $source) { $carrierLinkData = []; - /** @var SourceCarrierLinkInterface|AbstractModel $carrierLink */ foreach ($source->getCarrierLinks() as $carrierLink) { $carrierLinkData[] = [ 'source_id' => $source->getSourceId(), diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index bd386d47e81cc..d9fbffe8b4779 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -58,6 +58,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $sourceTable = $this->createSourceTable($setup); $sourceTable = $this->addAddressFields($sourceTable); $sourceTable = $this->addContactInfoFields($sourceTable); + $sourceTable = $this->addSourceCarrierFields($sourceTable); $setup->getConnection()->createTable($sourceTable); $setup->getConnection()->createTable($this->createSourceCarrierLinkTable($setup)); @@ -248,6 +249,26 @@ private function addContactInfoFields(Table $sourceTable) return $sourceTable; } + /** + * @param Table $sourceTable + * @return Table + */ + private function addSourceCarrierFields(Table $sourceTable) + { + $sourceTable->addColumn( + 'use_default_carrier_config', + Table::TYPE_SMALLINT, + null, + [ + 'unsigned' => true, + 'nullable' => false, + 'default' => '1' + ], + 'Use default carrier configuration' + ); + return $sourceTable; + } + /** * @param SchemaSetupInterface $setup * @return Table diff --git a/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php index 5d076da3102ac..997e72545e8a1 100644 --- a/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php +++ b/app/code/Magento/Inventory/Ui/DataProvider/SourceDataProvider.php @@ -83,8 +83,10 @@ public function getData() // For details see \Magento\Ui\Component\Form::getDataSourceData if ($data['totalRecords'] > 0) { $sourceId = $data['items'][0][SourceInterface::SOURCE_ID]; + $sourceGeneralData = $data['items'][0]; + $sourceGeneralData['carrier_codes'] = $this->getAssignedCarrierCodes($sourceId); $dataForSingle[$sourceId] = [ - 'general' => $data['items'][0], + 'general' => $sourceGeneralData, ]; $data = $dataForSingle; } else { @@ -110,4 +112,19 @@ public function getSearchResult() ); return $searchResult; } + + /** + * @param int $sourceId + * @return array + */ + private function getAssignedCarrierCodes($sourceId) + { + $source = $this->sourceRepository->get($sourceId); + + $carrierCodes = []; + foreach ($source->getCarrierLinks() as $carrierLink) { + $carrierCodes[] = $carrierLink->getCarrierCode(); + } + return $carrierCodes; + } } diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index 5728b4040954e..ccea64b89c796 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -67,7 +67,6 @@ - page 1 @@ -226,4 +225,48 @@ +
+ + + true + true + general + + + + + boolean + + + + + + 1 + 0 + + toggle + + + + + + + + Magento\Inventory\Model\OptionSource\CarrierSource + + + + + ${$.parentName}.use_default_carrier_config:checked + + + + + + +
diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php index a391977d0fe76..e40b1520f8fe8 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php @@ -32,6 +32,7 @@ interface SourceInterface extends ExtensibleDataInterface const PHONE = 'phone'; const FAX = 'fax'; const PRIORITY = 'priority'; + const USE_DEFAULT_CARRIER_CONFIG = 'use_default_carrier_config'; const CARRIER_LINKS = 'carrier_links'; /**#@-*/ @@ -290,6 +291,17 @@ public function getPriority(); */ public function setPriority($priority); + /** + * @return bool + */ + public function isUseDefaultCarrierConfig(); + + /** + * @param bool $useDefaultCarrierConfig + * @return $this + */ + public function setUseDefaultCarrierConfig($useDefaultCarrierConfig); + /** * @return \Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface[] */ diff --git a/app/code/Magento/Shipping/Model/Config.php b/app/code/Magento/Shipping/Model/Config.php index 5f477387b1542..bf42766be6b77 100644 --- a/app/code/Magento/Shipping/Model/Config.php +++ b/app/code/Magento/Shipping/Model/Config.php @@ -8,6 +8,8 @@ namespace Magento\Shipping\Model; +use Magento\Shipping\Model\Carrier\AbstractCarrierInterface; + /** * Class Config * @api @@ -58,7 +60,7 @@ public function __construct( * Retrieve active system carriers * * @param mixed $store - * @return array + * @return AbstractCarrierInterface[] */ public function getActiveCarriers($store = null) { @@ -79,7 +81,7 @@ public function getActiveCarriers($store = null) * Retrieve all system carriers * * @param mixed $store - * @return array + * @return AbstractCarrierInterface[] */ public function getAllCarriers($store = null) { From d350729716c604488deaf98eea5b2732344aa1bc Mon Sep 17 00:00:00 2001 From: larsroettig Date: Thu, 15 Jun 2017 19:05:05 +0200 Subject: [PATCH 0152/1004] magento-engcom/magento2#30 Resolve Country and region view in grid --- .../view/adminhtml/ui_component/inventory_source_listing.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml index cca94ff9318a6..954dce7b294b2 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml @@ -174,6 +174,7 @@ + false select select @@ -182,6 +183,7 @@ + false select select From d3597c3f35ded907bc352de553f6c5d0f5769f44 Mon Sep 17 00:00:00 2001 From: larsroettig Date: Fri, 16 Jun 2017 18:34:03 +0200 Subject: [PATCH 0153/1004] magento-engcom/magento2#30 add Filter Regions by selected Country in UI --- .../view/adminhtml/ui_component/inventory_source_form.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index ccea64b89c796..b7285d9d4b05e 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -193,6 +193,10 @@ From 3bb8630e373ce1613cef83fc18b6eeece5b9b278 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 19 Jun 2017 12:00:14 +0300 Subject: [PATCH 0154/1004] magento-engcom/magento2#25: Source API Implementation -- add carriers links assignment --- .../Source/CarrierRequestDataHydrator.php | 2 +- .../Controller/Adminhtml/Source/Save.php | 25 +++++++++++++------ .../Model/OptionSource/CarrierSource.php | 2 +- .../Inventory/Model/ResourceModel/Source.php | 3 ++- app/code/Magento/Inventory/etc/di.xml | 10 -------- .../ui_component/inventory_source_listing.xml | 1 - 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php index 7b9fa6947159f..2c4972db311dd 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php @@ -82,7 +82,7 @@ public function hydrate(SourceInterface $source, array $requestData) */ private function checkCarrierCodes(array $carrierCodes) { - $availableCarriers = $this->shippingConfig->getActiveCarriers(); + $availableCarriers = $this->shippingConfig->getAllCarriers(); if (count(array_intersect_key(array_flip($carrierCodes), $availableCarriers)) !== count($carrierCodes)) { throw new InputException(__('Wrong carrier codes data')); diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index e1632205bea06..0108f410f00cc 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -5,10 +5,12 @@ */ namespace Magento\Inventory\Controller\Adminhtml\Source; +use Exception; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; -use Magento\Framework\EntityManager\HydratorInterface; +use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\Exception\CouldNotSaveException; +use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Registry; use Magento\InventoryApi\Api\Data\SourceInterface; @@ -41,9 +43,9 @@ class Save extends Action private $sourceRepository; /** - * @var HydratorInterface + * @var DataObjectHelper */ - private $hydrator; + private $dataObjectHelper; /** * @var Registry @@ -59,7 +61,7 @@ class Save extends Action * @param Context $context * @param SourceInterfaceFactory $sourceFactory * @param SourceRepositoryInterface $sourceRepository - * @param HydratorInterface $hydrator + * @param DataObjectHelper $dataObjectHelper * @param CarrierRequestDataHydrator $carrierRequestDataHydrator * @param Registry $registry */ @@ -67,14 +69,14 @@ public function __construct( Context $context, SourceInterfaceFactory $sourceFactory, SourceRepositoryInterface $sourceRepository, - HydratorInterface $hydrator, + DataObjectHelper $dataObjectHelper, Registry $registry, CarrierRequestDataHydrator $carrierRequestDataHydrator ) { parent::__construct($context); $this->sourceFactory = $sourceFactory; $this->sourceRepository = $sourceRepository; - $this->hydrator = $hydrator; + $this->dataObjectHelper = $dataObjectHelper; $this->registry = $registry; $this->carrierRequestDataHydrator = $carrierRequestDataHydrator; } @@ -110,7 +112,14 @@ public function execute() $this->messageManager->addErrorMessage(__('The Source does not exist.')); $resultRedirect->setPath('*/*/'); } catch (CouldNotSaveException $e) { - $this->messageManager->addErrorMessage($e->getMessage()); + $errorMessage = $e->getMessage(); + } catch (InputException $e) { + $errorMessage = $e->getMessage(); + } catch (Exception $e) { + $errorMessage = __('Could not save source'); + } + if (isset($errorMessage)) { + $this->messageManager->addErrorMessage($errorMessage); if (empty($sourceId)) { $resultRedirect->setPath('*/*/'); } else { @@ -142,7 +151,7 @@ private function processSave(array $requestData) /** @var SourceInterface $source */ $source = $this->sourceFactory->create(); } - $source = $this->hydrator->hydrate($source, $requestData); + $source = $this->dataObjectHelper->populateWithArray($source, $requestData, SourceInterface::class); $source = $this->carrierRequestDataHydrator->hydrate($source, $requestData); $sourceId = $this->sourceRepository->save($source); diff --git a/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php b/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php index 6f4d65183fedb..1bb60603feed0 100644 --- a/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php +++ b/app/code/Magento/Inventory/Model/OptionSource/CarrierSource.php @@ -43,7 +43,7 @@ public function __construct(Config $shippingConfig) public function toOptionArray() { if (null === $this->sourceData) { - $carriers = $this->shippingConfig->getActiveCarriers(); + $carriers = $this->shippingConfig->getAllCarriers(); foreach ($carriers as $carrier) { $this->sourceData[] = [ 'value' => $carrier->getCarrierCode(), diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Source.php b/app/code/Magento/Inventory/Model/ResourceModel/Source.php index abcfdd180a660..08e24a89fa229 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/Source.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Source.php @@ -5,6 +5,7 @@ */ namespace Magento\Inventory\Model\ResourceModel; +use Exception; use Magento\Framework\Model\AbstractModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Framework\Model\ResourceModel\Db\Context; @@ -66,7 +67,7 @@ public function save(AbstractModel $object) /** @var SourceInterface $object */ $this->sourceCarrierLinkManagement->saveCarrierLinksBySource($object); $connection->commit(); - } catch (\Exception $e) { + } catch (Exception $e) { $connection->rollBack(); throw $e; } diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index 57c3414ce62b8..3c6091ff5561c 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -11,14 +11,4 @@ - - - - - Magento\Inventory\Setup\InstallSchema::TABLE_NAME_SOURCE - Magento\InventoryApi\Api\Data\SourceInterface::SOURCE_ID - - - - diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml index cca94ff9318a6..c38f71ff5dd0b 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_listing.xml @@ -267,7 +267,6 @@ - inventory/source/edit From f582e877dcefb87c17b69ffd9586349f52a1068e Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 19 Jun 2017 12:42:47 +0300 Subject: [PATCH 0155/1004] magento-engcom/magento2#25: Source API Implementation -- fix tests --- .../Source/CarrierRequestDataHydrator.php | 1 + .../Controller/Adminhtml/Source/Save.php | 85 ++++++++++++------- app/code/Magento/Inventory/composer.json | 1 + .../InventoryApi/Api/SourceRepositoryTest.php | 1 + 4 files changed, 56 insertions(+), 32 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php index 2c4972db311dd..edb0795b86e37 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php @@ -78,6 +78,7 @@ public function hydrate(SourceInterface $source, array $requestData) /** * @param array $carrierCodes + * @return void * @throws InputException */ private function checkCarrierCodes(array $carrierCodes) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index 0108f410f00cc..808852295f6ef 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -9,6 +9,7 @@ use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; use Magento\Framework\Api\DataObjectHelper; +use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; @@ -90,44 +91,28 @@ public function execute() $requestData = $this->getRequest()->getParam('general'); if ($this->getRequest()->isPost() && $requestData) { try { - $sourceId = $this->processSave($requestData); + $sourceId = !empty($requestData[SourceInterface::SOURCE_ID]) + ? $requestData[SourceInterface::SOURCE_ID] : null; + $sourceId = $this->processSave($sourceId, $requestData); // Keep data for plugins on Save controller. Now we can not call separate services from one form. $this->registry->register(self::REGISTRY_SOURCE_ID_KEY, $sourceId); $this->messageManager->addSuccessMessage(__('The Source has been saved.')); - if ($this->getRequest()->getParam('back')) { - $resultRedirect->setPath('*/*/edit', [ - SourceInterface::SOURCE_ID => $sourceId, - '_current' => true, - ]); - } elseif ($this->getRequest()->getParam('redirect_to_new')) { - $resultRedirect->setPath('*/*/new', [ - '_current' => true, - ]); - } else { - $resultRedirect->setPath('*/*/'); - } + $this->processRedirectAfterSuccessSave($resultRedirect, $sourceId); + } catch (NoSuchEntityException $e) { $this->messageManager->addErrorMessage(__('The Source does not exist.')); - $resultRedirect->setPath('*/*/'); + $this->processRedirectAfterFailureSave($resultRedirect); } catch (CouldNotSaveException $e) { - $errorMessage = $e->getMessage(); + $this->messageManager->addErrorMessage($e->getMessage()); + $this->processRedirectAfterFailureSave($resultRedirect, $sourceId); } catch (InputException $e) { - $errorMessage = $e->getMessage(); + $this->messageManager->addErrorMessage($e->getMessage()); + $this->processRedirectAfterFailureSave($resultRedirect, $sourceId); } catch (Exception $e) { - $errorMessage = __('Could not save source'); - } - if (isset($errorMessage)) { - $this->messageManager->addErrorMessage($errorMessage); - if (empty($sourceId)) { - $resultRedirect->setPath('*/*/'); - } else { - $resultRedirect->setPath('*/*/edit', [ - SourceInterface::SOURCE_ID => $sourceId, - '_current' => true, - ]); - } + $this->messageManager->addErrorMessage(__('Could not save source')); + $this->processRedirectAfterFailureSave($resultRedirect, $sourceId); } } else { $this->messageManager->addErrorMessage(__('Wrong request.')); @@ -137,14 +122,12 @@ public function execute() } /** + * @param $sourceId * @param array $requestData * @return int */ - private function processSave(array $requestData) + private function processSave($sourceId, array $requestData) { - $sourceId = !empty($requestData[SourceInterface::SOURCE_ID]) - ? $requestData[SourceInterface::SOURCE_ID] : null; - if ($sourceId) { $source = $this->sourceRepository->get($sourceId); } else { @@ -157,4 +140,42 @@ private function processSave(array $requestData) $sourceId = $this->sourceRepository->save($source); return $sourceId; } + + /** + * @param Redirect $resultRedirect + * @param int $sourceId + * @return void + */ + private function processRedirectAfterSuccessSave(Redirect $resultRedirect, $sourceId) + { + if ($this->getRequest()->getParam('back')) { + $resultRedirect->setPath('*/*/edit', [ + SourceInterface::SOURCE_ID => $sourceId, + '_current' => true, + ]); + } elseif ($this->getRequest()->getParam('redirect_to_new')) { + $resultRedirect->setPath('*/*/new', [ + '_current' => true, + ]); + } else { + $resultRedirect->setPath('*/*/'); + } + } + + /** + * @param $resultRedirect + * @param int|null $sourceId + * @return void + */ + private function processRedirectAfterFailureSave(Redirect $resultRedirect, $sourceId = null) + { + if (null === $sourceId) { + $resultRedirect->setPath('*/*/'); + } else { + $resultRedirect->setPath('*/*/edit', [ + SourceInterface::SOURCE_ID => $sourceId, + '_current' => true, + ]); + } + } } diff --git a/app/code/Magento/Inventory/composer.json b/app/code/Magento/Inventory/composer.json index 4ef710aca9fb8..45581db5f40bc 100644 --- a/app/code/Magento/Inventory/composer.json +++ b/app/code/Magento/Inventory/composer.json @@ -7,6 +7,7 @@ "magento/module-inventory-api": "100.0.*", "magento/module-backend": "100.2.*", "magento/module-directory": "100.2.*", + "magento/module-shipping": "100.2.*", "magento/module-ui": "100.2.*" }, "type": "magento2-module", diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index 7da8904c30919..a775b3f19529c 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -126,6 +126,7 @@ private function getSourceDataArray(SourceInterface $source) SourceInterface::LONGITUDE => $source->getLongitude(), SourceInterface::ENABLED => $source->isEnabled(), SourceInterface::PRIORITY => $source->getPriority(), + SourceInterface::USE_DEFAULT_CARRIER_CONFIG => $source->isUseDefaultCarrierConfig(), SourceInterface::CARRIER_LINKS => [] ]; From a4b8adbecf3f6535531c564bfc7bd5ac9392fb7d Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 19 Jun 2017 13:14:13 +0300 Subject: [PATCH 0156/1004] magento-engcom/magento2#25: Source API Implementation -- add carriers links assignment --- .../Inventory/Controller/Adminhtml/Source/Save.php | 6 +++--- .../view/adminhtml/ui_component/inventory_source_form.xml | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index 808852295f6ef..7d1185a6c9118 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -116,13 +116,13 @@ public function execute() } } else { $this->messageManager->addErrorMessage(__('Wrong request.')); - $resultRedirect->setPath('*/*'); + $this->processRedirectAfterFailureSave($resultRedirect); } return $resultRedirect; } /** - * @param $sourceId + * @param int $sourceId * @param array $requestData * @return int */ @@ -163,7 +163,7 @@ private function processRedirectAfterSuccessSave(Redirect $resultRedirect, $sour } /** - * @param $resultRedirect + * @param Redirect $resultRedirect * @param int|null $sourceId * @return void */ diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index ccea64b89c796..e7726ee341091 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -250,10 +250,6 @@
- - - Magento\Inventory\Model\OptionSource\CarrierSource - @@ -261,11 +257,11 @@ - + From 1850c97a40fdb4374a91cdb5dff6a6addf675749 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 19 Jun 2017 13:21:56 +0300 Subject: [PATCH 0157/1004] magento-engcom/magento2#25: Source API Implementation -- add carriers links assignment --- .../testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php index a775b3f19529c..ee56edfba18f1 100644 --- a/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/InventoryApi/Api/SourceRepositoryTest.php @@ -194,6 +194,7 @@ private function createRandomSource($countCarrier = 2, $postcode = '54321', $ena $source->setEnabled($enabled); $source->setPriority($priority); $source->setCarrierLinks($carriers); + $source->setUseDefaultCarrierConfig(true); return $source; } From 98f303bebb02cc855c1147f18312ffbd6392496b Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 19 Jun 2017 13:55:07 +0300 Subject: [PATCH 0158/1004] magento-engcom/magento2#25: Source API Implementation -- update composer.lock --- composer.lock | 488 +++++++++++++++++++++++++++----------------------- 1 file changed, 266 insertions(+), 222 deletions(-) diff --git a/composer.lock b/composer.lock index 659950f1d3d67..7ccbfcb6874b4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "16d03df808a8938009a500a058708054", - "content-hash": "755acb21c6c819ea0af7fdf2fa8a1e26", + "content-hash": "aa276f67ca493a4ad67bd7c45b69c4c8", "packages": [ { "name": "braintree/braintree_php", @@ -52,7 +51,7 @@ } ], "description": "Braintree PHP Client Library", - "time": "2017-02-16 19:59:04" + "time": "2017-02-16T19:59:04+00:00" }, { "name": "colinmollenhour/cache-backend-file", @@ -88,7 +87,7 @@ ], "description": "The stock Zend_Cache_Backend_File backend has extremely poor performance for cleaning by tags making it become unusable as the number of cached items increases. This backend makes many changes resulting in a huge performance boost, especially for tag cleaning.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_File", - "time": "2016-05-02 16:24:47" + "time": "2016-05-02T16:24:47+00:00" }, { "name": "colinmollenhour/cache-backend-redis", @@ -124,7 +123,7 @@ ], "description": "Zend_Cache backend using Redis with full support for tags.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_Redis", - "time": "2017-03-25 04:54:24" + "time": "2017-03-25T04:54:24+00:00" }, { "name": "colinmollenhour/credis", @@ -163,7 +162,7 @@ ], "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", "homepage": "https://github.com/colinmollenhour/credis", - "time": "2015-11-28 01:20:04" + "time": "2015-11-28T01:20:04+00:00" }, { "name": "colinmollenhour/php-redis-session-abstract", @@ -200,7 +199,7 @@ ], "description": "A Redis-based session handler with optimistic locking", "homepage": "https://github.com/colinmollenhour/php-redis-session-abstract", - "time": "2017-04-19 14:21:43" + "time": "2017-04-19T14:21:43+00:00" }, { "name": "composer/ca-bundle", @@ -259,7 +258,7 @@ "ssl", "tls" ], - "time": "2017-03-06 11:59:08" + "time": "2017-03-06T11:59:08+00:00" }, { "name": "composer/composer", @@ -336,7 +335,7 @@ "dependency", "package" ], - "time": "2017-03-10 08:29:45" + "time": "2017-03-10T08:29:45+00:00" }, { "name": "composer/semver", @@ -398,7 +397,7 @@ "validation", "versioning" ], - "time": "2016-08-30 16:08:34" + "time": "2016-08-30T16:08:34+00:00" }, { "name": "composer/spdx-licenses", @@ -459,7 +458,7 @@ "spdx", "validator" ], - "time": "2017-04-03 19:08:52" + "time": "2017-04-03T19:08:52+00:00" }, { "name": "container-interop/container-interop", @@ -490,20 +489,20 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14 19:40:03" + "time": "2017-02-14T19:40:03+00:00" }, { "name": "justinrainbow/json-schema", - "version": "5.2.0", + "version": "5.2.1", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "e3c9bccdc38bbd09bcac0131c00f3be58368b416" + "reference": "429be236f296ca249d61c65649cdf2652f4a5e80" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/e3c9bccdc38bbd09bcac0131c00f3be58368b416", - "reference": "e3c9bccdc38bbd09bcac0131c00f3be58368b416", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/429be236f296ca249d61c65649cdf2652f4a5e80", + "reference": "429be236f296ca249d61c65649cdf2652f4a5e80", "shasum": "" }, "require": { @@ -512,7 +511,7 @@ "require-dev": { "friendsofphp/php-cs-fixer": "^2.1", "json-schema/json-schema-test-suite": "1.2.0", - "phpdocumentor/phpdocumentor": "~2", + "phpdocumentor/phpdocumentor": "^2.7", "phpunit/phpunit": "^4.8.22" }, "bin": [ @@ -557,7 +556,7 @@ "json", "schema" ], - "time": "2017-03-22 22:43:35" + "time": "2017-05-16T21:06:09+00:00" }, { "name": "league/climate", @@ -606,7 +605,7 @@ "php", "terminal" ], - "time": "2015-01-18 14:31:58" + "time": "2015-01-18T14:31:58+00:00" }, { "name": "magento/composer", @@ -642,7 +641,7 @@ "AFL-3.0" ], "description": "Magento composer library helps to instantiate Composer application and run composer commands.", - "time": "2017-04-24 09:57:02" + "time": "2017-04-24T09:57:02+00:00" }, { "name": "magento/magento-composer-installer", @@ -721,7 +720,7 @@ "composer-installer", "magento" ], - "time": "2016-10-06 16:05:07" + "time": "2016-10-06T16:05:07+00:00" }, { "name": "magento/zendframework1", @@ -768,20 +767,20 @@ "ZF1", "framework" ], - "time": "2017-04-24 09:56:59" + "time": "2017-04-24T09:56:59+00:00" }, { "name": "monolog/monolog", - "version": "1.22.1", + "version": "1.23.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0" + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1e044bc4b34e91743943479f1be7a1d5eb93add0", - "reference": "1e044bc4b34e91743943479f1be7a1d5eb93add0", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", "shasum": "" }, "require": { @@ -802,7 +801,7 @@ "phpunit/phpunit-mock-objects": "2.3.0", "ruflin/elastica": ">=0.90 <3.0", "sentry/sentry": "^0.13", - "swiftmailer/swiftmailer": "~5.3" + "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -846,7 +845,7 @@ "logging", "psr-3" ], - "time": "2017-03-13 07:08:03" + "time": "2017-06-19T01:22:40+00:00" }, { "name": "oyejorge/less.php", @@ -908,7 +907,7 @@ "php", "stylesheet" ], - "time": "2017-03-28 22:19:25" + "time": "2017-03-28T22:19:25+00:00" }, { "name": "paragonie/random_compat", @@ -956,7 +955,7 @@ "pseudorandom", "random" ], - "time": "2017-03-13 16:27:32" + "time": "2017-03-13T16:27:32+00:00" }, { "name": "pelago/emogrifier", @@ -1012,20 +1011,20 @@ ], "description": "Converts CSS styles into inline style attributes in your HTML code", "homepage": "http://www.pelagodesign.com/sidecar/emogrifier/", - "time": "2015-05-15 11:37:51" + "time": "2015-05-15T11:37:51+00:00" }, { "name": "phpseclib/phpseclib", - "version": "2.0.4", + "version": "2.0.6", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf" + "reference": "34a7699e6f31b1ef4035ee36444407cecf9f56aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/ab8028c93c03cc8d9c824efa75dc94f1db2369bf", - "reference": "ab8028c93c03cc8d9c824efa75dc94f1db2369bf", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/34a7699e6f31b1ef4035ee36444407cecf9f56aa", + "reference": "34a7699e6f31b1ef4035ee36444407cecf9f56aa", "shasum": "" }, "require": { @@ -1104,7 +1103,7 @@ "x.509", "x509" ], - "time": "2016-10-04 00:57:04" + "time": "2017-06-05T06:31:10+00:00" }, { "name": "psr/container", @@ -1153,7 +1152,7 @@ "container-interop", "psr" ], - "time": "2017-02-14 16:28:37" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/log", @@ -1200,7 +1199,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "ramsey/uuid", @@ -1282,7 +1281,7 @@ "identifier", "uuid" ], - "time": "2017-03-26 20:37:53" + "time": "2017-03-26T20:37:53+00:00" }, { "name": "seld/cli-prompt", @@ -1330,20 +1329,20 @@ "input", "prompt" ], - "time": "2017-03-18 11:32:45" + "time": "2017-03-18T11:32:45+00:00" }, { "name": "seld/jsonlint", - "version": "1.6.0", + "version": "1.6.1", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8" + "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/791f8c594f300d246cdf01c6b3e1e19611e301d8", - "reference": "791f8c594f300d246cdf01c6b3e1e19611e301d8", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", + "reference": "50d63f2858d87c4738d5b76a7dcbb99fa8cf7c77", "shasum": "" }, "require": { @@ -1379,7 +1378,7 @@ "parser", "validator" ], - "time": "2017-03-06 16:42:24" + "time": "2017-06-18T15:11:04+00:00" }, { "name": "seld/phar-utils", @@ -1423,7 +1422,7 @@ "keywords": [ "phra" ], - "time": "2015-10-13 18:44:15" + "time": "2015-10-13T18:44:15+00:00" }, { "name": "sjparkinson/static-review", @@ -1476,20 +1475,20 @@ } ], "description": "An extendable framework for version control hooks.", - "time": "2014-09-22 08:40:36" + "time": "2014-09-22T08:40:36+00:00" }, { "name": "symfony/console", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e" + "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e", - "reference": "2cfcbced8e39e2313ed4da8896fc8c59a56c0d7e", + "url": "https://api.github.com/repos/symfony/console/zipball/3ef6ef64abecd566d551d9e7f6393ac6e93b2462", + "reference": "3ef6ef64abecd566d551d9e7f6393ac6e93b2462", "shasum": "" }, "require": { @@ -1537,7 +1536,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-04-26 01:38:53" + "time": "2017-06-02T14:36:56+00:00" }, { "name": "symfony/debug", @@ -1594,20 +1593,20 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-07-30 07:22:48" + "time": "2016-07-30T07:22:48+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "7fc8e2b4118ff316550596357325dfd92a51f531" + "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7fc8e2b4118ff316550596357325dfd92a51f531", - "reference": "7fc8e2b4118ff316550596357325dfd92a51f531", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/1377400fd641d7d1935981546aaef780ecd5bf6d", + "reference": "1377400fd641d7d1935981546aaef780ecd5bf6d", "shasum": "" }, "require": { @@ -1654,20 +1653,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-04-26 16:56:54" + "time": "2017-06-02T07:47:27+00:00" }, { "name": "symfony/filesystem", - "version": "v3.2.8", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "040651db13cf061827a460cc10f6e36a445c45b4" + "reference": "c709670bf64721202ddbe4162846f250735842c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/040651db13cf061827a460cc10f6e36a445c45b4", - "reference": "040651db13cf061827a460cc10f6e36a445c45b4", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/c709670bf64721202ddbe4162846f250735842c0", + "reference": "c709670bf64721202ddbe4162846f250735842c0", "shasum": "" }, "require": { @@ -1676,7 +1675,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -1703,20 +1702,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-05-28T14:08:56+00:00" }, { "name": "symfony/finder", - "version": "v3.2.8", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "9cf076f8f492f4b1ffac40aae9c2d287b4ca6930" + "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/9cf076f8f492f4b1ffac40aae9c2d287b4ca6930", - "reference": "9cf076f8f492f4b1ffac40aae9c2d287b4ca6930", + "url": "https://api.github.com/repos/symfony/finder/zipball/baea7f66d30854ad32988c11a09d7ffd485810c4", + "reference": "baea7f66d30854ad32988c11a09d7ffd485810c4", "shasum": "" }, "require": { @@ -1725,7 +1724,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -1752,20 +1751,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-06-01T21:01:25+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + "reference": "f29dca382a6485c3cbe6379f0c61230167681937" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", - "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/f29dca382a6485c3cbe6379f0c61230167681937", + "reference": "f29dca382a6485c3cbe6379f0c61230167681937", "shasum": "" }, "require": { @@ -1777,7 +1776,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -1811,20 +1810,20 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-06-09T14:24:12+00:00" }, { "name": "symfony/process", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "aff35fb3dee799c84a7313c576b72208b046ef8d" + "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/aff35fb3dee799c84a7313c576b72208b046ef8d", - "reference": "aff35fb3dee799c84a7313c576b72208b046ef8d", + "url": "https://api.github.com/repos/symfony/process/zipball/d54232f5682fda2f8bbebff7c81b864646867ab9", + "reference": "d54232f5682fda2f8bbebff7c81b864646867ab9", "shasum": "" }, "require": { @@ -1860,7 +1859,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:07:15" + "time": "2017-05-08T01:19:21+00:00" }, { "name": "tedivm/jshrink", @@ -1906,7 +1905,7 @@ "javascript", "minifier" ], - "time": "2015-07-04 07:35:09" + "time": "2015-07-04T07:35:09+00:00" }, { "name": "tubalmartin/cssmin", @@ -1959,7 +1958,7 @@ "minify", "yui" ], - "time": "2017-05-16 13:45:26" + "time": "2017-05-16T13:45:26+00:00" }, { "name": "zendframework/zend-captcha", @@ -2016,7 +2015,7 @@ "captcha", "zf2" ], - "time": "2017-02-23 08:09:44" + "time": "2017-02-23T08:09:44+00:00" }, { "name": "zendframework/zend-code", @@ -2069,7 +2068,7 @@ "code", "zf2" ], - "time": "2016-10-24 13:23:32" + "time": "2016-10-24T13:23:32+00:00" }, { "name": "zendframework/zend-config", @@ -2125,7 +2124,7 @@ "config", "zf2" ], - "time": "2016-02-04 23:01:10" + "time": "2016-02-04T23:01:10+00:00" }, { "name": "zendframework/zend-console", @@ -2177,7 +2176,7 @@ "console", "zf2" ], - "time": "2016-02-09 17:15:12" + "time": "2016-02-09T17:15:12+00:00" }, { "name": "zendframework/zend-crypt", @@ -2227,7 +2226,7 @@ "crypt", "zf2" ], - "time": "2016-02-03 23:46:30" + "time": "2016-02-03T23:46:30+00:00" }, { "name": "zendframework/zend-db", @@ -2284,7 +2283,7 @@ "db", "zf2" ], - "time": "2016-08-09 19:28:55" + "time": "2016-08-09T19:28:55+00:00" }, { "name": "zendframework/zend-di", @@ -2331,7 +2330,7 @@ "di", "zf2" ], - "time": "2016-04-25 20:58:11" + "time": "2016-04-25T20:58:11+00:00" }, { "name": "zendframework/zend-escaper", @@ -2375,7 +2374,7 @@ "escaper", "zf2" ], - "time": "2016-06-30 19:48:38" + "time": "2016-06-30T19:48:38+00:00" }, { "name": "zendframework/zend-eventmanager", @@ -2422,20 +2421,20 @@ "eventmanager", "zf2" ], - "time": "2016-02-18 20:49:05" + "time": "2016-02-18T20:49:05+00:00" }, { "name": "zendframework/zend-filter", - "version": "2.7.1", + "version": "2.7.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-filter.git", - "reference": "84c50246428efb0a1e52868e162dab3e149d5b80" + "reference": "b8d0ff872f126631bf63a932e33aa2d22d467175" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/84c50246428efb0a1e52868e162dab3e149d5b80", - "reference": "84c50246428efb0a1e52868e162dab3e149d5b80", + "url": "https://api.github.com/repos/zendframework/zend-filter/zipball/b8d0ff872f126631bf63a932e33aa2d22d467175", + "reference": "b8d0ff872f126631bf63a932e33aa2d22d467175", "shasum": "" }, "require": { @@ -2443,10 +2442,10 @@ "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", "pear/archive_tar": "^1.4", - "phpunit/phpunit": "~4.0", - "zendframework/zend-crypt": "^2.6", + "phpunit/phpunit": "^6.0.10 || ^5.7.17", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-crypt": "^2.6 || ^3.0", "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", "zendframework/zend-uri": "^2.5" }, @@ -2482,20 +2481,20 @@ "filter", "zf2" ], - "time": "2016-04-18 18:32:43" + "time": "2017-05-17T20:56:17+00:00" }, { "name": "zendframework/zend-form", - "version": "2.10.1", + "version": "2.10.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-form.git", - "reference": "1ca3ab771abd533d440646ec1cc082fccad976a1" + "reference": "252db729887844025772bb8045f8df605850ed9c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-form/zipball/1ca3ab771abd533d440646ec1cc082fccad976a1", - "reference": "1ca3ab771abd533d440646ec1cc082fccad976a1", + "url": "https://api.github.com/repos/zendframework/zend-form/zipball/252db729887844025772bb8045f8df605850ed9c", + "reference": "252db729887844025772bb8045f8df605850ed9c", "shasum": "" }, "require": { @@ -2559,7 +2558,7 @@ "form", "zf2" ], - "time": "2017-04-26 21:27:43" + "time": "2017-05-18T14:59:53+00:00" }, { "name": "zendframework/zend-http", @@ -2609,7 +2608,7 @@ "http", "zf2" ], - "time": "2017-01-31 14:41:02" + "time": "2017-01-31T14:41:02+00:00" }, { "name": "zendframework/zend-hydrator", @@ -2667,30 +2666,30 @@ "hydrator", "zf2" ], - "time": "2016-02-18 22:38:26" + "time": "2016-02-18T22:38:26+00:00" }, { "name": "zendframework/zend-i18n", - "version": "2.7.3", + "version": "2.7.4", "source": { "type": "git", "url": "https://github.com/zendframework/zend-i18n.git", - "reference": "b2db0d8246a865c659f93199f90f5fc2cd2f3cd8" + "reference": "d3431e29cc00c2a1c6704e601d4371dbf24f6a31" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/b2db0d8246a865c659f93199f90f5fc2cd2f3cd8", - "reference": "b2db0d8246a865c659f93199f90f5fc2cd2f3cd8", + "url": "https://api.github.com/repos/zendframework/zend-i18n/zipball/d3431e29cc00c2a1c6704e601d4371dbf24f6a31", + "reference": "d3431e29cc00c2a1c6704e601d4371dbf24f6a31", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", + "php": "^7.0 || ^5.6", "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", + "phpunit/phpunit": "^6.0.8 || ^5.7.15", "zendframework/zend-cache": "^2.6.1", + "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-config": "^2.6", "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", "zendframework/zend-filter": "^2.6.1", @@ -2734,31 +2733,31 @@ "i18n", "zf2" ], - "time": "2016-06-07 21:08:30" + "time": "2017-05-17T17:00:12+00:00" }, { "name": "zendframework/zend-inputfilter", - "version": "2.7.3", + "version": "2.7.4", "source": { "type": "git", "url": "https://github.com/zendframework/zend-inputfilter.git", - "reference": "0cf1bdcd8858a8583965310a7dae63ad75bd1237" + "reference": "699ab4916e0aa73104e1f9ff068ef6d33c5f5fe4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-inputfilter/zipball/0cf1bdcd8858a8583965310a7dae63ad75bd1237", - "reference": "0cf1bdcd8858a8583965310a7dae63ad75bd1237", + "url": "https://api.github.com/repos/zendframework/zend-inputfilter/zipball/699ab4916e0aa73104e1f9ff068ef6d33c5f5fe4", + "reference": "699ab4916e0aa73104e1f9ff068ef6d33c5f5fe4", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", + "php": "^7.0 || ^5.6", "zendframework/zend-filter": "^2.6", "zendframework/zend-stdlib": "^2.7 || ^3.0", "zendframework/zend-validator": "^2.6" }, "require-dev": { - "phpunit/phpunit": "^4.8", - "squizlabs/php_codesniffer": "^2.6.2", + "phpunit/phpunit": "^6.0.8 || ^5.7.15", + "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" }, "suggest": { @@ -2789,7 +2788,7 @@ "inputfilter", "zf2" ], - "time": "2016-08-18 18:40:34" + "time": "2017-05-18T14:20:56+00:00" }, { "name": "zendframework/zend-json", @@ -2844,7 +2843,7 @@ "json", "zf2" ], - "time": "2016-02-04 21:20:26" + "time": "2016-02-04T21:20:26+00:00" }, { "name": "zendframework/zend-loader", @@ -2888,20 +2887,20 @@ "loader", "zf2" ], - "time": "2015-06-03 14:05:47" + "time": "2015-06-03T14:05:47+00:00" }, { "name": "zendframework/zend-log", - "version": "2.9.1", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-log.git", - "reference": "115d75db1f8fb29efbf1b9a49cb91c662b7195dc" + "reference": "bf7489578d092d6ff7508117d1d920a4764fbd6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-log/zipball/115d75db1f8fb29efbf1b9a49cb91c662b7195dc", - "reference": "115d75db1f8fb29efbf1b9a49cb91c662b7195dc", + "url": "https://api.github.com/repos/zendframework/zend-log/zipball/bf7489578d092d6ff7508117d1d920a4764fbd6a", + "reference": "bf7489578d092d6ff7508117d1d920a4764fbd6a", "shasum": "" }, "require": { @@ -2914,9 +2913,9 @@ "psr/log-implementation": "1.0.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~1.7.0", "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "~4.0", + "phpunit/phpunit": "^5.7.15 || ^6.0.8", + "zendframework/zend-coding-standard": "~1.0.0", "zendframework/zend-db": "^2.6", "zendframework/zend-escaper": "^2.5", "zendframework/zend-filter": "^2.5", @@ -2959,7 +2958,7 @@ "logging", "zf2" ], - "time": "2016-08-11 13:44:10" + "time": "2017-05-17T16:03:26+00:00" }, { "name": "zendframework/zend-math", @@ -3009,7 +3008,7 @@ "math", "zf2" ], - "time": "2016-04-07 16:29:53" + "time": "2016-04-07T16:29:53+00:00" }, { "name": "zendframework/zend-modulemanager", @@ -3068,7 +3067,7 @@ "modulemanager", "zf2" ], - "time": "2016-05-16 21:21:11" + "time": "2016-05-16T21:21:11+00:00" }, { "name": "zendframework/zend-mvc", @@ -3155,7 +3154,7 @@ "mvc", "zf2" ], - "time": "2016-02-23 15:24:59" + "time": "2016-02-23T15:24:59+00:00" }, { "name": "zendframework/zend-serializer", @@ -3212,7 +3211,7 @@ "serializer", "zf2" ], - "time": "2016-06-21 17:01:55" + "time": "2016-06-21T17:01:55+00:00" }, { "name": "zendframework/zend-server", @@ -3258,7 +3257,7 @@ "server", "zf2" ], - "time": "2016-06-20 22:27:55" + "time": "2016-06-20T22:27:55+00:00" }, { "name": "zendframework/zend-servicemanager", @@ -3310,7 +3309,7 @@ "servicemanager", "zf2" ], - "time": "2016-12-19 19:14:29" + "time": "2016-12-19T19:14:29+00:00" }, { "name": "zendframework/zend-session", @@ -3376,7 +3375,7 @@ "session", "zf2" ], - "time": "2016-07-05 18:32:50" + "time": "2016-07-05T18:32:50+00:00" }, { "name": "zendframework/zend-soap", @@ -3428,7 +3427,7 @@ "soap", "zf2" ], - "time": "2016-04-21 16:06:27" + "time": "2016-04-21T16:06:27+00:00" }, { "name": "zendframework/zend-stdlib", @@ -3487,7 +3486,7 @@ "stdlib", "zf2" ], - "time": "2016-04-12 21:17:31" + "time": "2016-04-12T21:17:31+00:00" }, { "name": "zendframework/zend-text", @@ -3534,7 +3533,7 @@ "text", "zf2" ], - "time": "2016-02-08 19:03:52" + "time": "2016-02-08T19:03:52+00:00" }, { "name": "zendframework/zend-uri", @@ -3581,20 +3580,20 @@ "uri", "zf2" ], - "time": "2016-02-17 22:38:51" + "time": "2016-02-17T22:38:51+00:00" }, { "name": "zendframework/zend-validator", - "version": "2.9.0", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-validator.git", - "reference": "b71641582297eab52753b72cd4eb45a5ded4485c" + "reference": "c9a8160a0191e34bb98ac1ecd4e453391c424bb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/b71641582297eab52753b72cd4eb45a5ded4485c", - "reference": "b71641582297eab52753b72cd4eb45a5ded4485c", + "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/c9a8160a0191e34bb98ac1ecd4e453391c424bb3", + "reference": "c9a8160a0191e34bb98ac1ecd4e453391c424bb3", "shasum": "" }, "require": { @@ -3652,7 +3651,7 @@ "validator", "zf2" ], - "time": "2017-03-17 10:15:50" + "time": "2017-05-17T22:06:13+00:00" }, { "name": "zendframework/zend-view", @@ -3739,7 +3738,7 @@ "view", "zf2" ], - "time": "2017-03-21 15:05:56" + "time": "2017-03-21T15:05:56+00:00" } ], "packages-dev": [ @@ -3795,7 +3794,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -3865,7 +3864,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2017-03-31 12:59:38" + "time": "2017-03-31T12:59:38+00:00" }, { "name": "ircmaxell/password-compat", @@ -3907,7 +3906,7 @@ "hashing", "password" ], - "time": "2014-11-20 16:49:30" + "time": "2014-11-20T16:49:30+00:00" }, { "name": "lusitanian/oauth", @@ -3974,7 +3973,7 @@ "oauth", "security" ], - "time": "2016-07-12 22:15:40" + "time": "2016-07-12T22:15:40+00:00" }, { "name": "pdepend/pdepend", @@ -4014,7 +4013,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2017-01-19 14:23:36" + "time": "2017-01-19T14:23:36+00:00" }, { "name": "phpmd/phpmd", @@ -4080,7 +4079,7 @@ "phpmd", "pmd" ], - "time": "2017-01-20 14:41:10" + "time": "2017-01-20T14:41:10+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4142,7 +4141,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4187,7 +4186,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2013-10-10T15:34:57+00:00" }, { "name": "phpunit/php-text-template", @@ -4228,7 +4227,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -4277,7 +4276,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", @@ -4326,7 +4325,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27 10:12:30" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", @@ -4400,7 +4399,7 @@ "testing", "xunit" ], - "time": "2014-05-02 07:13:40" + "time": "2014-05-02T07:13:40+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -4456,7 +4455,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", @@ -4520,27 +4519,27 @@ "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -4572,7 +4571,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", @@ -4622,7 +4621,7 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", @@ -4689,7 +4688,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/finder-facade", @@ -4728,7 +4727,7 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2016-02-17 07:02:23" + "time": "2016-02-17T07:02:23+00:00" }, { "name": "sebastian/phpcpd", @@ -4779,7 +4778,7 @@ ], "description": "Copy/Paste Detector (CPD) for PHP code.", "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2016-04-17 19:32:49" + "time": "2016-04-17T19:32:49+00:00" }, { "name": "sebastian/recursion-context", @@ -4832,7 +4831,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03 07:41:43" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", @@ -4867,7 +4866,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -4942,11 +4941,11 @@ "phpcs", "standards" ], - "time": "2014-05-01 03:07:07" + "time": "2014-05-01T03:07:07+00:00" }, { "name": "symfony/config", - "version": "v3.2.8", + "version": "v3.2.9", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -4998,7 +4997,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/dependency-injection", @@ -5058,20 +5057,20 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-01-28 00:04:57" + "time": "2017-01-28T00:04:57+00:00" }, { "name": "symfony/polyfill-php54", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0" + "reference": "7dd1a8b9f0442273fdfeb1c4f5eaff6890a82789" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/7dd1a8b9f0442273fdfeb1c4f5eaff6890a82789", + "reference": "7dd1a8b9f0442273fdfeb1c4f5eaff6890a82789", "shasum": "" }, "require": { @@ -5080,7 +5079,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -5116,20 +5115,20 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-06-09T08:25:21+00:00" }, { "name": "symfony/polyfill-php55", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67" + "reference": "94566239a7720cde0820f15f0cc348ddb51ba51d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/03e3f0350bca2220e3623a0e340eef194405fc67", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/94566239a7720cde0820f15f0cc348ddb51ba51d", + "reference": "94566239a7720cde0820f15f0cc348ddb51ba51d", "shasum": "" }, "require": { @@ -5139,7 +5138,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -5172,20 +5171,20 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-06-09T08:25:21+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "13ce343935f0f91ca89605a2f6ca6f5c2f3faac2" + "reference": "032fd647d5c11a9ceab8ee8747e13b5448e93874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/13ce343935f0f91ca89605a2f6ca6f5c2f3faac2", - "reference": "13ce343935f0f91ca89605a2f6ca6f5c2f3faac2", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/032fd647d5c11a9ceab8ee8747e13b5448e93874", + "reference": "032fd647d5c11a9ceab8ee8747e13b5448e93874", "shasum": "" }, "require": { @@ -5195,7 +5194,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -5231,37 +5230,34 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-06-09T14:24:12+00:00" }, { - "name": "symfony/polyfill-xml", - "version": "v1.3.0", + "name": "symfony/polyfill-php72", + "version": "v1.4.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-xml.git", - "reference": "64b6a864f18ab4fddad49f5025f805f6781dfabd" + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "d3a71580c1e2cab33b6d705f0ec40e9015e14d5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-xml/zipball/64b6a864f18ab4fddad49f5025f805f6781dfabd", - "reference": "64b6a864f18ab4fddad49f5025f805f6781dfabd", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/d3a71580c1e2cab33b6d705f0ec40e9015e14d5c", + "reference": "d3a71580c1e2cab33b6d705f0ec40e9015e14d5c", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "suggest": { - "ext-xml": "For best performance" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Xml\\": "" + "Symfony\\Polyfill\\Php72\\": "" }, "files": [ "bootstrap.php" @@ -5281,6 +5277,54 @@ "homepage": "https://symfony.com/contributors" } ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-06-09T08:25:21+00:00" + }, + { + "name": "symfony/polyfill-xml", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-xml.git", + "reference": "89326af9d173053826ae8fe26a6f49597ba4e9f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-xml/zipball/89326af9d173053826ae8fe26a6f49597ba4e9f3", + "reference": "89326af9d173053826ae8fe26a6f49597ba4e9f3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-php72": "~1.4" + }, + "type": "metapackage", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], "description": "Symfony polyfill for xml's utf8_encode and utf8_decode functions", "homepage": "https://symfony.com", "keywords": [ @@ -5289,20 +5333,20 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2017-06-09T08:25:21+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.2.8", + "version": "v3.3.2", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "5a0105afb670dbd38f521105c444de1b8e10cfe3" + "reference": "602a15299dc01556013b07167d4f5d3a60e90d15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5a0105afb670dbd38f521105c444de1b8e10cfe3", - "reference": "5a0105afb670dbd38f521105c444de1b8e10cfe3", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/602a15299dc01556013b07167d4f5d3a60e90d15", + "reference": "602a15299dc01556013b07167d4f5d3a60e90d15", "shasum": "" }, "require": { @@ -5311,7 +5355,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -5338,20 +5382,20 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:14:56+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.20", + "version": "v2.8.22", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02" + "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/93ccdde79f4b079c7558da4656a3cb1c50c68e02", - "reference": "93ccdde79f4b079c7558da4656a3cb1c50c68e02", + "url": "https://api.github.com/repos/symfony/yaml/zipball/4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", + "reference": "4c29dec8d489c4e37cf87ccd7166cd0b0e6a45c5", "shasum": "" }, "require": { @@ -5387,7 +5431,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-05-01 14:31:55" + "time": "2017-06-01T20:52:29+00:00" }, { "name": "theseer/fdomdocument", @@ -5427,7 +5471,7 @@ ], "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2017-04-21 14:50:31" + "time": "2017-04-21T14:50:31+00:00" } ], "aliases": [], From 22fdba12eae27d14f4d2a3edfc9a1538e9afbb93 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 20 Jun 2017 13:08:43 +0300 Subject: [PATCH 0159/1004] magento-engcom/magento2#25: Source API Implementation -- work on region fields, system configuration of default carriers --- .../Controller/Adminhtml/Source/Save.php | 2 +- .../Inventory/etc/adminhtml/system.xml | 32 +++++++++++++++++++ app/code/Magento/Inventory/etc/config.xml | 16 ++++++++++ .../ui_component/inventory_source_form.xml | 15 +++++++-- 4 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 app/code/Magento/Inventory/etc/adminhtml/system.xml create mode 100644 app/code/Magento/Inventory/etc/config.xml diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index 7d1185a6c9118..0f51090bdda7b 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -134,7 +134,7 @@ private function processSave($sourceId, array $requestData) /** @var SourceInterface $source */ $source = $this->sourceFactory->create(); } - $source = $this->dataObjectHelper->populateWithArray($source, $requestData, SourceInterface::class); + $this->dataObjectHelper->populateWithArray($source, $requestData, SourceInterface::class); $source = $this->carrierRequestDataHydrator->hydrate($source, $requestData); $sourceId = $this->sourceRepository->save($source); diff --git a/app/code/Magento/Inventory/etc/adminhtml/system.xml b/app/code/Magento/Inventory/etc/adminhtml/system.xml new file mode 100644 index 0000000000000..d3dae5ae364a9 --- /dev/null +++ b/app/code/Magento/Inventory/etc/adminhtml/system.xml @@ -0,0 +1,32 @@ + + + + +
+ + catalog + Magento_Inventory::inventory + + + + + Magento\Config\Model\Config\Source\Yesno + + + + Magento\Inventory\Model\OptionSource\CarrierSource + 1 + Use Ctrl+click for unset value + + 0 + + + +
+
+
diff --git a/app/code/Magento/Inventory/etc/config.xml b/app/code/Magento/Inventory/etc/config.xml new file mode 100644 index 0000000000000..04ae8ba2145d0 --- /dev/null +++ b/app/code/Magento/Inventory/etc/config.xml @@ -0,0 +1,16 @@ + + + + + + + 1 + + + + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index e7726ee341091..c4fa763cdd1e8 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -193,6 +193,11 @@ @@ -201,6 +206,7 @@ text + false
@@ -229,10 +235,15 @@ true - true + false general + + + 1 + + boolean @@ -253,7 +264,7 @@ - ${$.parentName}.use_default_carrier_config:checked + !${$.parentName}.use_default_carrier_config:checked From 82049c78cdb6055b0179b6178a4429fcea9a4c33 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 21 Jun 2017 18:49:38 +0300 Subject: [PATCH 0160/1004] MAGETWO-67066: Changing the values and forms for system customer attribute --- .../Customer/Test/Block/Address/Edit.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.php b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.php index 4f331baa20cd8..a9887b24bf3d8 100644 --- a/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.php +++ b/dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.php @@ -30,6 +30,13 @@ class Edit extends Form */ protected $vatFieldId = 'vat_id'; + /** + * Locator for address simple (input, textarea, not multiple fields) attribute + * + * @var string + */ + private $addressSimpleAttribute = "[name='%s']"; + /** * Edit customer address * @@ -77,4 +84,15 @@ protected function dataMapping(array $fields = null, $parent = null) } return parent::dataMapping($fields, $parent); } + + /** + * Check if Customer Address Simple(input, textarea, not multiple fields) Attribute visible + * + * @param string $attributeCode + * @return bool + */ + public function isAddressSimpleAttributeVisible($attributeCode) + { + return $this->_rootElement->find(sprintf($this->addressSimpleAttribute, $attributeCode))->isVisible(); + } } From be1d21ea7c226fc095d257c5df1d244539e53ef3 Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Mon, 26 Jun 2017 13:01:16 +0100 Subject: [PATCH 0161/1004] magento-engcom/magento#34: Source to Stock Mapping UI and API - created Resource models, models and APIs --- .../Inventory/Model/ResourceModel/Stock.php | 35 ++++++++ .../Model/ResourceModel/Stock/Collection.php | 54 ++++++++++++ app/code/Magento/Inventory/Model/Stock.php | 83 +++++++++++++++++++ .../InventoryApi/Api/Data/StockInterface.php | 51 ++++++++++++ .../Api/Data/StockSearchResultsInterface.php | 29 +++++++ .../Api/StockRepositoryInterface.php | 41 +++++++++ 6 files changed, 293 insertions(+) create mode 100644 app/code/Magento/Inventory/Model/ResourceModel/Stock.php create mode 100644 app/code/Magento/Inventory/Model/ResourceModel/Stock/Collection.php create mode 100644 app/code/Magento/Inventory/Model/Stock.php create mode 100644 app/code/Magento/InventoryApi/Api/Data/StockInterface.php create mode 100644 app/code/Magento/InventoryApi/Api/Data/StockSearchResultsInterface.php create mode 100644 app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Stock.php b/app/code/Magento/Inventory/Model/ResourceModel/Stock.php new file mode 100644 index 0000000000000..0493faaf547ab --- /dev/null +++ b/app/code/Magento/Inventory/Model/ResourceModel/Stock.php @@ -0,0 +1,35 @@ +_init(InstallSchema::TABLE_NAME_STOCK, StockInterface::STOCK_ID); + } +} diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Stock/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/Stock/Collection.php new file mode 100644 index 0000000000000..5f4f2532295c1 --- /dev/null +++ b/app/code/Magento/Inventory/Model/ResourceModel/Stock/Collection.php @@ -0,0 +1,54 @@ +_init(StockModel::class, ResourceStock::class); + } +} diff --git a/app/code/Magento/Inventory/Model/Stock.php b/app/code/Magento/Inventory/Model/Stock.php new file mode 100644 index 0000000000000..9724fa9eb6044 --- /dev/null +++ b/app/code/Magento/Inventory/Model/Stock.php @@ -0,0 +1,83 @@ +_init(\Magento\Inventory\Model\ResourceModel\Stock::class); + } + + /** + * @inheritdoc + */ + public function getStockId() + { + return $this->getData(StockInterface::STOCK_ID); + } + + /** + * @inheritdoc + */ + public function setStockId($stockId) + { + $this->setData(StockInterface::STOCK_ID, $stockId); + } + + /** + * @inheritdoc + */ + public function getName() + { + return $this->getData(StockInterface::NAME); + } + + /** + * @inheritdoc + */ + public function setName($name) + { + $this->setData(StockInterface::NAME, $name); + } + + /** + * @inheritdoc + */ + public function getExtensionAttributes() + { + $extensionAttributes = $this->_getExtensionAttributes(); + if (null === $extensionAttributes) { + $extensionAttributes = $this->extensionAttributesFactory->create(StockInterface::class); + $this->setExtensionAttributes($extensionAttributes); + } + return $extensionAttributes; + } + + /** + * @inheritdoc + */ + public function setExtensionAttributes( + \Magento\InventoryApi\Api\Data\StockExtensionInterface $extensionAttributes + ) { + return $this->_setExtensionAttributes($extensionAttributes); + } +} diff --git a/app/code/Magento/InventoryApi/Api/Data/StockInterface.php b/app/code/Magento/InventoryApi/Api/Data/StockInterface.php new file mode 100644 index 0000000000000..b754c0daa1837 --- /dev/null +++ b/app/code/Magento/InventoryApi/Api/Data/StockInterface.php @@ -0,0 +1,51 @@ + Date: Mon, 26 Jun 2017 14:04:19 +0100 Subject: [PATCH 0162/1004] agento-engcom/magento#34: Source to Stock Mapping UI and API --- .../Ui/DataProvider/StockDataProvider.php | 130 ++++++++ .../layout/inventory_stock_index.xml | 15 + .../ui_component/inventory_stock_listing.xml | 282 ++++++++++++++++++ 3 files changed, 427 insertions(+) create mode 100644 app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php create mode 100644 app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_index.xml create mode 100644 app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_listing.xml diff --git a/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php new file mode 100644 index 0000000000000..ff6fb225bb0ff --- /dev/null +++ b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php @@ -0,0 +1,130 @@ +sourceRepository = $sourceRepository; + $this->searchResultFactory = $searchResultFactory; + } + + /** + * {@inheritdoc} + */ + public function getData() + { + $data = parent::getData(); + if ('inventory_source_form_data_source' === $this->name) { + // It is need for support of several fieldsets. + // For details see \Magento\Ui\Component\Form::getDataSourceData + if ($data['totalRecords'] > 0) { + $sourceId = $data['items'][0][SourceInterface::SOURCE_ID]; + $sourceGeneralData = $data['items'][0]; + $sourceGeneralData['carrier_codes'] = $this->getAssignedCarrierCodes($sourceId); + $dataForSingle[$sourceId] = [ + 'general' => $sourceGeneralData, + ]; + $data = $dataForSingle; + } else { + $data = []; + } + } + return $data; + } + + /** + * {@inheritdoc} + */ + public function getSearchResult() + { + $searchCriteria = $this->getSearchCriteria(); + $result = $this->sourceRepository->getList($searchCriteria); + + $searchResult = $this->searchResultFactory->create( + $result->getItems(), + $result->getTotalCount(), + $searchCriteria, + SourceInterface::SOURCE_ID + ); + return $searchResult; + } + + /** + * @param int $sourceId + * @return array + */ + private function getAssignedCarrierCodes($sourceId) + { + $source = $this->sourceRepository->get($sourceId); + + $carrierCodes = []; + foreach ($source->getCarrierLinks() as $carrierLink) { + $carrierCodes[] = $carrierLink->getCarrierCode(); + } + return $carrierCodes; + } +} diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_index.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_index.xml new file mode 100644 index 0000000000000..890d2ae5a5bcb --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_index.xml @@ -0,0 +1,15 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_listing.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_listing.xml new file mode 100644 index 0000000000000..1f7bc1a4bd294 --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_listing.xml @@ -0,0 +1,282 @@ + + ++ + + inventory_stock_listing.inventory_stock_listing_data_stock + + + + + + + inventory_stock_listing_columns + + inventory_stock_listing.inventory_stock_listing_data_stock + + + + + + stock_id + + + + + + id + stock_id + + + + + + true + + + + + + + + + + + + + + + + + + + + + + false + + stock_id + true + inventory_stock_listing.inventory_stock_listing.inventory_stock_listing_columns.ids + + + + inventory_stock_listing.inventory_stock_listing.inventory_stock_listing_columns_editor + startEdit + + ${ $.$data.rowIndex } + true + + + + + + + stock_id + + + + + textRange + + asc + + + + + text + + + text + + true + + + + + + + text + + text + + + false + + + + + text + + text + + true + + + + false + + + + + + select + select + + + + + + + + + text + + text + + true + + + + false + + + + + text + + text + + true + + + + false + + + + + + false + select + select + + + + + + + false + select + select + + + + + + text + + false + + + + + text + + text + + + false + + + + + text + + text + + + false + + + + + text + + text + + true + + + + false + + + + + text + + text + + true + + + + false + + + + + text + + text + + true + + + + false + + + + + text + + text + + true + + + + + + + + + inventory/stock/edit + + + + stock_id + + + + From 67775b712822f30846dffd2f38d7dc706294623c Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Mon, 26 Jun 2017 14:04:23 +0100 Subject: [PATCH 0163/1004] magento-engcom/magento#34: Source to Stock Mapping UI and API - created StockRepositoryInterface and StockRepository --- .../Inventory/Model/StockRepository.php | 134 ++++++++++++++++++ .../Api/StockRepositoryInterface.php | 18 +-- 2 files changed, 143 insertions(+), 9 deletions(-) create mode 100644 app/code/Magento/Inventory/Model/StockRepository.php diff --git a/app/code/Magento/Inventory/Model/StockRepository.php b/app/code/Magento/Inventory/Model/StockRepository.php new file mode 100644 index 0000000000000..ad2957ef8f855 --- /dev/null +++ b/app/code/Magento/Inventory/Model/StockRepository.php @@ -0,0 +1,134 @@ +resourceStock = $resourceStock; + $this->stockFactory = $stockFactory; + $this->collectionProcessor = $collectionProcessor; + $this->stockCollectionFactory = $stockCollectionFactory; + $this->stockSearchResultsFactory = $stockSearchResultsFactory; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->logger = $logger; + } + + /** + * @inheritdoc + */ + public function save(StockInterface $stock) + { + try { + $this->resourceStock->save($stock); + return $stock->getStockId(); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + throw new CouldNotSaveException(__('Could not save stock'), $e); + } + } + + /** + * @inheritdoc + */ + public function get($stockId) + { + $stock = $this->stockFactory->create(); + $this->resourceStock->load($stock, $stockId, StockInterface::STOCK_ID); + + if (!$stock->getStockId()) { + throw NoSuchEntityException::singleField(StockInterface::STOCK_ID, $stockId); + } + return $stock; + } + + /** + * @inheritdoc + */ + public function getList(SearchCriteriaInterface $searchCriteria = null) + { + $collection = $this->stockCollectionFactory->create(); + + if (null === $searchCriteria) { + $searchCriteria = $this->searchCriteriaBuilder->create(); + } else { + $this->collectionProcessor->process($searchCriteria, $collection); + } + + $searchResult = $this->stockCollectionFactory->create(); + $searchResult->setItems($collection->getItems()); + $searchResult->setTotalCount($collection->getSize()); + $searchResult->setSearchCriteria($searchCriteria); + return $searchResult; + } +} diff --git a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php index 8eb6dbb39fee3..935ec750547a2 100644 --- a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php @@ -8,29 +8,29 @@ /** * @api */ -interface SourceRepositoryInterface +interface StockRepositoryInterface { /** - * Save Source data. If you want to create plugin on get method, also you need to create separate plugin + * Save Stock data. If you want to create plugin on get method, also you need to create separate plugin * on getList method, because entity loading way is different for these methods * - * @param \Magento\InventoryApi\Api\Data\SourceInterface $source + * @param \Magento\InventoryApi\Api\Data\StockInterface $stock * @return int * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function save(\Magento\InventoryApi\Api\Data\SourceInterface $source); + public function save(\Magento\InventoryApi\Api\Data\StockInterface $stock); /** - * Get Source data by given sourceId. + * Get Stock data by given stockId. * - * @param int $sourceId - * @return \Magento\InventoryApi\Api\Data\SourceInterface + * @param int $stockId + * @return \Magento\InventoryApi\Api\Data\StockInterface * @throws \Magento\Framework\Exception\NoSuchEntityException */ - public function get($sourceId); + public function get($stockId); /** - * Load Source data collection by given search criteria. + * Load Stock data collection by given search criteria. * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\InventoryApi\Api\Data\StockSearchResultsInterface From 17556002067a77675cc6cefdc46006ebf3492a60 Mon Sep 17 00:00:00 2001 From: astyczen Date: Mon, 26 Jun 2017 14:11:04 +0100 Subject: [PATCH 0164/1004] magento-engcom/magento#34 Inventory Stock table created --- .../Magento/Inventory/Setup/UpgradeSchema.php | 123 ++++++++++++++++++ app/code/Magento/Inventory/etc/module.xml | 2 +- 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 app/code/Magento/Inventory/Setup/UpgradeSchema.php diff --git a/app/code/Magento/Inventory/Setup/UpgradeSchema.php b/app/code/Magento/Inventory/Setup/UpgradeSchema.php new file mode 100644 index 0000000000000..04eb35d5b7782 --- /dev/null +++ b/app/code/Magento/Inventory/Setup/UpgradeSchema.php @@ -0,0 +1,123 @@ +startSetup(); + + if (version_compare($context->getVersion(), '2.0.0', '>')) { + $stockTable = $this->createStockTable($setup); + $setup->getConnection()->createTable($stockTable); +// $this->createSourceStockLinkTable($setup); + } + + $setup->endSetup(); + } + + private function createStockTable($setup) { + /** + * Create table 'inventory_stock' + */ + $sourceTable = $setup->getTable(UpgradeSchema::TABLE_NAME_STOCK); + + return $setup->getConnection()->newTable( + $sourceTable + )->setComment( + 'Inventory Stock Table' + )->addColumn( + StockInterface::STOCK_ID, + Table::TYPE_INTEGER, + null, + [ + UpgradeSchema::OPTION_IDENTITY => true, + UpgradeSchema::OPTION_UNSIGNED => true, + UpgradeSchema::OPTION_NULLABLE => false, + UpgradeSchema::OPTION_PRIMARY => true, + ], + 'Stock ID' + )->addColumn( + StockInterface::NAME, + Table::TYPE_TEXT, + 255, + [ + UpgradeSchema::OPTION_NULLABLE => false, + ], + 'Stock Name' + ); + } + +// private function createSourceStockLinkTable($setup) { +// /** +// * Create table 'inventory_source_stock_link' +// */ +// $sourceTable = $setup->getTable(UpgradeSchema::TABLE_NAME_SOURCE_STOCK_LINK); +// +// return $setup->getConnection()->newTable( +// $sourceTable +// )->setComment( +// 'Inventory Source Stock Link Table' +// )->addColumn( +// SourceStockLinkInterface::LINK_ID, +// Table::TYPE_INTEGER, +// null, +// [ +// UpgradeSchema::OPTION_IDENTITY => true, +// UpgradeSchema::OPTION_UNSIGNED => true, +// UpgradeSchema::OPTION_NULLABLE => false, +// UpgradeSchema::OPTION_PRIMARY => true, +// ], +// 'Link ID' +// )->addColumn( +// SourceStockLinkInterface::STOCK_ID, +// Table::TYPE_INTEGER, +// null, +// [ +// UpgradeSchema::OPTION_NULLABLE => false, +// ], +// 'Stock Id' +// )->addColumn( +// SourceStockLinkInterface::SOURCE_ID, +// Table::TYPE_INTEGER, +// null, +// [ +// UpgradeSchema::OPTION_NULLABLE => false, +// ], +// 'Source Id' +// ); +// } +} diff --git a/app/code/Magento/Inventory/etc/module.xml b/app/code/Magento/Inventory/etc/module.xml index 2ef165277a57f..9047111bbd7e1 100644 --- a/app/code/Magento/Inventory/etc/module.xml +++ b/app/code/Magento/Inventory/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + From 35a65fb8558307bab695f215bfdee923252471e6 Mon Sep 17 00:00:00 2001 From: astyczen Date: Mon, 26 Jun 2017 14:37:53 +0100 Subject: [PATCH 0165/1004] magento-engcom/magento#34 Source stock link table created --- .../Magento/Inventory/Setup/UpgradeSchema.php | 82 ++++++++++--------- app/code/Magento/Inventory/etc/module.xml | 2 +- .../Api/Data/SourceStockLinkInterface.php | 68 +++++++++++++++ 3 files changed, 111 insertions(+), 41 deletions(-) create mode 100644 app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php diff --git a/app/code/Magento/Inventory/Setup/UpgradeSchema.php b/app/code/Magento/Inventory/Setup/UpgradeSchema.php index 04eb35d5b7782..18c9672ebda39 100644 --- a/app/code/Magento/Inventory/Setup/UpgradeSchema.php +++ b/app/code/Magento/Inventory/Setup/UpgradeSchema.php @@ -10,6 +10,7 @@ use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\DB\Ddl\Table; use Magento\InventoryApi\Api\Data\StockInterface; +use Magento\InventoryApi\Api\Data\SourceStockLinkInterface; /** * Class for integration tables schema upgrades @@ -43,7 +44,8 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con if (version_compare($context->getVersion(), '2.0.0', '>')) { $stockTable = $this->createStockTable($setup); $setup->getConnection()->createTable($stockTable); -// $this->createSourceStockLinkTable($setup); + $stockLinkTable = $this->createSourceStockLinkTable($setup); + $setup->getConnection()->createTable($stockLinkTable); } $setup->endSetup(); @@ -81,43 +83,43 @@ private function createStockTable($setup) { ); } -// private function createSourceStockLinkTable($setup) { -// /** -// * Create table 'inventory_source_stock_link' -// */ -// $sourceTable = $setup->getTable(UpgradeSchema::TABLE_NAME_SOURCE_STOCK_LINK); -// -// return $setup->getConnection()->newTable( -// $sourceTable -// )->setComment( -// 'Inventory Source Stock Link Table' -// )->addColumn( -// SourceStockLinkInterface::LINK_ID, -// Table::TYPE_INTEGER, -// null, -// [ -// UpgradeSchema::OPTION_IDENTITY => true, -// UpgradeSchema::OPTION_UNSIGNED => true, -// UpgradeSchema::OPTION_NULLABLE => false, -// UpgradeSchema::OPTION_PRIMARY => true, -// ], -// 'Link ID' -// )->addColumn( -// SourceStockLinkInterface::STOCK_ID, -// Table::TYPE_INTEGER, -// null, -// [ -// UpgradeSchema::OPTION_NULLABLE => false, -// ], -// 'Stock Id' -// )->addColumn( -// SourceStockLinkInterface::SOURCE_ID, -// Table::TYPE_INTEGER, -// null, -// [ -// UpgradeSchema::OPTION_NULLABLE => false, -// ], -// 'Source Id' -// ); -// } + private function createSourceStockLinkTable($setup) { + /** + * Create table 'inventory_source_stock_link' + */ + $sourceTable = $setup->getTable(UpgradeSchema::TABLE_NAME_SOURCE_STOCK_LINK); + + return $setup->getConnection()->newTable( + $sourceTable + )->setComment( + 'Inventory Source Stock Link Table' + )->addColumn( + SourceStockLinkInterface::LINK_ID, + Table::TYPE_INTEGER, + null, + [ + UpgradeSchema::OPTION_IDENTITY => true, + UpgradeSchema::OPTION_UNSIGNED => true, + UpgradeSchema::OPTION_NULLABLE => false, + UpgradeSchema::OPTION_PRIMARY => true, + ], + 'Link ID' + )->addColumn( + SourceStockLinkInterface::STOCK_ID, + Table::TYPE_INTEGER, + null, + [ + UpgradeSchema::OPTION_NULLABLE => false, + ], + 'Stock Id' + )->addColumn( + SourceStockLinkInterface::SOURCE_ID, + Table::TYPE_INTEGER, + null, + [ + UpgradeSchema::OPTION_NULLABLE => false, + ], + 'Source Id' + ); + } } diff --git a/app/code/Magento/Inventory/etc/module.xml b/app/code/Magento/Inventory/etc/module.xml index 9047111bbd7e1..d66860d184420 100644 --- a/app/code/Magento/Inventory/etc/module.xml +++ b/app/code/Magento/Inventory/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php new file mode 100644 index 0000000000000..719150576f9a1 --- /dev/null +++ b/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php @@ -0,0 +1,68 @@ + Date: Mon, 26 Jun 2017 14:50:47 +0100 Subject: [PATCH 0166/1004] magento-engcom/magento#34 upgrade moved to the install script --- .../Magento/Inventory/Setup/InstallSchema.php | 88 ++++++++++++ .../Magento/Inventory/Setup/UpgradeSchema.php | 125 ------------------ app/code/Magento/Inventory/etc/module.xml | 2 +- 3 files changed, 89 insertions(+), 126 deletions(-) delete mode 100644 app/code/Magento/Inventory/Setup/UpgradeSchema.php diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index d9fbffe8b4779..8080fff862015 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -12,6 +12,8 @@ use Magento\Framework\Setup\SchemaSetupInterface; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; +use Magento\InventoryApi\Api\Data\StockInterface; +use Magento\InventoryApi\Api\Data\SourceStockLinkInterface; /** * @codeCoverageIgnore @@ -28,6 +30,16 @@ class InstallSchema implements InstallSchemaInterface */ const TABLE_NAME_SOURCE_CARRIER_LINK = 'inventory_source_carrier_link'; + /** + * Constant for table names of the model \Magento\Inventory\Model\Stock + */ + const TABLE_NAME_STOCK = 'inventory_stock'; + + /** + * Constant for table name of \Magento\Inventory\Model\SourceStockLink + */ + const TABLE_NAME_SOURCE_STOCK_LINK = 'inventory_source_stock_link'; + /** * Constant for decimal precision for latitude and longitude */ @@ -62,6 +74,10 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $setup->getConnection()->createTable($sourceTable); $setup->getConnection()->createTable($this->createSourceCarrierLinkTable($setup)); + + $setup->getConnection()->createTable($this->createStockTable($setup)); + $setup->getConnection()->createTable($this->createSourceStockLinkTable($setup)); + $setup->endSetup(); } @@ -332,4 +348,76 @@ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) AdapterInterface::FK_ACTION_CASCADE ); } + + private function createStockTable($setup) { + /** + * Create table 'inventory_stock' + */ + $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_STOCK); + + return $setup->getConnection()->newTable( + $sourceTable + )->setComment( + 'Inventory Stock Table' + )->addColumn( + StockInterface::STOCK_ID, + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_PRIMARY => true, + ], + 'Stock ID' + )->addColumn( + StockInterface::NAME, + Table::TYPE_TEXT, + 255, + [ + InstallSchema::OPTION_NULLABLE => false, + ], + 'Stock Name' + ); + } + + private function createSourceStockLinkTable($setup) { + /** + * Create table 'inventory_source_stock_link' + */ + $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE_STOCK_LINK); + + return $setup->getConnection()->newTable( + $sourceTable + )->setComment( + 'Inventory Source Stock Link Table' + )->addColumn( + SourceStockLinkInterface::LINK_ID, + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_IDENTITY => true, + InstallSchema::OPTION_UNSIGNED => true, + InstallSchema::OPTION_NULLABLE => false, + InstallSchema::OPTION_PRIMARY => true, + ], + 'Link ID' + )->addColumn( + SourceStockLinkInterface::STOCK_ID, + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_NULLABLE => false, + ], + 'Stock Id' + )->addColumn( + SourceStockLinkInterface::SOURCE_ID, + Table::TYPE_INTEGER, + null, + [ + InstallSchema::OPTION_NULLABLE => false, + ], + 'Source Id' + ); + } } diff --git a/app/code/Magento/Inventory/Setup/UpgradeSchema.php b/app/code/Magento/Inventory/Setup/UpgradeSchema.php deleted file mode 100644 index 18c9672ebda39..0000000000000 --- a/app/code/Magento/Inventory/Setup/UpgradeSchema.php +++ /dev/null @@ -1,125 +0,0 @@ -startSetup(); - - if (version_compare($context->getVersion(), '2.0.0', '>')) { - $stockTable = $this->createStockTable($setup); - $setup->getConnection()->createTable($stockTable); - $stockLinkTable = $this->createSourceStockLinkTable($setup); - $setup->getConnection()->createTable($stockLinkTable); - } - - $setup->endSetup(); - } - - private function createStockTable($setup) { - /** - * Create table 'inventory_stock' - */ - $sourceTable = $setup->getTable(UpgradeSchema::TABLE_NAME_STOCK); - - return $setup->getConnection()->newTable( - $sourceTable - )->setComment( - 'Inventory Stock Table' - )->addColumn( - StockInterface::STOCK_ID, - Table::TYPE_INTEGER, - null, - [ - UpgradeSchema::OPTION_IDENTITY => true, - UpgradeSchema::OPTION_UNSIGNED => true, - UpgradeSchema::OPTION_NULLABLE => false, - UpgradeSchema::OPTION_PRIMARY => true, - ], - 'Stock ID' - )->addColumn( - StockInterface::NAME, - Table::TYPE_TEXT, - 255, - [ - UpgradeSchema::OPTION_NULLABLE => false, - ], - 'Stock Name' - ); - } - - private function createSourceStockLinkTable($setup) { - /** - * Create table 'inventory_source_stock_link' - */ - $sourceTable = $setup->getTable(UpgradeSchema::TABLE_NAME_SOURCE_STOCK_LINK); - - return $setup->getConnection()->newTable( - $sourceTable - )->setComment( - 'Inventory Source Stock Link Table' - )->addColumn( - SourceStockLinkInterface::LINK_ID, - Table::TYPE_INTEGER, - null, - [ - UpgradeSchema::OPTION_IDENTITY => true, - UpgradeSchema::OPTION_UNSIGNED => true, - UpgradeSchema::OPTION_NULLABLE => false, - UpgradeSchema::OPTION_PRIMARY => true, - ], - 'Link ID' - )->addColumn( - SourceStockLinkInterface::STOCK_ID, - Table::TYPE_INTEGER, - null, - [ - UpgradeSchema::OPTION_NULLABLE => false, - ], - 'Stock Id' - )->addColumn( - SourceStockLinkInterface::SOURCE_ID, - Table::TYPE_INTEGER, - null, - [ - UpgradeSchema::OPTION_NULLABLE => false, - ], - 'Source Id' - ); - } -} diff --git a/app/code/Magento/Inventory/etc/module.xml b/app/code/Magento/Inventory/etc/module.xml index d66860d184420..2ef165277a57f 100644 --- a/app/code/Magento/Inventory/etc/module.xml +++ b/app/code/Magento/Inventory/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + From 9cb180272943a1820f00a9535cf3bd15460f037d Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Mon, 26 Jun 2017 14:58:57 +0100 Subject: [PATCH 0167/1004] magento-engcom/magento#34: Source to Stock Mapping UI and API - created test for StockRepository --- app/code/Magento/Inventory/Model/Stock.php | 4 - .../Test/Unit/Model/StockRepositoryTest.php | 309 ++++++++++++++++++ app/code/Magento/Inventory/etc/di.xml | 3 + 3 files changed, 312 insertions(+), 4 deletions(-) create mode 100644 app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php diff --git a/app/code/Magento/Inventory/Model/Stock.php b/app/code/Magento/Inventory/Model/Stock.php index 9724fa9eb6044..62e171c6c4edc 100644 --- a/app/code/Magento/Inventory/Model/Stock.php +++ b/app/code/Magento/Inventory/Model/Stock.php @@ -15,10 +15,6 @@ */ class Stock extends AbstractExtensibleModel implements StockInterface { - const STOCK_ID = 'stock_id'; - const NAME = 'name'; - - /** * @inheritdoc */ diff --git a/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php new file mode 100644 index 0000000000000..7f8fe39c7f6d6 --- /dev/null +++ b/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php @@ -0,0 +1,309 @@ +resourceStock = $this->getMockBuilder(SourceResource::class)->disableOriginalConstructor()->getMock(); + $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) + ->disableOriginalConstructor() + ->getMock(); + $this->stockFactory = $this->getMockBuilder(SourceInterfaceFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class) + ->disableOriginalConstructor() + ->setMethods(['process']) + ->getMock(); + $this->stockCollectionFactory = $this->getMockBuilder(SourceCollectionFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->stockSearchResultsFactory = $this->getMockBuilder(SourceSearchResultsInterfaceFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->stock = $this->getMockBuilder(Stock::class) + ->disableOriginalConstructor() + ->getMock(); + + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->model = $objectManager->getObject( + \Magento\Inventory\Model\StockRepository::class, + [ + 'resourceSource' => $this->resourceStock, + 'sourceFactory' => $this->stockFactory, + 'collectionProcessor' => $this->collectionProcessor, + 'sourceCollectionFactory' => $this->stockCollectionFactory, + 'sourceSearchResultsFactory' => $this->stockSearchResultsFactory, + 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, + 'logger' => $this->loggerMock, + ] + ); + } + + public function testSave() + { + $stockId = 42; + + $this->stock + ->expects($this->once()) + ->method('getSourceId') + ->willReturn($stockId); + $this->resourceStock + ->expects($this->once()) + ->method('save') + ->with($this->stock); + + self::assertEquals($stockId, $this->model->save($this->stock)); + } + + /** + * @expectedException \Magento\Framework\Exception\CouldNotSaveException + */ + public function testSaveErrorExpectsException() + { + $message = 'some message'; + + $this->resourceStock + ->expects($this->once()) + ->method('save') + ->willThrowException(new \Exception($message)); + + $this->loggerMock + ->expects($this->once()) + ->method('error') + ->with($message); + + $this->model->save($this->stock); + } + + public function testGet() + { + $stockId = 345; + + $this->stock + ->expects($this->once()) + ->method('getSourceId') + ->willReturn($stockId); + $this->stockFactory + ->expects($this->once()) + ->method('create') + ->willReturn($this->stock); + $this->resourceStock + ->expects($this->once()) + ->method('load') + ->with($this->stock, $stockId, StockInterface::STOCK_ID); + + self::assertSame($this->stock, $this->model->get($stockId)); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + */ + public function testGetErrorExpectsException() + { + $stockId = 345; + + $this->stock + ->expects($this->once()) + ->method('getSourceId') + ->willReturn(null); + $this->stockFactory + ->expects($this->once()) + ->method('create') + ->willReturn($this->stock); + $this->resourceStock->expects($this->once()) + ->method('load') + ->with( + $this->stock, + $stockId, + StockInterface::STOCK_ID + ); + + $this->model->get($stockId); + } + + public function testGetListWithSearchCriteria() + { + $items = [ + $this->getMockBuilder(Stock::class)->disableOriginalConstructor()->getMock(), + $this->getMockBuilder(Stock::class)->disableOriginalConstructor()->getMock() + ]; + $totalCount = 2; + $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $stockCollection = $this->getMockBuilder(StockCollection::class) + ->disableOriginalConstructor() + ->getMock(); + $stockCollection + ->expects($this->once()) + ->method('getItems') + ->willReturn($items); + $stockCollection + ->expects($this->once()) + ->method('getSize') + ->willReturn($totalCount); + $this->stockCollectionFactory + ->expects($this->once()) + ->method('create') + ->willReturn($stockCollection); + + $searchResults = $this->getMockBuilder(StockSearchResultsInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $searchResults + ->expects($this->once()) + ->method('setItems') + ->with($items); + $searchResults + ->expects($this->once()) + ->method('setTotalCount') + ->with($totalCount); + $searchResults + ->expects($this->once()) + ->method('setSearchCriteria') + ->with($searchCriteria); + $this->sourceSearchResultsFactory + ->expects($this->once()) + ->method('create') + ->willReturn($searchResults); + + $this->collectionProcessor + ->expects($this->once()) + ->method('process') + ->with($searchCriteria, $stockCollection); + + self::assertSame($searchResults, $this->model->getList($searchCriteria)); + } + + public function testGetListWithoutSearchCriteria() + { + $items = [ + $this->getMockBuilder(Stock::class)->disableOriginalConstructor()->getMock(), + $this->getMockBuilder(Stock::class)->disableOriginalConstructor()->getMock() + ]; + $totalCount = 2; + + $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->searchCriteriaBuilder + ->expects($this->once()) + ->method('create') + ->willReturn($searchCriteria); + + $stockCollection = $this->getMockBuilder(StockCollection::class) + ->disableOriginalConstructor() + ->getMock(); + $stockCollection + ->expects($this->once()) + ->method('getItems') + ->willReturn($items); + $stockCollection + ->expects($this->once()) + ->method('getSize') + ->willReturn($totalCount); + $this->stockCollectionFactory + ->expects($this->once()) + ->method('create') + ->willReturn($stockCollection); + + $searchResults = $this->getMockBuilder(StockSearchResultsInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $searchResults + ->expects($this->once()) + ->method('setItems') + ->with($items); + $searchResults + ->expects($this->once()) + ->method('setTotalCount') + ->with($totalCount); + $searchResults + ->expects($this->once()) + ->method('setSearchCriteria') + ->with($searchCriteria); + $this->stockSearchResultsFactory + ->expects($this->once()) + ->method('create') + ->willReturn($searchResults); + + $this->collectionProcessor + ->expects($this->never()) + ->method('process'); + + self::assertSame($searchResults, $this->model->getList()); + } +} diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index 3c6091ff5561c..53323691a46d9 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -11,4 +11,7 @@ + + + From e712957fee0d23cc935663b0db8ca2e5742b8653 Mon Sep 17 00:00:00 2001 From: jonfres Date: Mon, 26 Jun 2017 14:59:54 +0100 Subject: [PATCH 0168/1004] magento-engcom/magento#34: Source to Stock Mapping UI and API - controller Stock and menu option for Manage Stock added --- .../Controller/Adminhtml/Source/Stock.php | 34 +++++++++++++++++++ .../Magento/Inventory/etc/adminhtml/menu.xml | 8 +++++ 2 files changed, 42 insertions(+) create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Source/Stock.php diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Stock.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Stock.php new file mode 100644 index 0000000000000..4b56980bfff46 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Stock.php @@ -0,0 +1,34 @@ +resultFactory->create(ResultFactory::TYPE_PAGE); + $resultPage->setActiveMenu('Magento_Inventory::stock') + ->addBreadcrumb(__('Sources'), __('List')); + $resultPage->getConfig()->getTitle()->prepend(__('Manage Stock')); + return $resultPage; + } +} diff --git a/app/code/Magento/Inventory/etc/adminhtml/menu.xml b/app/code/Magento/Inventory/etc/adminhtml/menu.xml index bd4c7e9e1e3f7..cd96628949b5a 100644 --- a/app/code/Magento/Inventory/etc/adminhtml/menu.xml +++ b/app/code/Magento/Inventory/etc/adminhtml/menu.xml @@ -15,5 +15,13 @@ parent="Magento_Backend::stores_settings" action="inventory/source/index" resource="Magento_Inventory::source"/> + From b6595795233d5d181e78f76509db4e1b063d3538 Mon Sep 17 00:00:00 2001 From: astyczen Date: Mon, 26 Jun 2017 15:12:25 +0100 Subject: [PATCH 0169/1004] magento-engcom/magento#34 stock interface stock id constant change --- app/code/Magento/InventoryApi/Api/Data/StockInterface.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/InventoryApi/Api/Data/StockInterface.php b/app/code/Magento/InventoryApi/Api/Data/StockInterface.php index b754c0daa1837..3d7998b8ef6b5 100644 --- a/app/code/Magento/InventoryApi/Api/Data/StockInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/StockInterface.php @@ -15,7 +15,7 @@ interface StockInterface extends ExtensibleDataInterface /** * Constants for keys of data array. Identical to the name of the getter in snake case */ - const STOCK_ID = 'source_id'; + const STOCK_ID = 'stock_id'; const NAME = 'name'; /**#@-*/ From 97884404f30a466751fcab7191a5ef3c81abe564 Mon Sep 17 00:00:00 2001 From: jonfres Date: Mon, 26 Jun 2017 15:33:59 +0100 Subject: [PATCH 0170/1004] magento-engcom/magento#34: Source to Stock Mapping UI and API - controller Stock and menu option for Manage Stock added2 --- .../Adminhtml/{Source/Stock.php => Stock/Index.php} | 4 ++-- app/code/Magento/Inventory/etc/adminhtml/menu.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename app/code/Magento/Inventory/Controller/Adminhtml/{Source/Stock.php => Stock/Index.php} (90%) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Stock.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Index.php similarity index 90% rename from app/code/Magento/Inventory/Controller/Adminhtml/Source/Stock.php rename to app/code/Magento/Inventory/Controller/Adminhtml/Stock/Index.php index 4b56980bfff46..47d87240b9c5d 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Stock.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Index.php @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Inventory\Controller\Adminhtml\Source; +namespace Magento\Inventory\Controller\Adminhtml\Stock; use Magento\Backend\App\Action; use Magento\Backend\Model\View\Result\Page; @@ -12,7 +12,7 @@ /** * Class Index */ -class Stock extends Action +class Index extends Action { /** * @see _isAllowed() diff --git a/app/code/Magento/Inventory/etc/adminhtml/menu.xml b/app/code/Magento/Inventory/etc/adminhtml/menu.xml index cd96628949b5a..02a39856399b1 100644 --- a/app/code/Magento/Inventory/etc/adminhtml/menu.xml +++ b/app/code/Magento/Inventory/etc/adminhtml/menu.xml @@ -16,7 +16,7 @@ action="inventory/source/index" resource="Magento_Inventory::source"/> - + \ No newline at end of file From 2530ee2dd998a8bdf1cde0c4edfef96a35635f96 Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Mon, 26 Jun 2017 16:07:57 +0100 Subject: [PATCH 0171/1004] magento-engcom/magento#34: Source to Stock Mapping UI and API - changed implementation of StockRepository --- .../Inventory/Model/StockRepository.php | 2 +- .../Ui/DataProvider/StockDataProvider.php | 57 +++---------------- 2 files changed, 10 insertions(+), 49 deletions(-) diff --git a/app/code/Magento/Inventory/Model/StockRepository.php b/app/code/Magento/Inventory/Model/StockRepository.php index ad2957ef8f855..960d4c742db80 100644 --- a/app/code/Magento/Inventory/Model/StockRepository.php +++ b/app/code/Magento/Inventory/Model/StockRepository.php @@ -125,7 +125,7 @@ public function getList(SearchCriteriaInterface $searchCriteria = null) $this->collectionProcessor->process($searchCriteria, $collection); } - $searchResult = $this->stockCollectionFactory->create(); + $searchResult = $this->stockSearchResultsFactory->create(); $searchResult->setItems($collection->getItems()); $searchResult->setTotalCount($collection->getSize()); $searchResult->setSearchCriteria($searchCriteria); diff --git a/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php index ff6fb225bb0ff..9e6c5bf4fe818 100644 --- a/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php +++ b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php @@ -5,14 +5,14 @@ */ namespace Magento\Inventory\Ui\DataProvider; -use Magento\InventoryApi\Api\Data\SourceInterface; +use Magento\InventoryApi\Api\Data\StockInterface; use Magento\Ui\DataProvider\SearchResultFactory; use Magento\Framework\Api\FilterBuilder; use Magento\Framework\Api\Search\ReportingInterface; use Magento\Framework\Api\Search\SearchCriteriaBuilder; use Magento\Framework\App\RequestInterface; use Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider; -use Magento\InventoryApi\Api\SourceRepositoryInterface; +use Magento\InventoryApi\Api\StockRepositoryInterface; /** * Class SourceDataProvider @@ -21,9 +21,9 @@ class StockDataProvider extends DataProvider { /** - * @var SourceRepositoryInterface + * @var StockRepositoryInterface */ - private $sourceRepository; + private $stockRepository; /** * @var SearchResultFactory @@ -38,7 +38,7 @@ class StockDataProvider extends DataProvider * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param RequestInterface $request * @param FilterBuilder $filterBuilder - * @param SourceRepositoryInterface $sourceRepository + * @param StockRepositoryInterface $stockRepository * @param SearchResultFactory $searchResultFactory * @param array $meta * @param array $data @@ -52,7 +52,7 @@ public function __construct( SearchCriteriaBuilder $searchCriteriaBuilder, RequestInterface $request, FilterBuilder $filterBuilder, - StockRepositoryInterface $sourceRepository, + StockRepositoryInterface $stockRepository, SearchResultFactory $searchResultFactory, array $meta = [], array $data = [] @@ -68,63 +68,24 @@ public function __construct( $meta, $data ); - $this->sourceRepository = $sourceRepository; + $this->stockRepository = $stockRepository; $this->searchResultFactory = $searchResultFactory; } - /** - * {@inheritdoc} - */ - public function getData() - { - $data = parent::getData(); - if ('inventory_source_form_data_source' === $this->name) { - // It is need for support of several fieldsets. - // For details see \Magento\Ui\Component\Form::getDataSourceData - if ($data['totalRecords'] > 0) { - $sourceId = $data['items'][0][SourceInterface::SOURCE_ID]; - $sourceGeneralData = $data['items'][0]; - $sourceGeneralData['carrier_codes'] = $this->getAssignedCarrierCodes($sourceId); - $dataForSingle[$sourceId] = [ - 'general' => $sourceGeneralData, - ]; - $data = $dataForSingle; - } else { - $data = []; - } - } - return $data; - } - /** * {@inheritdoc} */ public function getSearchResult() { $searchCriteria = $this->getSearchCriteria(); - $result = $this->sourceRepository->getList($searchCriteria); + $result = $this->stockRepository->getList($searchCriteria); $searchResult = $this->searchResultFactory->create( $result->getItems(), $result->getTotalCount(), $searchCriteria, - SourceInterface::SOURCE_ID + StockInterface::STOCK_ID ); return $searchResult; } - - /** - * @param int $sourceId - * @return array - */ - private function getAssignedCarrierCodes($sourceId) - { - $source = $this->sourceRepository->get($sourceId); - - $carrierCodes = []; - foreach ($source->getCarrierLinks() as $carrierLink) { - $carrierCodes[] = $carrierLink->getCarrierCode(); - } - return $carrierCodes; - } } From 9fab8e25eed379b236a6e53514ab6c05feabc458 Mon Sep 17 00:00:00 2001 From: astyczen Date: Mon, 26 Jun 2017 16:11:36 +0100 Subject: [PATCH 0172/1004] magento-engcom/magento#34 admin add/edit Stock form and action added --- .../Controller/Adminhtml/Stock/Edit.php | 70 +++++++++++++++++++ .../Controller/Adminhtml/Stock/NewAction.php | 34 +++++++++ .../Inventory/Model/StockRepository.php | 2 +- .../Ui/DataProvider/StockDataProvider.php | 48 +++++-------- .../Magento/Inventory/etc/adminhtml/di.xml | 5 ++ .../adminhtml/layout/inventory_stock_edit.xml | 15 ++++ .../adminhtml/layout/inventory_stock_new.xml | 11 +++ 7 files changed, 152 insertions(+), 33 deletions(-) create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Stock/Edit.php create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Stock/NewAction.php create mode 100644 app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_edit.xml create mode 100644 app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_new.xml diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Edit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Edit.php new file mode 100644 index 0000000000000..039e9dfb21d06 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Edit.php @@ -0,0 +1,70 @@ +stockRepository = $stockRepository; + } + + /** + * {@inheritdoc} + */ + public function execute() + { + $stockId = $this->getRequest()->getParam(StockInterface::STOCK_ID); + try { + $stock = $this->stockRepository->get($stockId); + + /** @var Page $result */ + $result = $this->resultFactory->create(ResultFactory::TYPE_PAGE); + $result->setActiveMenu('Magento_Inventory::stock') + ->addBreadcrumb(__('Edit Stock'), __('Edit Stock')); + $result->getConfig() + ->getTitle() + ->prepend(__('Edit Stock: %1', $stock->getName())); + } catch (NoSuchEntityException $e) { + /** @var Redirect $result */ + $result = $this->resultRedirectFactory->create(); + $this->messageManager->addErrorMessage( + __('Stock with id "%1" does not exist.', $stockId) + ); + $result->setPath('*/*'); + } + return $result; + } +} diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/NewAction.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/NewAction.php new file mode 100644 index 0000000000000..af9d8f10cf6a1 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/NewAction.php @@ -0,0 +1,34 @@ +resultFactory->create(ResultFactory::TYPE_PAGE); + $resultPage->setActiveMenu('Magento_Inventory::stock'); + $resultPage->getConfig()->getTitle()->prepend(__('New Stock')); + return $resultPage; + } +} diff --git a/app/code/Magento/Inventory/Model/StockRepository.php b/app/code/Magento/Inventory/Model/StockRepository.php index ad2957ef8f855..960d4c742db80 100644 --- a/app/code/Magento/Inventory/Model/StockRepository.php +++ b/app/code/Magento/Inventory/Model/StockRepository.php @@ -125,7 +125,7 @@ public function getList(SearchCriteriaInterface $searchCriteria = null) $this->collectionProcessor->process($searchCriteria, $collection); } - $searchResult = $this->stockCollectionFactory->create(); + $searchResult = $this->stockSearchResultsFactory->create(); $searchResult->setItems($collection->getItems()); $searchResult->setTotalCount($collection->getSize()); $searchResult->setSearchCriteria($searchCriteria); diff --git a/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php index ff6fb225bb0ff..21569c5eb7acd 100644 --- a/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php +++ b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php @@ -5,25 +5,25 @@ */ namespace Magento\Inventory\Ui\DataProvider; -use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\Ui\DataProvider\SearchResultFactory; use Magento\Framework\Api\FilterBuilder; use Magento\Framework\Api\Search\ReportingInterface; use Magento\Framework\Api\Search\SearchCriteriaBuilder; use Magento\Framework\App\RequestInterface; use Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider; -use Magento\InventoryApi\Api\SourceRepositoryInterface; +use Magento\InventoryApi\Api\Data\StockInterface; +use Magento\InventoryApi\Api\StockRepositoryInterface; /** - * Class SourceDataProvider + * Class stockDataProvider * @api */ class StockDataProvider extends DataProvider { /** - * @var SourceRepositoryInterface + * @var StockRepositoryInterface */ - private $sourceRepository; + private $stockRepository; /** * @var SearchResultFactory @@ -38,7 +38,7 @@ class StockDataProvider extends DataProvider * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param RequestInterface $request * @param FilterBuilder $filterBuilder - * @param SourceRepositoryInterface $sourceRepository + * @param StockRepositoryInterface $stockRepository * @param SearchResultFactory $searchResultFactory * @param array $meta * @param array $data @@ -52,7 +52,7 @@ public function __construct( SearchCriteriaBuilder $searchCriteriaBuilder, RequestInterface $request, FilterBuilder $filterBuilder, - StockRepositoryInterface $sourceRepository, + StockRepositoryInterface $stockRepository, SearchResultFactory $searchResultFactory, array $meta = [], array $data = [] @@ -68,7 +68,7 @@ public function __construct( $meta, $data ); - $this->sourceRepository = $sourceRepository; + $this->stockRepository = $stockRepository; $this->searchResultFactory = $searchResultFactory; } @@ -78,15 +78,14 @@ public function __construct( public function getData() { $data = parent::getData(); - if ('inventory_source_form_data_source' === $this->name) { + if ('inventory_stock_form_data_source' === $this->name) { // It is need for support of several fieldsets. - // For details see \Magento\Ui\Component\Form::getDataSourceData + // For details see \Magento\Ui\Component\Form::getDatastockData if ($data['totalRecords'] > 0) { - $sourceId = $data['items'][0][SourceInterface::SOURCE_ID]; - $sourceGeneralData = $data['items'][0]; - $sourceGeneralData['carrier_codes'] = $this->getAssignedCarrierCodes($sourceId); - $dataForSingle[$sourceId] = [ - 'general' => $sourceGeneralData, + $stockId = $data['items'][0][StockInterface::STOCK_ID]; + $stockGeneralData = $data['items'][0]; + $dataForSingle[$stockId] = [ + 'general' => $stockGeneralData, ]; $data = $dataForSingle; } else { @@ -102,29 +101,14 @@ public function getData() public function getSearchResult() { $searchCriteria = $this->getSearchCriteria(); - $result = $this->sourceRepository->getList($searchCriteria); + $result = $this->stockRepository->getList($searchCriteria); $searchResult = $this->searchResultFactory->create( $result->getItems(), $result->getTotalCount(), $searchCriteria, - SourceInterface::SOURCE_ID + StockInterface::STOCK_ID ); return $searchResult; } - - /** - * @param int $sourceId - * @return array - */ - private function getAssignedCarrierCodes($sourceId) - { - $source = $this->sourceRepository->get($sourceId); - - $carrierCodes = []; - foreach ($source->getCarrierLinks() as $carrierLink) { - $carrierCodes[] = $carrierLink->getCarrierCode(); - } - return $carrierCodes; - } } diff --git a/app/code/Magento/Inventory/etc/adminhtml/di.xml b/app/code/Magento/Inventory/etc/adminhtml/di.xml index f1989475949e0..7b9d5eac2a8af 100644 --- a/app/code/Magento/Inventory/etc/adminhtml/di.xml +++ b/app/code/Magento/Inventory/etc/adminhtml/di.xml @@ -12,4 +12,9 @@ inventory_source_form.inventory_source_form + + + inventory_stock_form.inventory_stock_form + + diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_edit.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_edit.xml new file mode 100644 index 0000000000000..442b2d976bbc5 --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_edit.xml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_new.xml b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_new.xml new file mode 100644 index 0000000000000..970c397db03c7 --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/layout/inventory_stock_new.xml @@ -0,0 +1,11 @@ + + + + + From 314a859b511c83a901313424066bb34cabb96ea2 Mon Sep 17 00:00:00 2001 From: astyczen Date: Mon, 26 Jun 2017 16:12:12 +0100 Subject: [PATCH 0173/1004] magento-engcom/magento#34 Stock for created --- .../ui_component/inventory_stock_form.xml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml new file mode 100644 index 0000000000000..3f1843d1732eb --- /dev/null +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml @@ -0,0 +1,68 @@ + + +
+ + + inventory_stock_form.inventory_stock_form_data_source + + Stock Information + templates/form/collapsible + + + data + inventory_stock_form + + inventory_stock_form.inventory_stock_form_data_source + + + + + isAvailable()): ?> -
+
-
+
-
> +
> getChildBlock('addto')): ?> - setProduct($_product)->getChildHtml(); ?> + setProduct($_product)->getChildHtml() ?>
- productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> - + productAttribute($_product, $_product->getShortDescription(), 'short_description') ?> +
@@ -115,7 +115,7 @@ $_helper = $this->helper('Magento\Catalog\Helper\Output'); - getToolbarHtml() ?> + getToolbarHtml() ?> isRedirectToCartEnabled()) : ?> From 0a7ee5921c68edfe4ed0cdcfef399ee6e164f4ea Mon Sep 17 00:00:00 2001 From: dmanners Date: Mon, 17 Jul 2017 10:12:56 +0000 Subject: [PATCH 0293/1004] Replace the usage of the depricated \Magento\Framework\Json\EncoderInterface in the CustomerScopeData block, - Use \Magento\Framework\Serialize\Serializer\Json instead when dealing with serilization - Update test to mirror the change in the main class --- .../Customer/Block/CustomerScopeData.php | 17 +++++++++-------- .../Test/Unit/Block/CustomerScopeDataTest.php | 8 ++++---- .../js/customer-data/invalidation-rules.phtml | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/code/Magento/Customer/Block/CustomerScopeData.php b/app/code/Magento/Customer/Block/CustomerScopeData.php index 50df1054e79dd..7b48b4eb2576e 100644 --- a/app/code/Magento/Customer/Block/CustomerScopeData.php +++ b/app/code/Magento/Customer/Block/CustomerScopeData.php @@ -20,23 +20,23 @@ class CustomerScopeData extends \Magento\Framework\View\Element\Template private $storeManager; /** - * @var \Magento\Framework\Json\EncoderInterface + * @var \Magento\Framework\Serialize\Serializer\Json */ - private $jsonEncoder; + private $serializer; /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder + * @param \Magento\Framework\Serialize\Serializer\Json $serializer * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Json\EncoderInterface $jsonEncoder, + \Magento\Framework\Serialize\Serializer\Json $serializer, array $data = [] ) { parent::__construct($context, $data); $this->storeManager = $context->getStoreManager(); - $this->jsonEncoder = $jsonEncoder; + $this->serializer = $serializer; } /** @@ -54,11 +54,12 @@ public function getWebsiteId() /** * Get the invalidation rules json encoded * - * @return string + * @return bool|string + * @throws \InvalidArgumentException */ - public function getInvalidationRulesJson() + public function getSerializedInvalidationRules() { - return $this->jsonEncoder->encode( + return $this->serializer->serialize( [ '*' => [ 'Magento_Customer/js/invalidation-processor' => [ diff --git a/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php b/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php index dcbe4882231ca..af0f86a423b0b 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php @@ -26,8 +26,8 @@ class CustomerScopeDataTest extends \PHPUnit_Framework_TestCase /** @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ private $scopeConfigMock; - /** @var \Magento\Framework\Json\EncoderInterface|\PHPUnit_Framework_MockObject_MockObject */ - private $encoderMock; + /** @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject */ + private $serializerMock; protected function setUp() { @@ -41,7 +41,7 @@ protected function setUp() $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) ->getMock(); - $this->encoderMock = $this->getMockBuilder(EncoderInterface::class) + $this->serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class) ->getMock(); $this->contextMock->expects($this->exactly(2)) @@ -54,7 +54,7 @@ protected function setUp() $this->model = new CustomerScopeData( $this->contextMock, - $this->encoderMock, + $this->serializerMock, [] ); } diff --git a/app/code/Magento/Customer/view/frontend/templates/js/customer-data/invalidation-rules.phtml b/app/code/Magento/Customer/view/frontend/templates/js/customer-data/invalidation-rules.phtml index 7ded67344c011..ad8aab76e483f 100644 --- a/app/code/Magento/Customer/view/frontend/templates/js/customer-data/invalidation-rules.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/js/customer-data/invalidation-rules.phtml @@ -12,6 +12,6 @@ From dbdba4562d096ee5a736110a52811b98b3f573ea Mon Sep 17 00:00:00 2001 From: BlackEagle Date: Mon, 17 Jul 2017 14:27:37 +0200 Subject: [PATCH 0294/1004] check if node id exists before checking its admin When there are nodes in the aclResources that not have a member 'id', you will get an error on the comparison $node['id'] == 'Magento::admin' First check if the member 'id' exists Signed-off-by: BlackEagle --- .../Block/Adminhtml/Integration/Edit/Tab/Webapi.php | 3 ++- app/code/Magento/User/Block/Role/Tab/Edit.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Webapi.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Webapi.php index 5df8563b2038a..1f822414f7087 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Webapi.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Webapi.php @@ -190,7 +190,8 @@ private function getAclResources() $configResource = array_filter( $resources, function ($node) { - return $node['id'] == 'Magento_Backend::admin'; + return isset($node['id']) + && $node['id'] == 'Magento_Backend::admin'; } ); $configResource = reset($configResource); diff --git a/app/code/Magento/User/Block/Role/Tab/Edit.php b/app/code/Magento/User/Block/Role/Tab/Edit.php index c90c0405b92b5..b2fb0ee005f4c 100644 --- a/app/code/Magento/User/Block/Role/Tab/Edit.php +++ b/app/code/Magento/User/Block/Role/Tab/Edit.php @@ -210,7 +210,8 @@ private function getAclResources() $configResource = array_filter( $resources, function ($node) { - return $node['id'] == 'Magento_Backend::admin'; + return isset($node['id']) + && $node['id'] == 'Magento_Backend::admin'; } ); $configResource = reset($configResource); From 67da5dbc7e6cfba7acac1181210e947cc547efcf Mon Sep 17 00:00:00 2001 From: larsroettig Date: Mon, 17 Jul 2017 22:01:13 +0200 Subject: [PATCH 0295/1004] MSI magento-engcom/magento#34: - Add Review Changes add new multi save" --- .../Model/Command/AssignSourcesToStock.php | 89 +++++++++++++++++++ .../GetAssignedSourcesByStockId.php} | 15 ++-- .../Model/ResourceModel/SourceStockLink.php | 2 +- .../SourceStockLink/Collection.php | 2 +- .../Model/SourceStockLinkRepository.php | 46 +++++++++- app/code/Magento/Inventory/etc/di.xml | 3 +- .../Command/AssignSourcesToStockInterface.php | 26 ++++++ .../GetAssignedSourcesByStockIdInterface.php} | 7 +- .../Api/SourceItemRepositoryInterface.php | 4 +- .../SourceStockLinkRepositoryInterface.php | 29 ++++-- 10 files changed, 196 insertions(+), 27 deletions(-) create mode 100644 app/code/Magento/Inventory/Model/Command/AssignSourcesToStock.php rename app/code/Magento/Inventory/Model/{SourceStockLinkManagement.php => Command/GetAssignedSourcesByStockId.php} (81%) create mode 100644 app/code/Magento/InventoryApi/Api/Command/AssignSourcesToStockInterface.php rename app/code/Magento/InventoryApi/Api/{SourceStockLinkManagementInterface.php => Command/GetAssignedSourcesByStockIdInterface.php} (71%) diff --git a/app/code/Magento/Inventory/Model/Command/AssignSourcesToStock.php b/app/code/Magento/Inventory/Model/Command/AssignSourcesToStock.php new file mode 100644 index 0000000000000..83d308e4d2386 --- /dev/null +++ b/app/code/Magento/Inventory/Model/Command/AssignSourcesToStock.php @@ -0,0 +1,89 @@ +connection = $connection; + $this->logger = $logger; + } + + /** + * @inheritdoc + */ + public function execute(array $sourceIds, $stockId) + { + if (empty($sourceIds)) { + return; + } + + try { + $this->executeQuery($sourceIds, $stockId); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + throw new CouldNotSaveException(__('Could not save Source Item'), $e); + } + } + + /** + * Assign the source ids a stock. + * + * @param int[] $sourceIds + * @param int $stockId + * + * @throws \Exception + * @return void + */ + private function executeQuery(array $sourceIds, $stockId) + { + /** @var AdapterInterface $connection */ + $connection = $this->connection->getConnection(); + $tableName = $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_STOCK_LINK); + + $columns = [ + SourceStockLinkInterface::SOURCE_ID, + SourceStockLinkInterface::STOCK_ID + ]; + + $data = []; + foreach ($sourceIds as $sourceId) { + $data[] = [$sourceId, $stockId]; + } + + $connection->insertArray($tableName, $columns, $data); + } +} diff --git a/app/code/Magento/Inventory/Model/SourceStockLinkManagement.php b/app/code/Magento/Inventory/Model/Command/GetAssignedSourcesByStockId.php similarity index 81% rename from app/code/Magento/Inventory/Model/SourceStockLinkManagement.php rename to app/code/Magento/Inventory/Model/Command/GetAssignedSourcesByStockId.php index 41d1bd6315dca..7e389b19c062a 100644 --- a/app/code/Magento/Inventory/Model/SourceStockLinkManagement.php +++ b/app/code/Magento/Inventory/Model/Command/GetAssignedSourcesByStockId.php @@ -4,20 +4,21 @@ * See COPYING.txt for license details. */ -namespace Magento\Inventory\Model; +namespace Magento\Inventory\Model\Command; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Inventory\Model\ResourceModel\SourceStockLink\Collection as StockLinkCollection; use Magento\Inventory\Model\ResourceModel\SourceStockLink\CollectionFactory as StockLinkCollectionFactory; +use Magento\InventoryApi\Api\Command\GetAssignedSourcesByStockIdInterface; use Magento\InventoryApi\Api\Data\StockInterface; -use Magento\InventoryApi\Api\SourceStockLinkManagementInterface; + /** - * Class to get assign sources by stock. + * @inheritdoc */ -class SourceStockLinkManagement implements SourceStockLinkManagementInterface +class GetAssignedSourcesByStockId implements GetAssignedSourcesByStockIdInterface { - /** * @var CollectionProcessorInterface */ @@ -52,13 +53,13 @@ public function __construct( /** * @inheritdoc */ - public function getAssignedSources($stockId) + public function execute($stockId) { $searchCriteria = $this->searchCriteriaBuilder ->addFilter(StockInterface::STOCK_ID, $stockId) ->create(); - /** @var $collection */ + /** @var StockLinkCollection $collection */ $collection = $this->stockLinkCollectionFactory->create(); $this->collectionProcessor->process($searchCriteria, $collection); return $collection->getItems(); diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php index 9170a6a29fad0..1ad5c4f982e6a 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php @@ -9,7 +9,7 @@ use Magento\Inventory\Setup\InstallSchema; /** - * This class needed for service internal purposes only, to make collection work properly + * This class needed for service purposes only, to make collection work properly */ class SourceStockLink extends AbstractDb { diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php index 6ae622233802a..c11d6ec089ec5 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php @@ -12,7 +12,7 @@ /** * Resource Collection of SourceStockLink entities - * It is not an API because SourceStockLink must be loaded via Source entity only + * @api */ class Collection extends AbstractCollection { diff --git a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php b/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php index a5a98249942f9..93561bc31a273 100644 --- a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php +++ b/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php @@ -7,7 +7,10 @@ use Magento\Framework\Exception\CouldNotDeleteException; use Magento\Framework\Exception\CouldNotSaveException; +use Magento\Framework\Exception\NoSuchEntityException; use Magento\Inventory\Model\ResourceModel\SourceStockLink as ResourceSourceStockLink; +use Magento\InventoryApi\Api\Data\SourceStockLinkInterface; +use Magento\InventoryApi\Api\Data\SourceStockLinkInterfaceFactory as SourceStockLinkFactory; use Magento\InventoryApi\Api\SourceStockLinkRepositoryInterface; use Psr\Log\LoggerInterface; @@ -16,6 +19,12 @@ */ class SourceStockLinkRepository implements SourceStockLinkRepositoryInterface { + + /** + * @var SourceStockLinkFactory + */ + private $sourceStockLinkFactory; + /** * @var ResourceSourceStockLink */ @@ -27,14 +36,34 @@ class SourceStockLinkRepository implements SourceStockLinkRepositoryInterface private $logger; /** - * SourceStockLinkRepository constructor. * @param ResourceSourceStockLink $resourceSourceStockLink * @param LoggerInterface $logger + * @param SourceStockLinkFactory $sourceStockLinkFactory */ - public function __construct(ResourceSourceStockLink $resourceSourceStockLink, LoggerInterface $logger) - { + public function __construct( + ResourceSourceStockLink $resourceSourceStockLink, + LoggerInterface $logger, + SourceStockLinkFactory $sourceStockLinkFactory + ) { $this->resourceSourceStockLink = $resourceSourceStockLink; $this->logger = $logger; + $this->sourceStockLinkFactory = $sourceStockLinkFactory; + } + + /** + * @inheritdoc + */ + public function get($linkId) + { + $sourceStockLink= $this->sourceStockLinkFactory->create(); + $this->resourceSourceStockLink->load($sourceStockLink, $linkId, SourceStockLinkInterface::LINK_ID); + + /** @var SourceStockLinkInterface $sourceStockLink */ + if (null === $sourceStockLink->getLinkId()) { + throw NoSuchEntityException::singleField(SourceStockLinkInterface::LINK_ID, $linkId); + } + + return $sourceStockLink; } /** @@ -46,7 +75,7 @@ public function save(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $so $this->resourceSourceStockLink->save($sourceStockLink); } catch (\Exception $e) { $this->logger->error($e->getMessage()); - throw new CouldNotSaveException(__('Could not delete Source Stock Link'), $e); + throw new CouldNotSaveException(__('Could not save Source Stock Link'), $e); } } @@ -62,4 +91,13 @@ public function delete(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $ throw new CouldNotDeleteException(__('Could not delete Source Stock Link'), $e); } } + + /** + * @inheritdoc + */ + public function deleteById($linkId) + { + $sourceStockLink = $this->getById($linkId); + $this->delete($sourceStockLink); + } } diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index 22c3c93db50b3..d344e9fcf8519 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -13,7 +13,8 @@ - + + diff --git a/app/code/Magento/InventoryApi/Api/Command/AssignSourcesToStockInterface.php b/app/code/Magento/InventoryApi/Api/Command/AssignSourcesToStockInterface.php new file mode 100644 index 0000000000000..303cbb5da2754 --- /dev/null +++ b/app/code/Magento/InventoryApi/Api/Command/AssignSourcesToStockInterface.php @@ -0,0 +1,26 @@ + Date: Tue, 18 Jul 2017 10:41:53 +0300 Subject: [PATCH 0296/1004] Corrected function docblock definition to fix broken test #5941 --- .../Magento/Sitemap/Model/ResourceModel/Catalog/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php index 55ced9e6e2097..228fc2073b047 100644 --- a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php @@ -430,7 +430,7 @@ public function prepareSelectStatement(\Magento\Framework\DB\Select $select) return $select; } - /* + /** * Get product image URL from image filename and path * * @param string $image From 9e65c06c5ae566ad0d09d137112a5a808703ffb8 Mon Sep 17 00:00:00 2001 From: Daniel Fahlke Date: Tue, 18 Jul 2017 10:40:41 +0200 Subject: [PATCH 0297/1004] fix faulty copy&paste error for quotes --- phpserver/router.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpserver/router.php b/phpserver/router.php index 45d69e751c203..5ebacf6fce9fe 100644 --- a/phpserver/router.php +++ b/phpserver/router.php @@ -62,10 +62,10 @@ $debug($route); - if (strpos($route, ‘static/version’) === 0) { -  $redirectRoute = preg_replace(‘#static/version[0–9]*/#’,’static/’, $route, 1); -  $debug(“redirect static version string to:” . $redirectRoute); -  header(‘Location: /’.$redirectRoute); + if (strpos($route, 'static/version') === 0) { +  $redirectRoute = preg_replace('#static/version[0–9]*/#','static/', $route, 1); +  $debug("redirect static version string to:" . $redirectRoute); +  header('Location: /'.$redirectRoute);   exit; } From 3c6bde2b351060a7937474c4adcab43ecc6e5151 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 18 Jul 2017 11:45:47 +0300 Subject: [PATCH 0298/1004] MSI - Msi stock ui aggregation #39 - fixes --- .../Controller/Adminhtml/Stock/Save.php | 4 +- .../ResourceModel/SourceItem/SaveMultiple.php | 4 +- .../Model/SourceStockLinkRepository.php | 2 +- .../ui_component/inventory_stock_form.xml | 192 ++++++++++++++++++ .../InventoryApi/Api/Data/StockInterface.php | 2 +- .../SourceStockLinkRepositoryInterface.php | 13 +- 6 files changed, 202 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php index ed7786a52ef2c..ef9cbe6507e7e 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php @@ -68,8 +68,8 @@ public function execute() $requestData = $this->getRequest()->getParams(); if ($this->getRequest()->isPost() && !empty($requestData['general'])) { try { - $stockId = !empty($requestData['general'][StockInterface::SOURCE_ID]) - ? $requestData['general'][StockInterface::SOURCE_ID] : null; + $stockId = !empty($requestData['general'][StockInterface::STOCK_ID]) + ? $requestData['general'][StockInterface::STOCK_ID] : null; $stockId = $this->processSave($stockId, $requestData); diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php index 2c32b9d245fa9..3ef195f343bad 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php @@ -99,12 +99,12 @@ private function getSqlBindData(array $sourceItems) { $bind = []; foreach ($sourceItems as $sourceItem) { - $bind[] = [ + $bind = array_merge($bind, [ $sourceItem->getSourceId(), $sourceItem->getSku(), $sourceItem->getQuantity(), $sourceItem->getStatus(), - ]; + ]); } return $bind; } diff --git a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php b/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php index a5a98249942f9..2cb26d3f74a1a 100644 --- a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php +++ b/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php @@ -46,7 +46,7 @@ public function save(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $so $this->resourceSourceStockLink->save($sourceStockLink); } catch (\Exception $e) { $this->logger->error($e->getMessage()); - throw new CouldNotSaveException(__('Could not delete Source Stock Link'), $e); + throw new CouldNotSaveException(__('Could not save Source Stock Link'), $e); } } diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml index 3f1843d1732eb..712e54e56d8c2 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml @@ -65,4 +65,196 @@ + +
+ + + true + true + data.sources + + + + + container + Magento_Ui/js/form/components/group + + + 10 + false + + + + + + container + Magento_Ui/js/form/components/button + ui/form/components/button/container + + + inventory_stock_form.inventory_stock_form.sources.assign_sources_modal + toggleModal + + + Assign Sources + true + admin__field-medium + + + + + + + + + Assigned Sources + false + Magento_Ui/js/dynamic-rows/dynamic-rows-grid + false + record + + data.sources.assign_sources_grid + 100 + + source_id + name + qty + + source_id + source_id + + ${ $.provider }:${ $.dataProvider } + + + false + + true + + + + + + true + true + Magento_Ui/js/dynamic-rows/record + + + + + + + input + ui/dynamic-rows/cells/text + text + source_id + false + ID + + + + + + + input + ui/dynamic-rows/cells/text + text + name + field + Name + + + + + + Magento\Inventory\Model\OptionSource\SourceItemStatus + + select + text + status + field + Status + ui/dynamic-rows/cells/text + + + + + + + input + text + quantity + field + Qty + ui/dynamic-rows/cells/text + + + + + + + text + actionDelete + Unassign + + + + + + + + + + inventory_stock_form.inventory_stock_form_data_source + + Assign Sources + + + Cancel + action-secondary + + + ${ $.name } + actionCancel + + + + + Done + action-primary + + + index = assign_sources_grid + save + + + ${ $.name } + actionDone + + + + + + + + + + + false + assign_sources_grid + inventory_source_listing + inventory_source_listing.inventory_source_listing_data_source + inventory_source_listing.inventory_source_listing.inventory_source_listing_columns.ids + + true + + false + true + + true + noclass + + + + +
diff --git a/app/code/Magento/InventoryApi/Api/Data/StockInterface.php b/app/code/Magento/InventoryApi/Api/Data/StockInterface.php index 5e8c81927d308..899abfa4999a7 100644 --- a/app/code/Magento/InventoryApi/Api/Data/StockInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/StockInterface.php @@ -52,7 +52,7 @@ public function setName($name); /** * Retrieve existing extension attributes object * - * @return \Magento\InventoryApi\Api\Data\SourceExtensionInterface|null + * @return \Magento\InventoryApi\Api\Data\StockExtensionInterface|null */ public function getExtensionAttributes(); diff --git a/app/code/Magento/InventoryApi/Api/SourceStockLinkRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceStockLinkRepositoryInterface.php index 5eb58ad343a85..897da3560f5d5 100644 --- a/app/code/Magento/InventoryApi/Api/SourceStockLinkRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceStockLinkRepositoryInterface.php @@ -6,22 +6,18 @@ namespace Magento\InventoryApi\Api; /** - * Interface to assign specific source to particular stock. + * Interface to assign specific source to particular stock * * @api */ interface SourceStockLinkRepositoryInterface { - /** - * Assign a source a to a stock. + * Save SourceStockLink data * * @param \Magento\InventoryApi\Api\Data\SourceStockLinkInterface $sourceStockLink - * @return bool will returned True if assigned - * + * @return void * @throws \Magento\Framework\Exception\CouldNotSaveException - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\StateException */ public function save(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $sourceStockLink); @@ -29,12 +25,11 @@ public function save(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $so * Remove the source assignment from the stock. * * @param \Magento\InventoryApi\Api\Data\SourceStockLinkInterface $sourceStockLink - * @return bool will returned True if assigned + * @return void * * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException */ public function delete(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $sourceStockLink); - } From 2017309f2597fd9ba68c9bfd677c2b504a31a924 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 18 Jul 2017 12:21:38 +0300 Subject: [PATCH 0299/1004] MSI - Msi stock ui aggregation #39 - fixes --- .../Magento/Inventory/Controller/Adminhtml/Source/Save.php | 4 ++-- .../Magento/Inventory/Controller/Adminhtml/Stock/Save.php | 2 +- app/code/Magento/Inventory/etc/adminhtml/system.xml | 2 +- .../view/adminhtml/ui_component/inventory_source_form.xml | 7 ++++--- .../view/adminhtml/ui_component/inventory_stock_form.xml | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index d181b339fa006..5b1dc50fbd6e9 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -92,7 +92,7 @@ public function execute() $this->messageManager->addErrorMessage($e->getMessage()); $this->processRedirectAfterFailureSave($resultRedirect, $sourceId); } catch (Exception $e) { - $this->messageManager->addErrorMessage(__('Could not save source')); + $this->messageManager->addErrorMessage(__('Could not save source.')); $this->processRedirectAfterFailureSave($resultRedirect, $sourceId); } } else { @@ -116,7 +116,7 @@ private function processSave($sourceId, array $requestData) $source = $this->sourceFactory->create(); } $this->dataObjectHelper->populateWithArray($source, $requestData['general'], SourceInterface::class); - $source = $this->carrierRequestDataHydrator->hydrate($source, $requestData); + $source = $this->carrierRequestDataHydrator->hydrate($source, $requestData['general']); $sourceId = $this->sourceRepository->save($source); return $sourceId; diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php index ef9cbe6507e7e..399cb9d8966c0 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php @@ -83,7 +83,7 @@ public function execute() $this->messageManager->addErrorMessage($e->getMessage()); $this->processRedirectAfterFailureSave($resultRedirect, $stockId); } catch (Exception $e) { - $this->messageManager->addErrorMessage(__('Could not save stock')); + $this->messageManager->addErrorMessage(__('Could not save stock.')); $this->processRedirectAfterFailureSave($resultRedirect, $stockId); } } else { diff --git a/app/code/Magento/Inventory/etc/adminhtml/system.xml b/app/code/Magento/Inventory/etc/adminhtml/system.xml index d3dae5ae364a9..2b30044dfe073 100644 --- a/app/code/Magento/Inventory/etc/adminhtml/system.xml +++ b/app/code/Magento/Inventory/etc/adminhtml/system.xml @@ -21,7 +21,7 @@ Magento\Inventory\Model\OptionSource\CarrierSource 1 - Use Ctrl+click for unset value + Use Ctrl+Click for check several values or uncheck value 0 diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index c4fa763cdd1e8..12f76b4c64a14 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -260,19 +260,20 @@ - + !${$.parentName}.use_default_carrier_config:checked + Use Ctrl+Click for check several values or uncheck value - + - + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml index 712e54e56d8c2..26bde8c66d4a9 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml @@ -71,7 +71,7 @@ true true - data.sources + sources From 82dd87d0703cfffd5a11e124ccf6f7dd3127a5d7 Mon Sep 17 00:00:00 2001 From: Aydin Hassan Date: Tue, 18 Jul 2017 11:22:56 +0200 Subject: [PATCH 0300/1004] remove redundant else and use strict check --- .../Backend/Media/ImageEntryConverter.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media/ImageEntryConverter.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media/ImageEntryConverter.php index a8eff8d54a4c8..51839a2653e44 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media/ImageEntryConverter.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media/ImageEntryConverter.php @@ -100,16 +100,15 @@ public function convertFrom(ProductAttributeMediaGalleryEntryInterface $entry) protected function convertFromMediaGalleryEntryContentInterface( ImageContentInterface $content = null ) { - if ($content == null) { + if ($content === null) { return null; - } else { - return [ - 'data' => [ - ImageContentInterface::BASE64_ENCODED_DATA => $content->getBase64EncodedData(), - ImageContentInterface::TYPE => $content->getType(), - ImageContentInterface::NAME => $content->getName(), - ], - ]; - } + } + return [ + 'data' => [ + ImageContentInterface::BASE64_ENCODED_DATA => $content->getBase64EncodedData(), + ImageContentInterface::TYPE => $content->getType(), + ImageContentInterface::NAME => $content->getName(), + ], + ]; } } From 46f4835f84214161933ae92b1a0161802ff8f8a5 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 18 Jul 2017 12:32:04 +0300 Subject: [PATCH 0301/1004] MSI - Msi stock ui aggregation #39 - fixe after merge --- .../Model/SourceStockLinkRepository.php | 26 ------------------- .../SourceStockLinkRepositoryInterface.php | 20 -------------- 2 files changed, 46 deletions(-) diff --git a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php b/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php index 93561bc31a273..3921ab003a375 100644 --- a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php +++ b/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php @@ -19,7 +19,6 @@ */ class SourceStockLinkRepository implements SourceStockLinkRepositoryInterface { - /** * @var SourceStockLinkFactory */ @@ -50,22 +49,6 @@ public function __construct( $this->sourceStockLinkFactory = $sourceStockLinkFactory; } - /** - * @inheritdoc - */ - public function get($linkId) - { - $sourceStockLink= $this->sourceStockLinkFactory->create(); - $this->resourceSourceStockLink->load($sourceStockLink, $linkId, SourceStockLinkInterface::LINK_ID); - - /** @var SourceStockLinkInterface $sourceStockLink */ - if (null === $sourceStockLink->getLinkId()) { - throw NoSuchEntityException::singleField(SourceStockLinkInterface::LINK_ID, $linkId); - } - - return $sourceStockLink; - } - /** * @inheritdoc */ @@ -91,13 +74,4 @@ public function delete(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $ throw new CouldNotDeleteException(__('Could not delete Source Stock Link'), $e); } } - - /** - * @inheritdoc - */ - public function deleteById($linkId) - { - $sourceStockLink = $this->getById($linkId); - $this->delete($sourceStockLink); - } } diff --git a/app/code/Magento/InventoryApi/Api/SourceStockLinkRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceStockLinkRepositoryInterface.php index ed0439498b974..897da3560f5d5 100644 --- a/app/code/Magento/InventoryApi/Api/SourceStockLinkRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceStockLinkRepositoryInterface.php @@ -12,16 +12,6 @@ */ interface SourceStockLinkRepositoryInterface { - - /** - * Get source by given Id. - * - * @param int $linkId - * @return \Magento\InventoryApi\Api\Data\SourceStockLinkInterface - * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function get($linkId); - /** * Save SourceStockLink data * @@ -42,14 +32,4 @@ public function save(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $so * @throws \Magento\Framework\Exception\StateException */ public function delete(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $sourceStockLink); - - /** - * Remove the source assignment from the stock by id. - * - * @param int $linkId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return void - */ - public function deleteById($linkId); } From 749d082386ef8d339f87838d5491385d588830cb Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 18 Jul 2017 12:53:07 +0300 Subject: [PATCH 0302/1004] MAGETWO-70817: remove redundant else and use strict check #10271 - Fixed coding style --- .../Product/Attribute/Backend/Media/ImageEntryConverter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media/ImageEntryConverter.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media/ImageEntryConverter.php index 51839a2653e44..e8b619ac8bb84 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media/ImageEntryConverter.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media/ImageEntryConverter.php @@ -102,7 +102,8 @@ protected function convertFromMediaGalleryEntryContentInterface( ) { if ($content === null) { return null; - } + } + return [ 'data' => [ ImageContentInterface::BASE64_ENCODED_DATA => $content->getBase64EncodedData(), From b1c15119bb6dd25a3b3a5b4951b22ddfb380c33c Mon Sep 17 00:00:00 2001 From: Ricards Date: Tue, 18 Jul 2017 12:56:34 +0300 Subject: [PATCH 0303/1004] Remove unnecessary whitespace --- .../Magento/Sitemap/Model/ResourceModel/Catalog/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php index 228fc2073b047..6e11833e5bc4d 100644 --- a/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/ResourceModel/Catalog/Product.php @@ -429,7 +429,7 @@ public function prepareSelectStatement(\Magento\Framework\DB\Select $select) { return $select; } - + /** * Get product image URL from image filename and path * From 488f9db4aae62789795eafe1654683af66094bae Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 18 Jul 2017 13:33:25 +0300 Subject: [PATCH 0304/1004] MAGETWO-70761: Show values that are duplicate in attribute error msg #10213 - Fixes according to the test results --- app/code/Magento/Catalog/i18n/en_US.csv | 1 + .../adminhtml/templates/catalog/product/attribute/options.phtml | 2 +- .../adminhtml/web/catalog/product/attribute/unique-validate.js | 2 +- app/code/Magento/Swatches/i18n/en_US.csv | 1 + .../adminhtml/templates/catalog/product/attribute/text.phtml | 2 +- .../adminhtml/templates/catalog/product/attribute/visual.phtml | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv index 04500182eba22..145ead923d61e 100644 --- a/app/code/Magento/Catalog/i18n/en_US.csv +++ b/app/code/Magento/Catalog/i18n/en_US.csv @@ -716,4 +716,5 @@ Disable,Disable none,none Overview,Overview Details,Details +"The value of Admin must be unique.", "The value of Admin must be unique." "The value of Admin must be unique. (%1)", "The value of Admin must be unique. (%1)" diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml index 6afc1bbca83f9..a0041d2e02988 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml @@ -101,7 +101,7 @@ $stores = $block->getStoresSortedBySortOrder(); }, "Magento_Catalog/catalog/product/attribute/unique-validate": { "element": "required-dropdown-attribute-unique", - "message": "escapeHtml(__("The value of Admin must be unique. (%1)")) ?>" + "message": "escapeHtml(__("The value of Admin must be unique.")) ?>" } } } diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js index ed96bfbef0089..7fcd30fc49c63 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product/attribute/unique-validate.js @@ -45,7 +45,7 @@ define([ }); if (!isValid) { - msg = _config.message.replace('%1', duplicates.join(', ')); + msg = _config.message + ' (' + duplicates.join(', ') + ')'; } return isValid; diff --git a/app/code/Magento/Swatches/i18n/en_US.csv b/app/code/Magento/Swatches/i18n/en_US.csv index c64c619454e0e..76e87a9ef2443 100644 --- a/app/code/Magento/Swatches/i18n/en_US.csv +++ b/app/code/Magento/Swatches/i18n/en_US.csv @@ -33,5 +33,6 @@ Image,Image "Image Size","Image Size" "Example format: 200x300.","Example format: 200x300." "Image Position","Image Position" +"The value of Admin must be unique.","The value of Admin must be unique." "The value of Admin must be unique. (%1)","The value of Admin must be unique. (%1)" Description,Description diff --git a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml index 2cc3b9d31b0dc..8d4400b3d0477 100644 --- a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml +++ b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/text.phtml @@ -108,7 +108,7 @@ $stores = $block->getStoresSortedBySortOrder(); "Magento_Swatches/js/text": getJsonConfig() ?> , "Magento_Catalog/catalog/product/attribute/unique-validate": { "element": "required-text-swatch-unique", - "message": "escapeHtml(__("The value of Admin must be unique. (%1)")) ?>" + "message": "escapeHtml(__("The value of Admin must be unique.")) ?>" } } } diff --git a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml index 5e437a85073fb..5b971d9a99a3b 100644 --- a/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml +++ b/app/code/Magento/Swatches/view/adminhtml/templates/catalog/product/attribute/visual.phtml @@ -113,7 +113,7 @@ $stores = $block->getStoresSortedBySortOrder(); "Magento_Swatches/js/visual": getJsonConfig() ?> , "Magento_Catalog/catalog/product/attribute/unique-validate": { "element": "required-visual-swatch-unique", - "message": "escapeHtml(__("The value of Admin must be unique. (%1)")) ?>" + "message": "escapeHtml(__("The value of Admin must be unique.")) ?>" } } } From 562ce9e91dc3d8de63a6b34ae463a9986c5a078c Mon Sep 17 00:00:00 2001 From: olysenko Date: Tue, 18 Jul 2017 14:52:58 +0300 Subject: [PATCH 0305/1004] MAGETWO-64120: Error processing your request when placing reorder for simple product of configurable if attribute is changed --- .../Model/Order/Reorder/OrderedProductAvailabilityChecker.php | 4 ++++ .../Reorder/OrderedProductAvailabilityCheckerInterface.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/app/code/Magento/Sales/Model/Order/Reorder/OrderedProductAvailabilityChecker.php b/app/code/Magento/Sales/Model/Order/Reorder/OrderedProductAvailabilityChecker.php index 8d8460c40da66..d7f50e737fa5d 100644 --- a/app/code/Magento/Sales/Model/Order/Reorder/OrderedProductAvailabilityChecker.php +++ b/app/code/Magento/Sales/Model/Order/Reorder/OrderedProductAvailabilityChecker.php @@ -11,6 +11,10 @@ /** * @api * + * Class marked as an API because it can be used as extensibility point to check availability of + * different product types(in order management). Can be configured through di by adding a check as a new element + * of the array $productAvailabilityChecks(constructor argument). A product type should be a key for the new element. + * * Class OrderedProductAvailabilityChecker */ class OrderedProductAvailabilityChecker implements OrderedProductAvailabilityCheckerInterface diff --git a/app/code/Magento/Sales/Model/Order/Reorder/OrderedProductAvailabilityCheckerInterface.php b/app/code/Magento/Sales/Model/Order/Reorder/OrderedProductAvailabilityCheckerInterface.php index dc350eb79343c..556d6f9d870ef 100644 --- a/app/code/Magento/Sales/Model/Order/Reorder/OrderedProductAvailabilityCheckerInterface.php +++ b/app/code/Magento/Sales/Model/Order/Reorder/OrderedProductAvailabilityCheckerInterface.php @@ -8,6 +8,8 @@ use Magento\Sales\Model\Order\Item; /** + * @api + * * Interface OrderedProductAvailabilityCheckerInterface */ interface OrderedProductAvailabilityCheckerInterface From eed28fa82843ad90c56f708a2ff8ed0b868add29 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 18 Jul 2017 15:11:07 +0300 Subject: [PATCH 0306/1004] magento/magento2#10250: update phpserver to support versioned static urls - Coding style update - Regexp updated --- phpserver/router.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/phpserver/router.php b/phpserver/router.php index 5ebacf6fce9fe..3cfba0de463f7 100644 --- a/phpserver/router.php +++ b/phpserver/router.php @@ -63,10 +63,11 @@ $debug($route); if (strpos($route, 'static/version') === 0) { -  $redirectRoute = preg_replace('#static/version[0–9]*/#','static/', $route, 1); -  $debug("redirect static version string to:" . $redirectRoute); -  header('Location: /'.$redirectRoute); -  exit; + $redirectRoute = preg_replace("/version\d+\//", "", $route, 1); + $redirectDebugInfo = "redirect static version string to: " . $redirectRoute; + $debug($redirectDebugInfo); + header('Location: /' . $redirectRoute); + exit; } if (strpos($route, 'media/') === 0 || From 855d48375318ffa3c1a4d3b369bcf2fe6d89fb1c Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 18 Jul 2017 16:24:23 +0300 Subject: [PATCH 0307/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../Model/ResourceModel/Source/Collection.php | 7 ++-- .../SourceCarrierLink/Collection.php | 18 ++-------- .../ResourceModel/SourceItem/Collection.php | 2 +- .../SourceStockLink/Collection.php | 19 +++-------- .../Inventory/Model/SourceCarrierLink.php | 31 +++++++++-------- .../Model/SourceCarrierLinkManagement.php | 24 ++++++------- .../Inventory/Model/SourceItemRepository.php | 20 +++++------ .../Inventory/Model/SourceItemSave.php | 1 - .../Inventory/Model/SourceRepository.php | 16 ++++----- .../Inventory/Model/SourceStockLink.php | 21 ++++++------ .../Model/SourceStockLinkRepository.php | 34 +++++++------------ app/code/Magento/Inventory/Model/Stock.php | 2 +- .../Inventory/Model/StockRepository.php | 20 +++++------ .../Observer/ProcessSourceItemsObserver.php | 2 +- .../Test/Unit/Model/StockRepositoryTest.php | 6 ++-- .../Api/Data/SourceCarrierLinkInterface.php | 7 ++-- .../InventoryApi/Api/Data/SourceInterface.php | 7 ++-- .../Api/Data/SourceItemInterface.php | 7 ++-- .../Data/SourceItemSearchResultsInterface.php | 2 ++ .../Api/Data/SourceSearchResultsInterface.php | 2 ++ .../Api/Data/SourceStockLinkInterface.php | 24 +++++++++++-- .../InventoryApi/Api/Data/StockInterface.php | 9 +++-- .../Api/Data/StockSearchResultsInterface.php | 2 ++ .../Api/SourceItemSaveInterface.php | 2 ++ .../Api/SourceRepositoryInterface.php | 11 +++--- .../Api/StockRepositoryInterface.php | 13 ++++--- 26 files changed, 157 insertions(+), 152 deletions(-) diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php index 4a8b810721bf8..632947cbae992 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Source/Collection.php @@ -5,6 +5,7 @@ */ namespace Magento\Inventory\Model\ResourceModel\Source; +use Magento\Framework\Data\Collection\Db\FetchStrategyInterface; use Magento\Framework\Data\Collection\EntityFactoryInterface; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\Event\ManagerInterface; @@ -17,7 +18,7 @@ use Psr\Log\LoggerInterface; /** - * Resource Collection of Sources entities + * Resource Collection of Source entities * * @api */ @@ -33,7 +34,7 @@ class Collection extends AbstractCollection * * @param EntityFactoryInterface $entityFactory * @param LoggerInterface $logger - * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy + * @param FetchStrategyInterface $fetchStrategy * @param ManagerInterface $eventManager * @param SourceCarrierLinkManagementInterface $sourceCarrierLinkManagement * @param AdapterInterface $connection @@ -42,7 +43,7 @@ class Collection extends AbstractCollection public function __construct( EntityFactoryInterface $entityFactory, LoggerInterface $logger, - \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, + FetchStrategyInterface $fetchStrategy, ManagerInterface $eventManager, SourceCarrierLinkManagementInterface $sourceCarrierLinkManagement, AdapterInterface $connection = null, diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php index 50f3def35103c..4d679b8e7e08b 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink/Collection.php @@ -3,11 +3,10 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Inventory\Model\ResourceModel\SourceCarrierLink; -use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as ResourceSourceCarrierLink; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as SourceCarrierLinkResourceModel; use Magento\Inventory\Model\SourceCarrierLink as SourceCarrierLinkModel; /** @@ -17,21 +16,10 @@ class Collection extends AbstractCollection { /** - * Initialize resource model - * @return void + * @inheritdoc */ protected function _construct() { - $this->_init(SourceCarrierLinkModel::class, ResourceSourceCarrierLink::class); - } - - /** - * Id field name getter - * - * @return string - */ - public function getIdFieldName() - { - return 'source_carrier_link_id'; + $this->_init(SourceCarrierLinkModel::class, SourceCarrierLinkResourceModel::class); } } diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/Collection.php index 7c849ea169d27..5b91378dc537f 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/Collection.php @@ -10,7 +10,7 @@ use Magento\Inventory\Model\SourceItem as SourceItemModel; /** - * Resource Collection of Source Items entity + * Resource Collection of SourceItem entities * * @api */ diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php index c11d6ec089ec5..0e73095f4bcb3 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php @@ -3,35 +3,24 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Inventory\Model\ResourceModel\SourceStockLink; -use Magento\Inventory\Model\ResourceModel\SourceStockLink as ResourceSourceStockLink; use Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection; +use Magento\Inventory\Model\ResourceModel\SourceStockLink as SourceStockLinkResourceModel; use Magento\Inventory\Model\SourceStockLink as SourceStockLinkModel; /** * Resource Collection of SourceStockLink entities + * * @api */ class Collection extends AbstractCollection { /** - * Initialize resource model - * @return void + * @inheritdoc */ protected function _construct() { - $this->_init(SourceStockLinkModel::class, ResourceSourceStockLink::class); - } - - /** - * Id field name getter - * - * @return string - */ - public function getIdFieldName() - { - return 'link_id'; + $this->_init(SourceStockLinkModel::class, SourceStockLinkResourceModel::class); } } diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php index ca42a87a151ab..3659573565540 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php @@ -6,25 +6,27 @@ namespace Magento\Inventory\Model; use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as SourceCarrierLinkResourceModel; +use Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; /** - * @inheritdoc + * {@inheritdoc} + * + * @codeCoverageIgnore */ class SourceCarrierLink extends AbstractExtensibleModel implements SourceCarrierLinkInterface { /** - * Initialize resource model - * - * @return void + * @inheritdoc */ protected function _construct() { - $this->_init(\Magento\Inventory\Model\ResourceModel\SourceCarrierLink::class); + $this->_init(SourceCarrierLinkResourceModel::class); } /** - * @inheritDoc + * @inheritdoc */ public function getCarrierCode() { @@ -32,7 +34,7 @@ public function getCarrierCode() } /** - * @inheritDoc + * @inheritdoc */ public function setCarrierCode($carrierCode) { @@ -40,7 +42,7 @@ public function setCarrierCode($carrierCode) } /** - * @inheritDoc + * @inheritdoc */ public function getPosition() { @@ -48,7 +50,7 @@ public function getPosition() } /** - * @inheritDoc + * @inheritdoc */ public function setPosition($position) { @@ -56,7 +58,7 @@ public function setPosition($position) } /** - * @inheritDoc + * @inheritdoc */ public function getExtensionAttributes() { @@ -69,11 +71,10 @@ public function getExtensionAttributes() } /** - * @inheritDoc + * @inheritdoc */ - public function setExtensionAttributes( - \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface $extensionAttributes - ) { - return $this->_setExtensionAttributes($extensionAttributes); + public function setExtensionAttributes(SourceCarrierLinkExtensionInterface $extensionAttributes) + { + $this->_setExtensionAttributes($extensionAttributes); } } diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php index c71ced6523d67..97fd96bb3cbda 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php @@ -9,9 +9,9 @@ use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\App\ResourceConnection; use Magento\Framework\Exception\StateException; -use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; -use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as ResourceSourceCarrierLink; -use Magento\Inventory\Model\ResourceModel\SourceCarrierLink\CollectionFactory as CarrierLinkCollectionFactory; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as SourceCarrierLinkResourceModel; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink\Collection; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink\CollectionFactory; use Magento\Inventory\Setup\InstallSchema; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; use Magento\InventoryApi\Api\Data\SourceInterface; @@ -27,9 +27,9 @@ class SourceCarrierLinkManagement implements SourceCarrierLinkManagementInterfac private $connection; /** - * @var ResourceSourceCarrierLink + * @var SourceCarrierLinkResourceModel */ - private $resourceSourceCarrierLink; + private $sourceCarrierLinkResource; /** * @var CollectionProcessorInterface @@ -37,7 +37,7 @@ class SourceCarrierLinkManagement implements SourceCarrierLinkManagementInterfac private $collectionProcessor; /** - * @var CarrierLinkCollectionFactory + * @var CollectionFactory */ private $carrierLinkCollectionFactory; @@ -50,20 +50,20 @@ class SourceCarrierLinkManagement implements SourceCarrierLinkManagementInterfac * SourceCarrierLinkManagement constructor * * @param ResourceConnection $connection - * @param ResourceSourceCarrierLink $resourceSourceCarrierLink + * @param SourceCarrierLinkResourceModel $sourceCarrierLinkResource * @param CollectionProcessorInterface $collectionProcessor - * @param CarrierLinkCollectionFactory $carrierLinkCollectionFactory + * @param CollectionFactory $carrierLinkCollectionFactory * @param SearchCriteriaBuilder $searchCriteriaBuilder */ public function __construct( ResourceConnection $connection, - ResourceSourceCarrierLink $resourceSourceCarrierLink, + SourceCarrierLinkResourceModel $sourceCarrierLinkResource, CollectionProcessorInterface $collectionProcessor, - CarrierLinkCollectionFactory $carrierLinkCollectionFactory, + CollectionFactory $carrierLinkCollectionFactory, SearchCriteriaBuilder $searchCriteriaBuilder ) { $this->connection = $connection; - $this->resourceSourceCarrierLink = $resourceSourceCarrierLink; + $this->sourceCarrierLinkResource = $sourceCarrierLinkResource; $this->collectionProcessor = $collectionProcessor; $this->carrierLinkCollectionFactory = $carrierLinkCollectionFactory; $this->searchCriteriaBuilder = $searchCriteriaBuilder; @@ -130,7 +130,7 @@ public function loadCarrierLinksBySource(SourceInterface $source) ->addFilter(SourceInterface::SOURCE_ID, $source->getSourceId()) ->create(); - /** @var ResourceSourceCarrierLink\Collection $collection */ + /** @var Collection $collection */ $collection = $this->carrierLinkCollectionFactory->create(); $this->collectionProcessor->process($searchCriteria, $collection); diff --git a/app/code/Magento/Inventory/Model/SourceItemRepository.php b/app/code/Magento/Inventory/Model/SourceItemRepository.php index 2df9ea6616bdd..a4d2b3132b5aa 100644 --- a/app/code/Magento/Inventory/Model/SourceItemRepository.php +++ b/app/code/Magento/Inventory/Model/SourceItemRepository.php @@ -10,7 +10,7 @@ use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotDeleteException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Inventory\Model\ResourceModel\SourceItem as ResourceSource; +use Magento\Inventory\Model\ResourceModel\SourceItem as SourceResourceModel; use Magento\Inventory\Model\ResourceModel\SourceItem\Collection; use Magento\Inventory\Model\ResourceModel\SourceItem\CollectionFactory; use Magento\InventoryApi\Api\Data\SourceItemInterface; @@ -26,9 +26,9 @@ class SourceItemRepository implements SourceItemRepositoryInterface { /** - * @var ResourceSource + * @var SourceResourceModel */ - private $resourceSource; + private $sourceResource; /** * @var SourceItemInterfaceFactory @@ -63,7 +63,7 @@ class SourceItemRepository implements SourceItemRepositoryInterface /** * SourceRepository constructor * - * @param ResourceSource $resourceSource + * @param SourceResourceModel $sourceResource * @param SourceItemInterfaceFactory $sourceItemFactory * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $sourceItemCollectionFactory @@ -72,7 +72,7 @@ class SourceItemRepository implements SourceItemRepositoryInterface * @param LoggerInterface $logger */ public function __construct( - ResourceSource $resourceSource, + SourceResourceModel $sourceResource, SourceItemInterfaceFactory $sourceItemFactory, CollectionProcessorInterface $collectionProcessor, CollectionFactory $sourceItemCollectionFactory, @@ -80,7 +80,7 @@ public function __construct( SearchCriteriaBuilder $searchCriteriaBuilder, LoggerInterface $logger ) { - $this->resourceSource = $resourceSource; + $this->sourceResource = $sourceResource; $this->sourceItemFactory = $sourceItemFactory; $this->collectionProcessor = $collectionProcessor; $this->sourceItemCollectionFactory = $sourceItemCollectionFactory; @@ -95,7 +95,7 @@ public function __construct( public function get($sourceItemId) { $sourceItem = $this->sourceItemFactory->create(); - $this->resourceSource->load($sourceItem, $sourceItemId, SourceItemInterface::SOURCE_ITEM_ID); + $this->sourceResource->load($sourceItem, $sourceItemId, SourceItemInterface::SOURCE_ITEM_ID); if (null === $sourceItem->getSourceItemId()) { throw NoSuchEntityException::singleField(SourceItemInterface::SOURCE_ITEM_ID, $sourceItemId); @@ -124,12 +124,10 @@ public function getList(SearchCriteriaInterface $searchCriteria) /** * @inheritdoc */ - public function delete($sourceItemId) + public function delete(SourceItemInterface $sourceItem) { - $sourceItem = $this->get($sourceItemId); - try { - $this->resourceSource->delete($sourceItem); + $this->sourceResource->delete($sourceItem); } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotDeleteException(__('Could not delete Source Item'), $e); diff --git a/app/code/Magento/Inventory/Model/SourceItemSave.php b/app/code/Magento/Inventory/Model/SourceItemSave.php index 5393058fcf7bb..960ab9fc60da1 100644 --- a/app/code/Magento/Inventory/Model/SourceItemSave.php +++ b/app/code/Magento/Inventory/Model/SourceItemSave.php @@ -6,7 +6,6 @@ namespace Magento\Inventory\Model; use Magento\Framework\Exception\CouldNotSaveException; -use Magento\Inventory\Model\ResourceModel\SourceItem as ResourceSource; use Magento\Inventory\Model\ResourceModel\SourceItem\SaveMultiple; use Magento\InventoryApi\Api\SourceItemSaveInterface; use Psr\Log\LoggerInterface; diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index bd15e88c0f375..db6aab1b53014 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -10,7 +10,7 @@ use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Inventory\Model\ResourceModel\Source as ResourceSource; +use Magento\Inventory\Model\ResourceModel\Source as SourceResourceModel; use Magento\Inventory\Model\ResourceModel\Source\Collection; use Magento\Inventory\Model\ResourceModel\Source\CollectionFactory; use Magento\InventoryApi\Api\Data\SourceInterface; @@ -26,9 +26,9 @@ class SourceRepository implements SourceRepositoryInterface { /** - * @var ResourceSource + * @var SourceResourceModel */ - private $resourceSource; + private $sourceResource; /** * @var SourceInterfaceFactory @@ -63,7 +63,7 @@ class SourceRepository implements SourceRepositoryInterface /** * SourceRepository constructor * - * @param ResourceSource $resourceSource + * @param SourceResourceModel $sourceResource * @param SourceInterfaceFactory $sourceFactory * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $sourceCollectionFactory @@ -72,7 +72,7 @@ class SourceRepository implements SourceRepositoryInterface * @param LoggerInterface $logger */ public function __construct( - ResourceSource $resourceSource, + SourceResourceModel $sourceResource, SourceInterfaceFactory $sourceFactory, CollectionProcessorInterface $collectionProcessor, CollectionFactory $sourceCollectionFactory, @@ -80,7 +80,7 @@ public function __construct( SearchCriteriaBuilder $searchCriteriaBuilder, LoggerInterface $logger ) { - $this->resourceSource = $resourceSource; + $this->sourceResource = $sourceResource; $this->sourceFactory = $sourceFactory; $this->collectionProcessor = $collectionProcessor; $this->sourceCollectionFactory = $sourceCollectionFactory; @@ -95,7 +95,7 @@ public function __construct( public function save(SourceInterface $source) { try { - $this->resourceSource->save($source); + $this->sourceResource->save($source); return $source->getSourceId(); } catch (\Exception $e) { $this->logger->error($e->getMessage()); @@ -109,7 +109,7 @@ public function save(SourceInterface $source) public function get($sourceId) { $source = $this->sourceFactory->create(); - $this->resourceSource->load($source, $sourceId, SourceInterface::SOURCE_ID); + $this->sourceResource->load($source, $sourceId, SourceInterface::SOURCE_ID); if (null === $source->getSourceId()) { throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); diff --git a/app/code/Magento/Inventory/Model/SourceStockLink.php b/app/code/Magento/Inventory/Model/SourceStockLink.php index 3c14c13711846..88027970212d6 100644 --- a/app/code/Magento/Inventory/Model/SourceStockLink.php +++ b/app/code/Magento/Inventory/Model/SourceStockLink.php @@ -6,21 +6,23 @@ namespace Magento\Inventory\Model; use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Inventory\Model\ResourceModel\SourceStockLink as SourceStockLinkResourceModel; +use Magento\InventoryApi\Api\Data\SourceStockLinkExtensionInterface; use Magento\InventoryApi\Api\Data\SourceStockLinkInterface; /** - * @inheritdoc + * {@inheritdoc} + * + * @codeCoverageIgnore */ class SourceStockLink extends AbstractExtensibleModel implements SourceStockLinkInterface { /** - * Initialize resource model - * - * @return void + * @inheritdoc */ protected function _construct() { - $this->_init(\Magento\Inventory\Model\ResourceModel\SourceStockLink::class); + $this->_init(SourceStockLinkResourceModel::class); } /** @@ -85,11 +87,10 @@ public function getExtensionAttributes() } /** - * @inheritDoc + * @inheritdoc */ - public function setExtensionAttributes( - \Magento\InventoryApi\Api\Data\SourceStockLinkExtensionInterface $extensionAttributes - ) { - return $this->_setExtensionAttributes($extensionAttributes); + public function setExtensionAttributes(SourceStockLinkExtensionInterface $extensionAttributes) + { + $this->_setExtensionAttributes($extensionAttributes); } } diff --git a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php b/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php index 3921ab003a375..aeef0ebd6097f 100644 --- a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php +++ b/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php @@ -7,27 +7,20 @@ use Magento\Framework\Exception\CouldNotDeleteException; use Magento\Framework\Exception\CouldNotSaveException; -use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Inventory\Model\ResourceModel\SourceStockLink as ResourceSourceStockLink; +use Magento\Inventory\Model\ResourceModel\SourceStockLink as SourceStockLinkResourceModel; use Magento\InventoryApi\Api\Data\SourceStockLinkInterface; -use Magento\InventoryApi\Api\Data\SourceStockLinkInterfaceFactory as SourceStockLinkFactory; use Magento\InventoryApi\Api\SourceStockLinkRepositoryInterface; use Psr\Log\LoggerInterface; /** - * Model to assign specific source to particular stock. + * @inheritdoc */ class SourceStockLinkRepository implements SourceStockLinkRepositoryInterface { /** - * @var SourceStockLinkFactory + * @var SourceStockLinkResourceModel */ - private $sourceStockLinkFactory; - - /** - * @var ResourceSourceStockLink - */ - private $resourceSourceStockLink; + private $sourceStockLinkResource; /** * @var LoggerInterface @@ -35,27 +28,24 @@ class SourceStockLinkRepository implements SourceStockLinkRepositoryInterface private $logger; /** - * @param ResourceSourceStockLink $resourceSourceStockLink + * @param SourceStockLinkResourceModel $sourceStockLinkResource * @param LoggerInterface $logger - * @param SourceStockLinkFactory $sourceStockLinkFactory */ public function __construct( - ResourceSourceStockLink $resourceSourceStockLink, - LoggerInterface $logger, - SourceStockLinkFactory $sourceStockLinkFactory + SourceStockLinkResourceModel $sourceStockLinkResource, + LoggerInterface $logger ) { - $this->resourceSourceStockLink = $resourceSourceStockLink; + $this->sourceStockLinkResource = $sourceStockLinkResource; $this->logger = $logger; - $this->sourceStockLinkFactory = $sourceStockLinkFactory; } /** * @inheritdoc */ - public function save(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $sourceStockLink) + public function save(SourceStockLinkInterface $sourceStockLink) { try { - $this->resourceSourceStockLink->save($sourceStockLink); + $this->sourceStockLinkResource->save($sourceStockLink); } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotSaveException(__('Could not save Source Stock Link'), $e); @@ -65,10 +55,10 @@ public function save(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $so /** * @inheritdoc */ - public function delete(\Magento\InventoryApi\Api\Data\SourceStockLinkInterface $sourceStockLink) + public function delete(SourceStockLinkInterface $sourceStockLink) { try { - $this->resourceSourceStockLink->delete($sourceStockLink); + $this->sourceStockLinkResource->delete($sourceStockLink); } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotDeleteException(__('Could not delete Source Stock Link'), $e); diff --git a/app/code/Magento/Inventory/Model/Stock.php b/app/code/Magento/Inventory/Model/Stock.php index 7069843ec3e8d..b89af5ec413d6 100644 --- a/app/code/Magento/Inventory/Model/Stock.php +++ b/app/code/Magento/Inventory/Model/Stock.php @@ -75,6 +75,6 @@ public function getExtensionAttributes() */ public function setExtensionAttributes(StockExtensionInterface $extensionAttributes) { - return $this->_setExtensionAttributes($extensionAttributes); + $this->_setExtensionAttributes($extensionAttributes); } } diff --git a/app/code/Magento/Inventory/Model/StockRepository.php b/app/code/Magento/Inventory/Model/StockRepository.php index b34efb431ab18..73adfb64a0828 100644 --- a/app/code/Magento/Inventory/Model/StockRepository.php +++ b/app/code/Magento/Inventory/Model/StockRepository.php @@ -11,7 +11,7 @@ use Magento\Framework\Exception\CouldNotDeleteException; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Inventory\Model\ResourceModel\Stock as ResourceStock; +use Magento\Inventory\Model\ResourceModel\Stock as StockResourceModel; use Magento\Inventory\Model\ResourceModel\Stock\Collection; use Magento\Inventory\Model\ResourceModel\Stock\CollectionFactory; use Magento\InventoryApi\Api\Data\StockInterface; @@ -27,9 +27,9 @@ class StockRepository implements StockRepositoryInterface { /** - * @var ResourceStock + * @var StockResourceModel */ - private $resourceStock; + private $stockResource; /** * @var StockInterfaceFactory @@ -64,7 +64,7 @@ class StockRepository implements StockRepositoryInterface /** * SourceRepository constructor * - * @param ResourceStock $resourceStock + * @param StockResourceModel $stockResource * @param StockInterfaceFactory $stockFactory * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $stockCollectionFactory @@ -73,7 +73,7 @@ class StockRepository implements StockRepositoryInterface * @param LoggerInterface $logger */ public function __construct( - ResourceStock $resourceStock, + StockResourceModel $stockResource, StockInterfaceFactory $stockFactory, CollectionProcessorInterface $collectionProcessor, CollectionFactory $stockCollectionFactory, @@ -81,7 +81,7 @@ public function __construct( SearchCriteriaBuilder $searchCriteriaBuilder, LoggerInterface $logger ) { - $this->resourceStock = $resourceStock; + $this->stockResource = $stockResource; $this->stockFactory = $stockFactory; $this->collectionProcessor = $collectionProcessor; $this->stockCollectionFactory = $stockCollectionFactory; @@ -96,7 +96,7 @@ public function __construct( public function save(StockInterface $stock) { try { - $this->resourceStock->save($stock); + $this->stockResource->save($stock); return $stock->getStockId(); } catch (\Exception $e) { $this->logger->error($e->getMessage()); @@ -110,7 +110,7 @@ public function save(StockInterface $stock) public function get($stockId) { $stock = $this->stockFactory->create(); - $this->resourceStock->load($stock, $stockId, StockInterface::STOCK_ID); + $this->stockResource->load($stock, $stockId, StockInterface::STOCK_ID); if (null === $stock->getStockId()) { throw NoSuchEntityException::singleField(StockInterface::STOCK_ID, $stockId); @@ -121,12 +121,12 @@ public function get($stockId) /** * @inheritdoc */ - public function delete($stockId) + public function deleteById($stockId) { $stockItem = $this->get($stockId); try { - $this->resourceStock->delete($stockItem); + $this->stockResource->delete($stockItem); } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotDeleteException(__('Could not delete Stock'), $e); diff --git a/app/code/Magento/Inventory/Observer/ProcessSourceItemsObserver.php b/app/code/Magento/Inventory/Observer/ProcessSourceItemsObserver.php index 6d618221429a1..428283aee0efe 100644 --- a/app/code/Magento/Inventory/Observer/ProcessSourceItemsObserver.php +++ b/app/code/Magento/Inventory/Observer/ProcessSourceItemsObserver.php @@ -16,7 +16,7 @@ * This needs to be handled in dedicated observer, because there is no pre-defined way of making several API calls for * Form submission handling */ -final class ProcessSourceItemsObserver implements ObserverInterface +class ProcessSourceItemsObserver implements ObserverInterface { /** * @var SourceItemsProcessor diff --git a/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php index 494a6304459f0..f2a5e2dda826d 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php @@ -307,7 +307,7 @@ public function testGetListWithoutSearchCriteria() self::assertSame($searchResults, $this->model->getList()); } - public function testDelete() + public function testDeleteById() { $stockId = 345; $this->stock @@ -328,7 +328,7 @@ public function testDelete() ->method('delete') ->with($this->stock); - $this->model->delete($stockId); + $this->model->deleteById($stockId); } /** @@ -354,6 +354,6 @@ public function testDeleteErrorExpectsException() StockInterface::STOCK_ID ); - $this->model->delete($stockId); + $this->model->deleteById($stockId); } } diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php index acdccf85c159e..f25c1cf333853 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceCarrierLinkInterface.php @@ -6,10 +6,13 @@ namespace Magento\InventoryApi\Api\Data; use Magento\Framework\Api\ExtensibleDataInterface; +use Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface; /** * Represents relation between some physical storage and shipping method * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface SourceCarrierLinkInterface extends ExtensibleDataInterface @@ -64,7 +67,5 @@ public function getExtensionAttributes(); * @param \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface $extensionAttributes * @return $this */ - public function setExtensionAttributes( - \Magento\InventoryApi\Api\Data\SourceCarrierLinkExtensionInterface $extensionAttributes - ); + public function setExtensionAttributes(SourceCarrierLinkExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php index 6cd4b3823ff05..2b49210e9bed2 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceInterface.php @@ -6,10 +6,13 @@ namespace Magento\InventoryApi\Api\Data; use Magento\Framework\Api\ExtensibleDataInterface; +use Magento\InventoryApi\Api\Data\SourceExtensionInterface; /** * Represents physical storage, i.e. brick and mortar store or warehouse * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface SourceInterface extends ExtensibleDataInterface @@ -330,7 +333,5 @@ public function getExtensionAttributes(); * @param \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes * @return void */ - public function setExtensionAttributes( - \Magento\InventoryApi\Api\Data\SourceExtensionInterface $extensionAttributes - ); + public function setExtensionAttributes(SourceExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php index 5fa074baa09b5..3ae4eeeabd9f2 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php @@ -6,10 +6,13 @@ namespace Magento\InventoryApi\Api\Data; use Magento\Framework\Api\ExtensibleDataInterface; +use Magento\InventoryApi\Api\Data\SourceItemExtensionInterface; /** * Represents amount of product on physical storage * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface SourceItemInterface extends ExtensibleDataInterface @@ -111,7 +114,5 @@ public function getExtensionAttributes(); * @param \Magento\InventoryApi\Api\Data\SourceItemExtensionInterface $extensionAttributes * @return void */ - public function setExtensionAttributes( - \Magento\InventoryApi\Api\Data\SourceItemExtensionInterface $extensionAttributes - ); + public function setExtensionAttributes(SourceItemExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceItemSearchResultsInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceItemSearchResultsInterface.php index d0b2205ce2a89..56bb2d35fe84e 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceItemSearchResultsInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceItemSearchResultsInterface.php @@ -10,6 +10,8 @@ /** * Search results of Repository::getList method * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface SourceItemSearchResultsInterface extends SearchResultsInterface diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php index 43528cbbc9621..af6f63f885a16 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceSearchResultsInterface.php @@ -10,6 +10,8 @@ /** * Search results of Repository::getList method * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface SourceSearchResultsInterface extends SearchResultsInterface diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php index 747ffb952ad79..d8d273b78fc7d 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php @@ -6,9 +6,12 @@ namespace Magento\InventoryApi\Api\Data; use Magento\Framework\Api\ExtensibleDataInterface; +use Magento\InventoryApi\Api\Data\SourceStockLinkExtensionInterface; /** - * Represents relation between some physical storage and stock aggregation + * Represents relation between some physical storages and stock aggregation + * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser * * @api */ @@ -25,14 +28,14 @@ interface SourceStockLinkInterface extends ExtensibleDataInterface /** * Get link id * - * @return string + * @return int */ public function getLinkId(); /** * Set link id * - * @param string $linkId + * @param int $linkId * @return void */ public function setLinkId($linkId); @@ -66,4 +69,19 @@ public function getStockId(); * @return void */ public function setStockId($stockId); + + /** + * Retrieve existing extension attributes object + * + * @return \Magento\InventoryApi\Api\Data\SourceStockLinkExtensionInterface|null + */ + public function getExtensionAttributes(); + + /** + * Set an extension attributes object + * + * @param \Magento\InventoryApi\Api\Data\SourceStockLinkExtensionInterface $extensionAttributes + * @return $this + */ + public function setExtensionAttributes(SourceStockLinkExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/InventoryApi/Api/Data/StockInterface.php b/app/code/Magento/InventoryApi/Api/Data/StockInterface.php index 899abfa4999a7..a03f29ea6c4ec 100644 --- a/app/code/Magento/InventoryApi/Api/Data/StockInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/StockInterface.php @@ -6,8 +6,13 @@ namespace Magento\InventoryApi\Api\Data; use Magento\Framework\Api\ExtensibleDataInterface; +use Magento\InventoryApi\Api\Data\StockExtensionInterface; /** + * Represents product aggregation among some different physical storages (in technical words, it is an index) + * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface StockInterface extends ExtensibleDataInterface @@ -62,7 +67,5 @@ public function getExtensionAttributes(); * @param \Magento\InventoryApi\Api\Data\StockExtensionInterface $extensionAttributes * @return void */ - public function setExtensionAttributes( - \Magento\InventoryApi\Api\Data\StockExtensionInterface $extensionAttributes - ); + public function setExtensionAttributes(StockExtensionInterface $extensionAttributes); } diff --git a/app/code/Magento/InventoryApi/Api/Data/StockSearchResultsInterface.php b/app/code/Magento/InventoryApi/Api/Data/StockSearchResultsInterface.php index 0bcde45bede71..aceefe25a7ad6 100644 --- a/app/code/Magento/InventoryApi/Api/Data/StockSearchResultsInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/StockSearchResultsInterface.php @@ -10,6 +10,8 @@ /** * Search results of Repository::getList method * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface StockSearchResultsInterface extends SearchResultsInterface diff --git a/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php b/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php index 93a2cc9042bbc..703a9cd778d6c 100644 --- a/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php @@ -9,6 +9,8 @@ * Service method for source items multiple save * Performance efficient API, used for stock synchronization * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface SourceItemSaveInterface diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index f0fb295e26adb..efa46f7d58bbb 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -5,9 +5,14 @@ */ namespace Magento\InventoryApi\Api; +use Magento\Framework\Api\SearchCriteriaInterface; +use Magento\InventoryApi\Api\Data\SourceInterface; + /** * This is Facade for basic operations with Source * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface SourceRepositoryInterface @@ -19,7 +24,7 @@ interface SourceRepositoryInterface * @return int * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function save(\Magento\InventoryApi\Api\Data\SourceInterface $source); + public function save(SourceInterface $source); /** * Get Source data by given sourceId. If you want to create plugin on get method, also you need to create separate @@ -37,7 +42,5 @@ public function get($sourceId); * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\InventoryApi\Api\Data\SourceSearchResultsInterface */ - public function getList( - \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null - ); + public function getList(SearchCriteriaInterface $searchCriteria = null); } diff --git a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php index cd8a74c9e8ab5..23b2c7d42a8d7 100644 --- a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php @@ -5,9 +5,14 @@ */ namespace Magento\InventoryApi\Api; +use Magento\Framework\Api\SearchCriteriaInterface; +use Magento\InventoryApi\Api\Data\StockInterface; + /** * This is Facade for basic operations with Stock * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface StockRepositoryInterface @@ -19,7 +24,7 @@ interface StockRepositoryInterface * @return int * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function save(\Magento\InventoryApi\Api\Data\StockInterface $stock); + public function save(StockInterface $stock); /** * Get Stock data by given stockId. If you want to create plugin on get method, also you need to create separate @@ -38,7 +43,7 @@ public function get($stockId); * @return void * @throws \Magento\Framework\Exception\NoSuchEntityException | \Magento\Framework\Exception\CouldNotDeleteException */ - public function delete($stockId); + public function deleteById($stockId); /** * Load Stock data collection by given search criteria @@ -46,7 +51,5 @@ public function delete($stockId); * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\InventoryApi\Api\Data\StockSearchResultsInterface */ - public function getList( - \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria = null - ); + public function getList(SearchCriteriaInterface $searchCriteria = null); } From 866b7e12006fbd3e611d715232c9104be55ed91a Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Tue, 18 Jul 2017 18:49:24 +0300 Subject: [PATCH 0308/1004] MSI - Msi stock ui aggregation #39 - source item api refactoring --- .../Model/ResourceModel/SourceCarrierLink.php | 7 +- .../Model/ResourceModel/SourceItem.php | 2 +- .../Magento/Inventory/Model/SourceItem.php | 8 -- .../Inventory/Model/SourceItemRepository.php | 34 ------- .../Observer/SourceItemsProcessor.php | 2 +- .../Magento/Inventory/Setup/InstallSchema.php | 2 +- .../Unit/Model/SourceItemRepositoryTest.php | 89 +------------------ .../Product/Form/Modifier/Sources.php | 1 - .../Api/Data/SourceItemInterface.php | 9 +- .../Api/SourceItemRepositoryInterface.php | 32 ++++--- .../Api/SourceItemSaveInterface.php | 4 +- .../Api/StockRepositoryInterface.php | 19 ++-- 12 files changed, 35 insertions(+), 174 deletions(-) diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php index 76b39f71fe680..f96c040cab1e6 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php @@ -9,14 +9,13 @@ use Magento\Inventory\Setup\InstallSchema; /** - * This class needed for service internal purposes only, to make collection work properly + * Implementation of basic operations for SourceCarrierLink entity for specific db layer + * This class needed for internal purposes only, to make collection work properly */ class SourceCarrierLink extends AbstractDb { /** - * Initialize resource model - * - * @return void + * @inheritdoc */ protected function _construct() { diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php index fd387dd158df3..2437394550832 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php @@ -19,6 +19,6 @@ class SourceItem extends AbstractDb */ protected function _construct() { - $this->_init(InstallSchema::TABLE_NAME_SOURCE_ITEM, SourceItemInterface::SOURCE_ITEM_ID); + $this->_init(InstallSchema::TABLE_NAME_SOURCE_ITEM, 'source_item_id'); } } diff --git a/app/code/Magento/Inventory/Model/SourceItem.php b/app/code/Magento/Inventory/Model/SourceItem.php index 2d3952f5ea9ea..01aecf99650e2 100644 --- a/app/code/Magento/Inventory/Model/SourceItem.php +++ b/app/code/Magento/Inventory/Model/SourceItem.php @@ -25,14 +25,6 @@ protected function _construct() $this->_init(SourceItemResourceModel::class); } - /** - * @inheritdoc - */ - public function getSourceItemId() - { - return $this->getData(SourceItemInterface::SOURCE_ITEM_ID); - } - /** * @inheritdoc */ diff --git a/app/code/Magento/Inventory/Model/SourceItemRepository.php b/app/code/Magento/Inventory/Model/SourceItemRepository.php index a4d2b3132b5aa..965a7935ca32a 100644 --- a/app/code/Magento/Inventory/Model/SourceItemRepository.php +++ b/app/code/Magento/Inventory/Model/SourceItemRepository.php @@ -6,15 +6,12 @@ namespace Magento\Inventory\Model; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; -use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotDeleteException; -use Magento\Framework\Exception\NoSuchEntityException; use Magento\Inventory\Model\ResourceModel\SourceItem as SourceResourceModel; use Magento\Inventory\Model\ResourceModel\SourceItem\Collection; use Magento\Inventory\Model\ResourceModel\SourceItem\CollectionFactory; use Magento\InventoryApi\Api\Data\SourceItemInterface; -use Magento\InventoryApi\Api\Data\SourceItemInterfaceFactory; use Magento\InventoryApi\Api\Data\SourceItemSearchResultsInterface; use Magento\InventoryApi\Api\Data\SourceItemSearchResultsInterfaceFactory; use Magento\InventoryApi\Api\SourceItemRepositoryInterface; @@ -30,11 +27,6 @@ class SourceItemRepository implements SourceItemRepositoryInterface */ private $sourceResource; - /** - * @var SourceItemInterfaceFactory - */ - private $sourceItemFactory; - /** * @var CollectionProcessorInterface */ @@ -50,11 +42,6 @@ class SourceItemRepository implements SourceItemRepositoryInterface */ private $sourceItemSearchResultsFactory; - /** - * @var SearchCriteriaBuilder - */ - private $searchCriteriaBuilder; - /** * @var LoggerInterface */ @@ -64,46 +51,25 @@ class SourceItemRepository implements SourceItemRepositoryInterface * SourceRepository constructor * * @param SourceResourceModel $sourceResource - * @param SourceItemInterfaceFactory $sourceItemFactory * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $sourceItemCollectionFactory * @param SourceItemSearchResultsInterfaceFactory $sourceItemSearchResultsFactory - * @param SearchCriteriaBuilder $searchCriteriaBuilder * @param LoggerInterface $logger */ public function __construct( SourceResourceModel $sourceResource, - SourceItemInterfaceFactory $sourceItemFactory, CollectionProcessorInterface $collectionProcessor, CollectionFactory $sourceItemCollectionFactory, SourceItemSearchResultsInterfaceFactory $sourceItemSearchResultsFactory, - SearchCriteriaBuilder $searchCriteriaBuilder, LoggerInterface $logger ) { $this->sourceResource = $sourceResource; - $this->sourceItemFactory = $sourceItemFactory; $this->collectionProcessor = $collectionProcessor; $this->sourceItemCollectionFactory = $sourceItemCollectionFactory; $this->sourceItemSearchResultsFactory = $sourceItemSearchResultsFactory; - $this->searchCriteriaBuilder = $searchCriteriaBuilder; $this->logger = $logger; } - /** - * @inheritdoc - */ - public function get($sourceItemId) - { - $sourceItem = $this->sourceItemFactory->create(); - $this->sourceResource->load($sourceItem, $sourceItemId, SourceItemInterface::SOURCE_ITEM_ID); - - if (null === $sourceItem->getSourceItemId()) { - throw NoSuchEntityException::singleField(SourceItemInterface::SOURCE_ITEM_ID, $sourceItemId); - } - - return $sourceItem; - } - /** * @inheritdoc */ diff --git a/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php b/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php index 91242bde11d67..d1c3307d6b7ed 100644 --- a/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php +++ b/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php @@ -144,7 +144,7 @@ private function validateSourceItemData(array $sourceItemData) private function deleteSourceItems(array $sourceItems) { foreach ($sourceItems as $sourceItem) { - $this->sourceItemRepository->delete($sourceItem->getSourceItemId()); + $this->sourceItemRepository->delete($sourceItem); } } } diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index c3180d1a4ed45..6163beef82083 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -365,7 +365,7 @@ private function createSourceItemTable(SchemaSetupInterface $setup) )->setComment( 'Inventory Source item Table' )->addColumn( - SourceItemInterface::SOURCE_ITEM_ID, + 'source_item_id', Table::TYPE_INTEGER, null, [ diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php index 3b0a1ee8ca3b5..056042dfcd133 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php @@ -108,52 +108,6 @@ protected function setUp() ); } - public function testGet() - { - $sourceItemId = 345; - - $this->sourceItem - ->expects($this->once()) - ->method('getSourceItemId') - ->willReturn($sourceItemId); - $this->sourceItemFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->sourceItem); - $this->resourceSource - ->expects($this->once()) - ->method('load') - ->with($this->sourceItem, $sourceItemId, SourceItemInterface::SOURCE_ITEM_ID); - - self::assertSame($this->sourceItem, $this->sourceItemRepository->get($sourceItemId)); - } - - /** - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - */ - public function testGetIfEntityIsNotFound() - { - $sourceItemId = 0; - - $this->sourceItem - ->expects($this->once()) - ->method('getSourceItemId') - ->willReturn(null); - $this->sourceItemFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->sourceItem); - $this->resourceSource->expects($this->once()) - ->method('load') - ->with( - $this->sourceItem, - $sourceItemId, - SourceItemInterface::SOURCE_ITEM_ID - ); - - $this->sourceItemRepository->get($sourceItemId); - } - public function testGetListWithSearchCriteria() { $items = [ @@ -209,52 +163,11 @@ public function testGetListWithSearchCriteria() public function testDelete() { - $sourceItemId = 345; - - $this->sourceItem - ->expects($this->once()) - ->method('getSourceItemId') - ->willReturn($sourceItemId); - $this->sourceItemFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->sourceItem); - $this->resourceSource - ->expects($this->once()) - ->method('load') - ->with($this->sourceItem, $sourceItemId, SourceItemInterface::SOURCE_ITEM_ID); - $this->resourceSource ->expects($this->once()) ->method('delete') ->with($this->sourceItem); - $this->sourceItemRepository->delete($sourceItemId); - } - - /** - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - */ - public function testDeleteIfEntityIsNotFound() - { - $sourceItemId = 0; - - $this->sourceItem - ->expects($this->once()) - ->method('getSourceItemId') - ->willReturn(null); - $this->sourceItemFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->sourceItem); - $this->resourceSource->expects($this->once()) - ->method('load') - ->with( - $this->sourceItem, - $sourceItemId, - SourceItemInterface::SOURCE_ITEM_ID - ); - - $this->sourceItemRepository->delete($sourceItemId); + $this->sourceItemRepository->delete($this->sourceItem); } } diff --git a/app/code/Magento/Inventory/Ui/DataProvider/Product/Form/Modifier/Sources.php b/app/code/Magento/Inventory/Ui/DataProvider/Product/Form/Modifier/Sources.php index 714c8b3062203..df4a4781929c7 100644 --- a/app/code/Magento/Inventory/Ui/DataProvider/Product/Form/Modifier/Sources.php +++ b/app/code/Magento/Inventory/Ui/DataProvider/Product/Form/Modifier/Sources.php @@ -72,7 +72,6 @@ private function getSourceItemsData() $sourceItemsData = []; foreach ($collection->getData() as $row) { $sourceItemsData[] = [ - SourceItemInterface::SOURCE_ITEM_ID => $row[SourceItemInterface::SOURCE_ITEM_ID], SourceItemInterface::SOURCE_ID => $row[SourceItemInterface::SOURCE_ID], SourceItemInterface::QUANTITY => $row[SourceItemInterface::QUANTITY], SourceItemInterface::STATUS => $row[SourceItemInterface::STATUS], diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php index 3ae4eeeabd9f2..d4c210c629a9e 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php @@ -10,6 +10,7 @@ /** * Represents amount of product on physical storage + * Entity id getter is missed because entity identifiers are sku and source id * * Used fully qualified namespaces in annotations for proper work of WebApi request parser * @@ -22,7 +23,6 @@ interface SourceItemInterface extends ExtensibleDataInterface */ const SKU = 'sku'; const SOURCE_ID = 'source_id'; - const SOURCE_ITEM_ID = 'source_item_id'; const QUANTITY = 'quantity'; const STATUS = 'status'; /**#@-*/ @@ -34,13 +34,6 @@ interface SourceItemInterface extends ExtensibleDataInterface const STATUS_IN_STOCK = 1; /**#@-*/ - /** - * Get source item id - * - * @return int - */ - public function getSourceItemId(); - /** * Get source item sku * diff --git a/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php index 6caeb674a47c1..640f5feeb722f 100644 --- a/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php @@ -5,40 +5,38 @@ */ namespace Magento\InventoryApi\Api; +use Magento\Framework\Api\SearchCriteriaInterface; +use Magento\InventoryApi\Api\Data\SourceItemInterface; + /** - * This is Facade for basic operations with Source Item - * The method save is absent, due to different semantic (save multiple) + * This is Facade for basic operations with SourceItem * + * The method save is absent, due to different semantic (save multiple) * @see SourceItemSaveInterface + * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface SourceItemRepositoryInterface { - /** - * Get Source Item data by given sourceItemId. If you want to create plugin on get method, also you need to create - * separate plugin on getList method, because entity loading way is different for these methods - * - * @param int $sourceItemId - * @throws \Magento\Framework\Exception\NoSuchEntityException - * @return \Magento\InventoryApi\Api\Data\SourceItemInterface - */ - public function get($sourceItemId); - /** * Load Source Item data collection by given search criteria * + * We need to have this method for direct work with Source Items because this object contains additional data like as qty, status + * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\InventoryApi\Api\Data\SourceItemSearchResultsInterface */ - public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria); + public function getList(SearchCriteriaInterface $searchCriteria); /** - * Delete Source Item data by given sourceItemId + * Delete Source Item data * - * @param int $sourceItemId + * @param SourceItemInterface $sourceItem + * @return void * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotDeleteException - * @return void */ - public function delete($sourceItemId); + public function delete(SourceItemInterface $sourceItem); } diff --git a/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php b/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php index 703a9cd778d6c..b58e758722796 100644 --- a/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php @@ -6,7 +6,7 @@ namespace Magento\InventoryApi\Api; /** - * Service method for source items multiple save + * Service method for source items save multiple * Performance efficient API, used for stock synchronization * * Used fully qualified namespaces in annotations for proper work of WebApi request parser @@ -16,7 +16,7 @@ interface SourceItemSaveInterface { /** - * Multiple Save Source item data + * Save Multiple Source item data * * @param \Magento\InventoryApi\Api\Data\SourceItemInterface[] $sourceItems * @return void diff --git a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php index 23b2c7d42a8d7..bebfe3624020d 100644 --- a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php @@ -36,15 +36,6 @@ public function save(StockInterface $stock); */ public function get($stockId); - /** - * Delte the Stock data by given stockId - * - * @param int $stockId - * @return void - * @throws \Magento\Framework\Exception\NoSuchEntityException | \Magento\Framework\Exception\CouldNotDeleteException - */ - public function deleteById($stockId); - /** * Load Stock data collection by given search criteria * @@ -52,4 +43,14 @@ public function deleteById($stockId); * @return \Magento\InventoryApi\Api\Data\StockSearchResultsInterface */ public function getList(SearchCriteriaInterface $searchCriteria = null); + + /** + * Delete the Stock data by given stockId + * + * @param int $stockId + * @return void + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\CouldNotDeleteException + */ + public function deleteById($stockId); } From eaad78c90f79c850c45d4fb67971d53139130092 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 18 Jul 2017 16:03:57 +0000 Subject: [PATCH 0309/1004] Update the CustomerScopeData changes to use serializer to fit with BiC rules - keep the $jsonEncoder injection but remove the type, - mark the constructor as PHPMD.UnusedFormalParameter, - split out the config and the serilization to happen in two methods, --- .../Customer/Block/CustomerScopeData.php | 52 +++++++----- .../Test/Unit/Block/CustomerScopeDataTest.php | 85 ++++++++++++++++++- 2 files changed, 114 insertions(+), 23 deletions(-) diff --git a/app/code/Magento/Customer/Block/CustomerScopeData.php b/app/code/Magento/Customer/Block/CustomerScopeData.php index 7b48b4eb2576e..f3a17aedc055a 100644 --- a/app/code/Magento/Customer/Block/CustomerScopeData.php +++ b/app/code/Magento/Customer/Block/CustomerScopeData.php @@ -26,17 +26,21 @@ class CustomerScopeData extends \Magento\Framework\View\Element\Template /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Serialize\Serializer\Json $serializer + * @param $jsonEncoder * @param array $data + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Serialize\Serializer\Json $serializer, - array $data = [] + $jsonEncoder, + array $data = [], + \Magento\Framework\Serialize\Serializer\Json $serializer = null ) { parent::__construct($context, $data); $this->storeManager = $context->getStoreManager(); - $this->serializer = $serializer; + $this->serializer = $serializer?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\Serializer\Json::class); } /** @@ -51,6 +55,28 @@ public function getWebsiteId() return (int)$this->_storeManager->getStore()->getWebsiteId(); } + /** + * @return array + */ + public function getInvalidationRules() + { + return [ + '*' => [ + 'Magento_Customer/js/invalidation-processor' => [ + 'invalidationRules' => [ + 'website-rule' => [ + 'Magento_Customer/js/invalidation-rules/website-rule' => [ + 'scopeConfig' => [ + 'websiteId' => $this->getWebsiteId(), + ] + ] + ] + ] + ] + ], + ]; + } + /** * Get the invalidation rules json encoded * @@ -59,22 +85,6 @@ public function getWebsiteId() */ public function getSerializedInvalidationRules() { - return $this->serializer->serialize( - [ - '*' => [ - 'Magento_Customer/js/invalidation-processor' => [ - 'invalidationRules' => [ - 'website-rule' => [ - 'Magento_Customer/js/invalidation-rules/website-rule' => [ - 'scopeConfig' => [ - 'websiteId' => $this->getWebsiteId(), - ] - ] - ] - ] - ] - ], - ] - ); + return $this->serializer->serialize($this->getInvalidationRules()); } } diff --git a/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php b/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php index af0f86a423b0b..529ee1a88abe1 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php @@ -54,8 +54,9 @@ protected function setUp() $this->model = new CustomerScopeData( $this->contextMock, - $this->serializerMock, - [] + null, + [], + $this->serializerMock ); } @@ -78,4 +79,84 @@ public function testGetWebsiteId() $this->assertEquals($storeId, $this->model->getWebsiteId()); } + + public function testGetInvalidationRules() + { + $storeId = 1; + + $storeMock = $this->getMockBuilder(StoreInterface::class) + ->setMethods(['getWebsiteId']) + ->getMockForAbstractClass(); + + $storeMock->expects($this->any()) + ->method('getWebsiteId') + ->willReturn($storeId); + + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->with(null) + ->willReturn($storeMock); + + $this->assertEquals( + [ + '*' => [ + 'Magento_Customer/js/invalidation-processor' => [ + 'invalidationRules' => [ + 'website-rule' => [ + 'Magento_Customer/js/invalidation-rules/website-rule' => [ + 'scopeConfig' => [ + 'websiteId' => 1, + ] + ] + ] + ] + ] + ], + ], + $this->model->getInvalidationRules() + ); + } + + public function testGetSerializedInvalidationRules() + { + $storeId = 1; + $rules = [ + '*' => [ + 'Magento_Customer/js/invalidation-processor' => [ + 'invalidationRules' => [ + 'website-rule' => [ + 'Magento_Customer/js/invalidation-rules/website-rule' => [ + 'scopeConfig' => [ + 'websiteId' => 1, + ] + ] + ] + ] + ] + ], + ]; + + $storeMock = $this->getMockBuilder(StoreInterface::class) + ->setMethods(['getWebsiteId']) + ->getMockForAbstractClass(); + + $storeMock->expects($this->any()) + ->method('getWebsiteId') + ->willReturn($storeId); + + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->with(null) + ->willReturn($storeMock); + + $this->serializerMock->expects($this->any()) + ->method('serialize') + ->with($rules) + ->willReturn(json_encode($rules)); + + $this->assertEquals( + json_encode($rules), + $this->model->getSerializedInvalidationRules() + ); + } } From 59341a063cf1e6be0f0600a87426131ab6490816 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Tue, 18 Jul 2017 13:37:43 -0500 Subject: [PATCH 0310/1004] MAGETWO-70797: Use backend model also for default config values #7742 - fixed integration tests --- .../testsuite/Magento/PageCache/Model/ConfigTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/ConfigTest.php index 846d2e7e9b5a8..b348922043236 100644 --- a/dev/tests/integration/testsuite/Magento/PageCache/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/PageCache/Model/ConfigTest.php @@ -63,7 +63,7 @@ protected function setUp() 'accessList' => explode(',', '127.0.0.1,192.168.0.1,127.0.0.2'), 'designExceptions' => json_decode('{"_":{"regexp":"\/firefox\/i","value":"Magento\/blank"}}', true), 'sslOffloadedHeader' => 'X-Forwarded-Proto', - 'gracePeriod' => null + 'gracePeriod' => 1234 ]; $vclGeneratorFactory->expects($this->any()) ->method('create') @@ -73,7 +73,7 @@ protected function setUp() 'example.com', '8080', explode(',', '127.0.0.1,192.168.0.1,127.0.0.2'), - null, + 1234, 'X-Forwarded-Proto', json_decode('{"_":{"regexp":"\/firefox\/i","value":"Magento\/blank"}}', true) ))); @@ -89,6 +89,7 @@ protected function setUp() /** * @magentoConfigFixture default/system/full_page_cache/varnish/backend_host example.com * @magentoConfigFixture default/system/full_page_cache/varnish/backend_port 8080 + * @magentoConfigFixture default/system/full_page_cache/varnish/grace_period 1234 * @magentoConfigFixture default/system/full_page_cache/varnish/access_list 127.0.0.1,192.168.0.1,127.0.0.2 * @magentoConfigFixture current_store design/theme/ua_regexp {"_":{"regexp":"\/firefox\/i","value":"Magento\/blank"}} * @magentoAppIsolation enabled From 5568b8dc25ba989f64fca41d073a3dfe831dd3d0 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 18 Jul 2017 19:11:40 +0000 Subject: [PATCH 0311/1004] Add back in the type for the $jsonEncoder object injected into CustomerScopeData --- app/code/Magento/Customer/Block/CustomerScopeData.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Block/CustomerScopeData.php b/app/code/Magento/Customer/Block/CustomerScopeData.php index f3a17aedc055a..397e830619895 100644 --- a/app/code/Magento/Customer/Block/CustomerScopeData.php +++ b/app/code/Magento/Customer/Block/CustomerScopeData.php @@ -25,15 +25,16 @@ class CustomerScopeData extends \Magento\Framework\View\Element\Template private $serializer; /** + * CustomerScopeData constructor. * @param \Magento\Framework\View\Element\Template\Context $context - * @param $jsonEncoder + * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param array $data * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer - * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @throws \RuntimeException */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - $jsonEncoder, + \Magento\Framework\Json\EncoderInterface $jsonEncoder, array $data = [], \Magento\Framework\Serialize\Serializer\Json $serializer = null ) { From 2d914ec4d0306684101df258c24b747dd23b78e5 Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Tue, 18 Jul 2017 10:54:32 +0200 Subject: [PATCH 0312/1004] Added translations for the notice attribute --- .../Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php index d50cb1cddbf27..8a6a861ddb8bf 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php @@ -555,7 +555,7 @@ public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupC 'formElement' => $this->getFormElementsMapValue($attribute->getFrontendInput()), 'visible' => $attribute->getIsVisible(), 'required' => $attribute->getIsRequired(), - 'notice' => $attribute->getNote(), + 'notice' => __($attribute->getNote()), 'default' => (!$this->isProductExists()) ? $attribute->getDefaultValue() : null, 'label' => $attribute->getDefaultFrontendLabel(), 'code' => $attribute->getAttributeCode(), From 82a51241064397ae5f2b573970bedb0669dedd9a Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Tue, 18 Jul 2017 12:37:32 +0200 Subject: [PATCH 0313/1004] Fixed the relevant test, keep null when applicable --- .../Product/Form/Modifier/EavTest.php | 32 ++++++++++++++++++- .../Product/Form/Modifier/Eav.php | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php index 08ef29ac2ab15..ead88819e016e 100755 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php @@ -10,6 +10,7 @@ use Magento\Eav\Model\Config; use Magento\Framework\App\RequestInterface; use Magento\Framework\EntityManager\EventManager; +use Magento\Framework\Phrase; use Magento\Store\Model\StoreManagerInterface; use Magento\Store\Api\Data\StoreInterface; use Magento\Ui\DataProvider\EavValidationRules; @@ -452,12 +453,13 @@ public function testModifyData() * @param int $productId * @param bool $productRequired * @param string $attrValue + * @param string $note * @param array $expected * @covers \Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav::isProductExists * @covers \Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav::setupAttributeMeta * @dataProvider setupAttributeMetaDataProvider */ - public function testSetupAttributeMetaDefaultAttribute($productId, $productRequired, $attrValue, $expected) + public function testSetupAttributeMetaDefaultAttribute($productId, $productRequired, $attrValue, $note, $expected) { $configPath = 'arguments/data/config'; $groupCode = 'product-details'; @@ -483,6 +485,10 @@ public function testSetupAttributeMetaDefaultAttribute($productId, $productRequi ->method('getValue') ->willReturn('value'); + $this->productAttributeMock->expects($this->any()) + ->method('getNote') + ->willReturn($note); + $attributeMock = $this->getMockBuilder(AttributeInterface::class) ->disableOriginalConstructor() ->getMock(); @@ -531,6 +537,7 @@ public function setupAttributeMetaDataProvider() 'productId' => 1, 'productRequired' => true, 'attrValue' => 'val', + 'note' => null, 'expected' => [ 'dataType' => null, 'formElement' => null, @@ -550,6 +557,7 @@ public function setupAttributeMetaDataProvider() 'productId' => 1, 'productRequired' => false, 'attrValue' => 'val', + 'note' => null, 'expected' => [ 'dataType' => null, 'formElement' => null, @@ -569,6 +577,7 @@ public function setupAttributeMetaDataProvider() 'productId' => null, 'productRequired' => false, 'attrValue' => null, + 'note' => null, 'expected' => [ 'dataType' => null, 'formElement' => null, @@ -588,6 +597,7 @@ public function setupAttributeMetaDataProvider() 'productId' => null, 'productRequired' => false, 'attrValue' => null, + 'note' => null, 'expected' => [ 'dataType' => null, 'formElement' => null, @@ -602,6 +612,26 @@ public function setupAttributeMetaDataProvider() 'globalScope' => false, 'sortOrder' => 0 ], + ], + 'default_null_prod_new_and_required_and_filled_notice' => [ + 'productId' => null, + 'productRequired' => false, + 'attrValue' => null, + 'note' => 'example notice', + 'expected' => [ + 'dataType' => null, + 'formElement' => null, + 'visible' => null, + 'required' => false, + 'notice' => __('example notice'), + 'default' => 'required_value', + 'label' => null, + 'code' => 'code', + 'source' => 'product-details', + 'scopeLabel' => '', + 'globalScope' => false, + 'sortOrder' => 0 + ], ] ]; } diff --git a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php index 8a6a861ddb8bf..4579272ed26e7 100755 --- a/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php +++ b/app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php @@ -555,7 +555,7 @@ public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupC 'formElement' => $this->getFormElementsMapValue($attribute->getFrontendInput()), 'visible' => $attribute->getIsVisible(), 'required' => $attribute->getIsRequired(), - 'notice' => __($attribute->getNote()), + 'notice' => $attribute->getNote() === null ? null : __($attribute->getNote()), 'default' => (!$this->isProductExists()) ? $attribute->getDefaultValue() : null, 'label' => $attribute->getDefaultFrontendLabel(), 'code' => $attribute->getAttributeCode(), From e7a32ec4c1101c284fe45d16f9a6a361c9618346 Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Tue, 18 Jul 2017 16:08:53 +0200 Subject: [PATCH 0314/1004] Refactored code to fix the coding style error --- .../Product/Form/Modifier/EavTest.php | 237 ++++++++++-------- 1 file changed, 139 insertions(+), 98 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php index ead88819e016e..34b837e2791c5 100755 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php @@ -533,106 +533,147 @@ public function testSetupAttributeMetaDefaultAttribute($productId, $productRequi public function setupAttributeMetaDataProvider() { return [ - 'default_null_prod_not_new_and_required' => [ - 'productId' => 1, - 'productRequired' => true, - 'attrValue' => 'val', - 'note' => null, - 'expected' => [ - 'dataType' => null, - 'formElement' => null, - 'visible' => null, - 'required' => true, - 'notice' => null, - 'default' => null, - 'label' => null, - 'code' => 'code', - 'source' => 'product-details', - 'scopeLabel' => '', - 'globalScope' => false, - 'sortOrder' => 0 - ], - ], - 'default_null_prod_not_new_and_not_required' => [ - 'productId' => 1, - 'productRequired' => false, - 'attrValue' => 'val', - 'note' => null, - 'expected' => [ - 'dataType' => null, - 'formElement' => null, - 'visible' => null, - 'required' => false, - 'notice' => null, - 'default' => null, - 'label' => null, - 'code' => 'code', - 'source' => 'product-details', - 'scopeLabel' => '', - 'globalScope' => false, - 'sortOrder' => 0 - ], - ], - 'default_null_prod_new_and_not_required' => [ - 'productId' => null, - 'productRequired' => false, - 'attrValue' => null, - 'note' => null, - 'expected' => [ - 'dataType' => null, - 'formElement' => null, - 'visible' => null, - 'required' => false, - 'notice' => null, - 'default' => 'required_value', - 'label' => null, - 'code' => 'code', - 'source' => 'product-details', - 'scopeLabel' => '', - 'globalScope' => false, - 'sortOrder' => 0 - ], + 'default_null_prod_not_new_and_required' => $this->defaultNullProdNotNewAndRequired(), + 'default_null_prod_not_new_and_not_required' => $this->defaultNullProdNotNewAndNotRequired(), + 'default_null_prod_new_and_not_required' => $this->defaultNullProdNewAndNotRequired(), + 'default_null_prod_new_and_required' => $this->defaultNullProdNewAndRequired(), + 'default_null_prod_new_and_required_and_filled_notice' => $this->defaultNullProdNewAndRequiredAndFilledNotice( + ) + ]; + } + + /** + * @return array + */ + private function defaultNullProdNotNewAndRequired() + { + return [ + 'productId' => 1, + 'productRequired' => true, + 'attrValue' => 'val', + 'note' => null, + 'expected' => [ + 'dataType' => null, + 'formElement' => null, + 'visible' => null, + 'required' => true, + 'notice' => null, + 'default' => null, + 'label' => null, + 'code' => 'code', + 'source' => 'product-details', + 'scopeLabel' => '', + 'globalScope' => false, + 'sortOrder' => 0 ], - 'default_null_prod_new_and_required' => [ - 'productId' => null, - 'productRequired' => false, - 'attrValue' => null, - 'note' => null, - 'expected' => [ - 'dataType' => null, - 'formElement' => null, - 'visible' => null, - 'required' => false, - 'notice' => null, - 'default' => 'required_value', - 'label' => null, - 'code' => 'code', - 'source' => 'product-details', - 'scopeLabel' => '', - 'globalScope' => false, - 'sortOrder' => 0 - ], + ]; + } + + /** + * @return array + */ + private function defaultNullProdNotNewAndNotRequired() + { + return [ + 'productId' => 1, + 'productRequired' => false, + 'attrValue' => 'val', + 'note' => null, + 'expected' => [ + 'dataType' => null, + 'formElement' => null, + 'visible' => null, + 'required' => false, + 'notice' => null, + 'default' => null, + 'label' => null, + 'code' => 'code', + 'source' => 'product-details', + 'scopeLabel' => '', + 'globalScope' => false, + 'sortOrder' => 0 + ], + ]; + } + + /** + * @return array + */ + private function defaultNullProdNewAndNotRequired() + { + return [ + 'productId' => null, + 'productRequired' => false, + 'attrValue' => null, + 'note' => null, + 'expected' => [ + 'dataType' => null, + 'formElement' => null, + 'visible' => null, + 'required' => false, + 'notice' => null, + 'default' => 'required_value', + 'label' => null, + 'code' => 'code', + 'source' => 'product-details', + 'scopeLabel' => '', + 'globalScope' => false, + 'sortOrder' => 0 + ], + ]; + } + + /** + * @return array + */ + private function defaultNullProdNewAndRequired() + { + return [ + 'productId' => null, + 'productRequired' => false, + 'attrValue' => null, + 'note' => null, + 'expected' => [ + 'dataType' => null, + 'formElement' => null, + 'visible' => null, + 'required' => false, + 'notice' => null, + 'default' => 'required_value', + 'label' => null, + 'code' => 'code', + 'source' => 'product-details', + 'scopeLabel' => '', + 'globalScope' => false, + 'sortOrder' => 0 + ], + ]; + } + + /** + * @return array + */ + private function defaultNullProdNewAndRequiredAndFilledNotice() + { + return [ + 'productId' => null, + 'productRequired' => false, + 'attrValue' => null, + 'note' => 'example notice', + 'expected' => [ + 'dataType' => null, + 'formElement' => null, + 'visible' => null, + 'required' => false, + 'notice' => __('example notice'), + 'default' => 'required_value', + 'label' => null, + 'code' => 'code', + 'source' => 'product-details', + 'scopeLabel' => '', + 'globalScope' => false, + 'sortOrder' => 0 ], - 'default_null_prod_new_and_required_and_filled_notice' => [ - 'productId' => null, - 'productRequired' => false, - 'attrValue' => null, - 'note' => 'example notice', - 'expected' => [ - 'dataType' => null, - 'formElement' => null, - 'visible' => null, - 'required' => false, - 'notice' => __('example notice'), - 'default' => 'required_value', - 'label' => null, - 'code' => 'code', - 'source' => 'product-details', - 'scopeLabel' => '', - 'globalScope' => false, - 'sortOrder' => 0 - ], - ] ]; } } From b4423f82fc08e8a15396204dc12dea9808350115 Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Tue, 18 Jul 2017 19:44:21 +0200 Subject: [PATCH 0315/1004] Reduced the length of the line to comply with the coding standards --- .../Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php index 34b837e2791c5..d5a007382b383 100755 --- a/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php @@ -537,8 +537,8 @@ public function setupAttributeMetaDataProvider() 'default_null_prod_not_new_and_not_required' => $this->defaultNullProdNotNewAndNotRequired(), 'default_null_prod_new_and_not_required' => $this->defaultNullProdNewAndNotRequired(), 'default_null_prod_new_and_required' => $this->defaultNullProdNewAndRequired(), - 'default_null_prod_new_and_required_and_filled_notice' => $this->defaultNullProdNewAndRequiredAndFilledNotice( - ) + 'default_null_prod_new_and_required_and_filled_notice' => + $this->defaultNullProdNewAndRequiredAndFilledNotice() ]; } From 31764a5c64bf9c81fcb32d98d5ac5ef8cab6a8d6 Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 19 Jul 2017 07:05:58 +0000 Subject: [PATCH 0316/1004] Add back in the mock of the jsonEncoder to the test case --- app/code/Magento/Customer/Block/CustomerScopeData.php | 2 +- .../Customer/Test/Unit/Block/CustomerScopeDataTest.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Customer/Block/CustomerScopeData.php b/app/code/Magento/Customer/Block/CustomerScopeData.php index 397e830619895..6ba08c6f59b75 100644 --- a/app/code/Magento/Customer/Block/CustomerScopeData.php +++ b/app/code/Magento/Customer/Block/CustomerScopeData.php @@ -25,12 +25,12 @@ class CustomerScopeData extends \Magento\Framework\View\Element\Template private $serializer; /** - * CustomerScopeData constructor. * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param array $data * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer * @throws \RuntimeException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, diff --git a/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php b/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php index 529ee1a88abe1..1f6976a7f3338 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php @@ -10,7 +10,6 @@ use Magento\Store\Api\Data\StoreInterface; use Magento\Store\Model\StoreManagerInterface; use Magento\Customer\Block\CustomerScopeData; -use Magento\Framework\Json\EncoderInterface; class CustomerScopeDataTest extends \PHPUnit_Framework_TestCase { @@ -26,6 +25,9 @@ class CustomerScopeDataTest extends \PHPUnit_Framework_TestCase /** @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ private $scopeConfigMock; + /** @var \Magento\Framework\Json\EncoderInterface|\PHPUnit_Framework_MockObject_MockObject */ + private $encoderMock; + /** @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject */ private $serializerMock; @@ -41,6 +43,9 @@ protected function setUp() $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class) ->getMock(); + $this->encoderMock = $this->getMockBuilder(\Magento\Framework\Json\EncoderInterface::class) + ->getMock(); + $this->serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class) ->getMock(); @@ -54,7 +59,7 @@ protected function setUp() $this->model = new CustomerScopeData( $this->contextMock, - null, + $this->encoderMock, [], $this->serializerMock ); From 95223195117488bfbbec386159a204f8e8f226ee Mon Sep 17 00:00:00 2001 From: Ward Cappelle Date: Wed, 19 Jul 2017 12:56:14 +0200 Subject: [PATCH 0317/1004] MAGETWO-59282: Correct catalog massstatus update unit test. --- .../Test/Unit/Controller/Adminhtml/Product/MassStatusTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/MassStatusTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/MassStatusTest.php index d41de5f67503c..359e43070ba72 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/MassStatusTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/MassStatusTest.php @@ -123,7 +123,7 @@ protected function setUp() public function testMassStatusAction() { - $storeId = 1; + $storeId = 2; $status = \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED; $filters = [ 'store_id' => 2, @@ -138,7 +138,7 @@ public function testMassStatusAction() $this->request->expects($this->exactly(3)) ->method('getParam') ->willReturnMap([ - ['store', 0, $storeId], + ['store', null, $storeId], ['status', null, $status], ['filters', [], $filters] ]); From 5b7fed8b5c5e7727b5ba142ab58637bc914d5783 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 19 Jul 2017 11:41:50 -0500 Subject: [PATCH 0318/1004] MAGETWO-70840: more safe includes on application start #3129 - updated glob list to use the path relative to project root - fixed tests --- app/etc/registration_globlist.php | 19 ++++++++++++------- app/registration.php | 18 ++++-------------- .../App/Test/Unit/_files/test.composer.json | 2 +- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/app/etc/registration_globlist.php b/app/etc/registration_globlist.php index 57aec1e391a4a..bd4a26d332239 100644 --- a/app/etc/registration_globlist.php +++ b/app/etc/registration_globlist.php @@ -1,13 +1,18 @@ Date: Wed, 19 Jul 2017 13:16:04 -0500 Subject: [PATCH 0319/1004] MAGETWO-70775: Remove zend json from customer data #10259 - moved component configuration to the template file --- .../Customer/Block/CustomerScopeData.php | 41 ++++---------- .../Test/Unit/Block/CustomerScopeDataTest.php | 55 +------------------ .../js/customer-data/invalidation-rules.phtml | 18 ++++-- 3 files changed, 26 insertions(+), 88 deletions(-) diff --git a/app/code/Magento/Customer/Block/CustomerScopeData.php b/app/code/Magento/Customer/Block/CustomerScopeData.php index 6ba08c6f59b75..bc9ba8f3619af 100644 --- a/app/code/Magento/Customer/Block/CustomerScopeData.php +++ b/app/code/Magento/Customer/Block/CustomerScopeData.php @@ -5,6 +5,9 @@ */ namespace Magento\Customer\Block; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Serialize\Serializer\Json; + /** * Class CustomerScopeData provide scope (website, store or store_group) information on front * Can be used, for example, on store front, in order to determine @@ -20,7 +23,7 @@ class CustomerScopeData extends \Magento\Framework\View\Element\Template private $storeManager; /** - * @var \Magento\Framework\Serialize\Serializer\Json + * @var Json */ private $serializer; @@ -28,7 +31,7 @@ class CustomerScopeData extends \Magento\Framework\View\Element\Template * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param array $data - * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer + * @param Json|null $serializer * @throws \RuntimeException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -36,12 +39,11 @@ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, array $data = [], - \Magento\Framework\Serialize\Serializer\Json $serializer = null + Json $serializer = null ) { parent::__construct($context, $data); $this->storeManager = $context->getStoreManager(); - $this->serializer = $serializer?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Serialize\Serializer\Json::class); + $this->serializer = $serializer?: ObjectManager::getInstance()->get(Json::class); } /** @@ -57,35 +59,14 @@ public function getWebsiteId() } /** - * @return array - */ - public function getInvalidationRules() - { - return [ - '*' => [ - 'Magento_Customer/js/invalidation-processor' => [ - 'invalidationRules' => [ - 'website-rule' => [ - 'Magento_Customer/js/invalidation-rules/website-rule' => [ - 'scopeConfig' => [ - 'websiteId' => $this->getWebsiteId(), - ] - ] - ] - ] - ] - ], - ]; - } - - /** - * Get the invalidation rules json encoded + * Encode invalidation rules. * + * @param array $configuration * @return bool|string * @throws \InvalidArgumentException */ - public function getSerializedInvalidationRules() + public function encodeConfiguration(array $configuration) { - return $this->serializer->serialize($this->getInvalidationRules()); + return $this->serializer->serialize($configuration); } } diff --git a/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php b/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php index 1f6976a7f3338..acfaf826f9949 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/CustomerScopeDataTest.php @@ -85,46 +85,8 @@ public function testGetWebsiteId() $this->assertEquals($storeId, $this->model->getWebsiteId()); } - public function testGetInvalidationRules() + public function testEncodeConfiguration() { - $storeId = 1; - - $storeMock = $this->getMockBuilder(StoreInterface::class) - ->setMethods(['getWebsiteId']) - ->getMockForAbstractClass(); - - $storeMock->expects($this->any()) - ->method('getWebsiteId') - ->willReturn($storeId); - - $this->storeManagerMock->expects($this->any()) - ->method('getStore') - ->with(null) - ->willReturn($storeMock); - - $this->assertEquals( - [ - '*' => [ - 'Magento_Customer/js/invalidation-processor' => [ - 'invalidationRules' => [ - 'website-rule' => [ - 'Magento_Customer/js/invalidation-rules/website-rule' => [ - 'scopeConfig' => [ - 'websiteId' => 1, - ] - ] - ] - ] - ] - ], - ], - $this->model->getInvalidationRules() - ); - } - - public function testGetSerializedInvalidationRules() - { - $storeId = 1; $rules = [ '*' => [ 'Magento_Customer/js/invalidation-processor' => [ @@ -141,19 +103,6 @@ public function testGetSerializedInvalidationRules() ], ]; - $storeMock = $this->getMockBuilder(StoreInterface::class) - ->setMethods(['getWebsiteId']) - ->getMockForAbstractClass(); - - $storeMock->expects($this->any()) - ->method('getWebsiteId') - ->willReturn($storeId); - - $this->storeManagerMock->expects($this->any()) - ->method('getStore') - ->with(null) - ->willReturn($storeMock); - $this->serializerMock->expects($this->any()) ->method('serialize') ->with($rules) @@ -161,7 +110,7 @@ public function testGetSerializedInvalidationRules() $this->assertEquals( json_encode($rules), - $this->model->getSerializedInvalidationRules() + $this->model->encodeConfiguration($rules) ); } } diff --git a/app/code/Magento/Customer/view/frontend/templates/js/customer-data/invalidation-rules.phtml b/app/code/Magento/Customer/view/frontend/templates/js/customer-data/invalidation-rules.phtml index ad8aab76e483f..f8e9c3bdcf1d7 100644 --- a/app/code/Magento/Customer/view/frontend/templates/js/customer-data/invalidation-rules.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/js/customer-data/invalidation-rules.phtml @@ -5,13 +5,21 @@ */ // @codingStandardsIgnoreFile -?> - From 9867aca84303a5706cbf781c0a0b0d4a16b91d32 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Mon, 17 Jul 2017 20:18:08 +0100 Subject: [PATCH 0320/1004] magento/magento2#10045 Sitemap add item refactoring Add injectable item resolver to load sitemap items --- .../Model/CategorySitemapItemResolver.php | 109 +++++++++++ .../Model/CmsPageSitemapItemResolver.php | 113 ++++++++++++ .../Model/CompositeSitemapItemResolver.php | 44 +++++ .../Model/ProductSitemapItemResolver.php | 108 +++++++++++ app/code/Magento/Sitemap/Model/Sitemap.php | 108 ++++------- .../Magento/Sitemap/Model/SitemapItem.php | 93 ++++++++++ .../Sitemap/Model/SitemapItemInterface.php | 50 +++++ .../Model/SitemapItemResolverInterface.php | 22 +++ .../Model/CategorySitemapItemResolverTest.php | 152 +++++++++++++++ .../Model/CmsPageSitemapItemResolverTest.php | 152 +++++++++++++++ .../CompositeSitemapItemResolverTest.php | 69 +++++++ .../Model/ProductSitemapItemResolverTest.php | 174 ++++++++++++++++++ .../Sitemap/Test/Unit/Model/SitemapTest.php | 15 +- app/code/Magento/Sitemap/etc/di.xml | 11 ++ 14 files changed, 1145 insertions(+), 75 deletions(-) create mode 100644 app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php create mode 100644 app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php create mode 100644 app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php create mode 100644 app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php create mode 100644 app/code/Magento/Sitemap/Model/SitemapItem.php create mode 100644 app/code/Magento/Sitemap/Model/SitemapItemInterface.php create mode 100644 app/code/Magento/Sitemap/Model/SitemapItemResolverInterface.php create mode 100644 app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php create mode 100644 app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php create mode 100644 app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php create mode 100644 app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php diff --git a/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php b/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php new file mode 100644 index 0000000000000..77dd3f746eef1 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php @@ -0,0 +1,109 @@ +categoryFactory = $categoryFactory; + $this->itemFactory = $itemFactory; + $this->scopeConfig = $scopeConfig; + } + + /** + * {@inheritdoc} + */ + public function getItems($storeId) + { + $collection = $this->categoryFactory->create()->getCollection($storeId); + $items = array_map(function($item) use ($storeId) { + return $this->itemFactory->create([ + 'url' => $item->getUrl(), + 'updatedAt' => $item->getUpdatedAt(), + 'images' => $item->getImages(), + 'priority' => $this->getCategoryPriority($storeId), + 'changeFrequency' => $this->getCategoryChangeFrequency($storeId), + ]); + }, $collection); + + return $items; + } + + /** + * Get page priority + * + * @param int $storeId + * @return string + */ + private function getCategoryPriority($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_CATEGORY_PRIORITY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * Get page change frequency + * + * @param int $storeId + * @return string + */ + private function getCategoryChangeFrequency($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_CATEGORY_CHANGEFREQ, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php new file mode 100644 index 0000000000000..196d13a8cf251 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php @@ -0,0 +1,113 @@ +scopeConfig = $scopeConfig; + $this->cmsPageFactory = $cmsPageFactory; + $this->itemFactory = $itemFactory; + } + + /** + * {@inheritdoc} + */ + public function getItems($storeId) + { + $collection = $this->cmsPageFactory->create()->getCollection($storeId); + var_dump($collection); + $items = array_map(function($item) use ($storeId) { + return $this->itemFactory->create([ + 'url' => $item->getUrl(), + 'updatedAt' => $item->getUpdatedAt(), + 'images' => $item->getImages(), + 'priority' => $this->getPagePriority($storeId), + 'changeFrequency' => $this->getPageChangeFrequency($storeId), + ]); + }, $collection); + + var_dump($items); + + return $items; + } + + /** + * Get page priority + * + * @param int $storeId + * @return string + */ + private function getPagePriority($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_PAGE_PRIORITY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * Get page change frequency + * + * @param int $storeId + * @return string + */ + private function getPageChangeFrequency($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_PAGE_CHANGEFREQ, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php new file mode 100644 index 0000000000000..f6f00be2c763c --- /dev/null +++ b/app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php @@ -0,0 +1,44 @@ +itemResolvers = $itemResolvers; + } + + /** + * {@inheritdoc} + */ + public function getItems($storeId) + { + $items = []; + + foreach ($this->itemResolvers as $resolver) { + foreach ($resolver->getItems($storeId) as $item) { + $items[] = $item; + } + } + + return $items; + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php new file mode 100644 index 0000000000000..5e321b8a9557e --- /dev/null +++ b/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php @@ -0,0 +1,108 @@ +scopeConfig = $scopeConfig; + $this->productFactory = $productFactory; + $this->itemFactory = $itemFactory; + } + + /** + * {@inheritdoc} + */ + public function getItems($storeId) + { + $collection = $this->productFactory->create()->getCollection($storeId); + $items = array_map(function($item) use ($storeId) { + return $this->itemFactory->create([ + 'url' => $item->getUrl(), + 'updatedAt' => $item->getUpdatedAt(), + 'images' => $item->getImages(), + 'priority' => $this->getProductPriority($storeId), + 'changeFrequency' => $this->getProductChangeFrequency($storeId), + ]); + }, $collection); + + return $items; + } + + /** + * Get page priority + * + * @param int $storeId + * @return string + */ + private function getProductPriority($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_PRODUCT_PRIORITY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * Get page change frequency + * + * @param int $storeId + * @return string + */ + private function getProductChangeFrequency($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_PRODUCT_CHANGEFREQ, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index ef8363cbcf2ff..cd1c8dc9fbf06 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -11,7 +11,6 @@ use Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot; use Magento\Framework\App\ObjectManager; use Magento\Robots\Model\Config\Value; -use Magento\Framework\DataObject; /** * Sitemap model @@ -157,6 +156,13 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento */ protected $_cacheTag = true; + /** + * Item resolver + * + * @var SitemapItemResolverInterface + */ + private $itemResolver; + /** * Initialize dependencies. * @@ -176,6 +182,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection * @param array $data * @param DocumentRoot|null $documentRoot + * @param SitemapItemResolverInterface|null $itemResolver * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -194,7 +201,8 @@ public function __construct( \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [], - \Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot $documentRoot = null + \Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot $documentRoot = null, + SitemapItemResolverInterface $itemResolver = null ) { $this->_escaper = $escaper; $this->_sitemapData = $sitemapData; @@ -207,6 +215,7 @@ public function __construct( $this->_storeManager = $storeManager; $this->_request = $request; $this->dateTime = $dateTime; + $this->itemResolver = $itemResolver ?: ObjectManager::getInstance()->get(SitemapItemResolverInterface::class); parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -236,55 +245,6 @@ protected function _getStream() } } - /** - * Add a sitemap item to the array of sitemap items - * - * @param DataObject $sitemapItem - * @return $this - */ - public function addSitemapItem(DataObject $sitemapItem) - { - $this->_sitemapItems[] = $sitemapItem; - - return $this; - } - - /** - * Collect all sitemap items - * - * @return void - */ - public function collectSitemapItems() - { - /** @var $helper \Magento\Sitemap\Helper\Data */ - $helper = $this->_sitemapData; - $storeId = $this->getStoreId(); - - $this->addSitemapItem(new DataObject( - [ - 'changefreq' => $helper->getCategoryChangefreq($storeId), - 'priority' => $helper->getCategoryPriority($storeId), - 'collection' => $this->_categoryFactory->create()->getCollection($storeId), - ] - )); - - $this->addSitemapItem(new DataObject( - [ - 'changefreq' => $helper->getProductChangefreq($storeId), - 'priority' => $helper->getProductPriority($storeId), - 'collection' => $this->_productFactory->create()->getCollection($storeId), - ] - )); - - $this->addSitemapItem(new DataObject( - [ - 'changefreq' => $helper->getPageChangefreq($storeId), - 'priority' => $helper->getPagePriority($storeId), - 'collection' => $this->_cmsFactory->create()->getCollection($storeId), - ] - )); - } - /** * Initialize sitemap * @@ -292,7 +252,7 @@ public function collectSitemapItems() */ protected function _initSitemapItems() { - $this->collectSitemapItems(); + $this->_sitemapItems = $this->itemResolver->getItems($this->getStoreId()); $this->_tags = [ self::TYPE_INDEX => [ @@ -377,30 +337,30 @@ public function generateXml() { $this->_initSitemapItems(); - /** @var $sitemapItem \Magento\Framework\DataObject */ - foreach ($this->_sitemapItems as $sitemapItem) { - $changefreq = $sitemapItem->getChangefreq(); - $priority = $sitemapItem->getPriority(); - foreach ($sitemapItem->getCollection() as $item) { - $xml = $this->_getSitemapRow( - $item->getUrl(), - $item->getUpdatedAt(), - $changefreq, - $priority, - $item->getImages() - ); - if ($this->_isSplitRequired($xml) && $this->_sitemapIncrement > 0) { - $this->_finalizeSitemap(); - } - if (!$this->_fileSize) { - $this->_createSitemap(); - } - $this->_writeSitemapRow($xml); - // Increase counters - $this->_lineCount++; - $this->_fileSize += strlen($xml); + /** @var $item SitemapItemInterface */ + foreach ($this->_sitemapItems as $item) { + $xml = $this->_getSitemapRow( + $item->getUrl(), + $item->getUpdatedAt(), + $item->getChangeFrequency(), + $item->getPriority(), + $item->getImages() + ); + + if ($this->_isSplitRequired($xml) && $this->_sitemapIncrement > 0) { + $this->_finalizeSitemap(); + } + + if (!$this->_fileSize) { + $this->_createSitemap(); } + + $this->_writeSitemapRow($xml); + // Increase counters + $this->_lineCount++; + $this->_fileSize += strlen($xml); } + $this->_finalizeSitemap(); if ($this->_sitemapIncrement == 1) { diff --git a/app/code/Magento/Sitemap/Model/SitemapItem.php b/app/code/Magento/Sitemap/Model/SitemapItem.php new file mode 100644 index 0000000000000..4a6c4d8fd9e16 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/SitemapItem.php @@ -0,0 +1,93 @@ +url = $url; + $this->priority = $priority; + $this->changeFrequency = $changeFrequency; + $this->updatedAt = $updatedAt; + $this->images = $images; + } + + /** + * {@inheritdoc} + */ + public function getUrl() + { + return $this->url; + } + + /** + * {@inheritdoc} + */ + public function getPriority() + { + return $this->priority; + } + + /** + * {@inheritdoc} + */ + public function getChangeFrequency() + { + return $this->changeFrequency; + } + + /** + * {@inheritdoc} + */ + public function getImages() + { + return $this->images; + } + + /** + * {@inheritdoc} + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Model/SitemapItemInterface.php b/app/code/Magento/Sitemap/Model/SitemapItemInterface.php new file mode 100644 index 0000000000000..5c87f1805afa2 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/SitemapItemInterface.php @@ -0,0 +1,50 @@ +getStoreConfigMock([ + CategorySitemapItemResolver::XML_PATH_CATEGORY_CHANGEFREQ => 'daily', + CategorySitemapItemResolver::XML_PATH_CATEGORY_PRIORITY => '1.0', + ]); + + $categoryMock = $this->getCategoryCollectionMock([]); + $cmsPageFactoryMock = $this->getCategoryFactoryMock($categoryMock); + $itemFactoryMock = $this->getItemFactoryMock(); + + $resolver = new CategorySitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + self::assertSame([], $resolver->getItems(1)); + } + + /** + * @dataProvider categoryProvider + * @param array $categories + */ + public function testGetItems(array $categories) + { + $storeConfigMock = $this->getStoreConfigMock([ + CategorySitemapItemResolver::XML_PATH_CATEGORY_CHANGEFREQ => 'daily', + CategorySitemapItemResolver::XML_PATH_CATEGORY_PRIORITY => '1.0', + ]); + + $categoryMock = $this->getCategoryCollectionMock($categories); + + $cmsPageFactoryMock = $this->getCategoryFactoryMock($categoryMock); + $itemFactoryMock = $this->getItemFactoryMock(); + + $resolver = new CategorySitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + $items = $resolver->getItems(1); + self::assertTrue(count($items) == count($categories)); + foreach($categories as $index => $category) { + self::assertSame($category->getUpdatedAt(), $items[$index]->getUpdatedAt()); + self::assertSame('daily', $items[$index]->getChangeFrequency()); + self::assertSame('1.0', $items[$index]->getPriority()); + self::assertSame($category->getImages(), $items[$index]->getImages()); + self::assertSame($category->getUrl(), $items[$index]->getUrl()); + } + } + + /** + * @return array + */ + public function categoryProvider() + { + return [ + [ + [ + new \Magento\Framework\DataObject( + ['url' => 'category.html', 'updated_at' => '2012-12-21 00:00:00'] + ), + new \Magento\Framework\DataObject( + ['url' => '/category/sub-category.html', 'updated_at' => '2012-12-21 00:00:00'] + ), + ] + ] + ]; + } + + /** + * @param $returnValue + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getCategoryFactoryMock($returnValue) + { + $cmsPageFactoryMock = $this->getMockBuilder(CategoryFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + + $cmsPageFactoryMock->expects(self::any()) + ->method('create') + ->willReturn($returnValue); + + return $cmsPageFactoryMock; + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getItemFactoryMock() + { + $itemFactoryMock = $this->getMockBuilder(SitemapItemInterfaceFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + + $itemFactoryMock->expects(self::any()) + ->method('create') + ->willReturnCallback(function ($data) { + $helper = new ObjectManager($this); + + return $helper->getObject(SitemapItem::class, $data); + }); + + return $itemFactoryMock; + } + + /** + * @param array $pathMap + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getStoreConfigMock(array $pathMap = []) + { + $scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); + $scopeConfigMock->method('getValue') + ->willReturnCallback(function ($path) use ($pathMap) { + return isset($pathMap[$path]) ? $pathMap[$path] : null; + }); + + return $scopeConfigMock; + } + + /** + * @param $returnValue + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getCategoryCollectionMock($returnValue) + { + $sitemapCmsPageMock = $this->getMockBuilder(Category::class) + ->setMethods(['getCollection']) + ->disableOriginalConstructor() + ->getMock(); + + $sitemapCmsPageMock->expects(self::any()) + ->method('getCollection') + ->willReturn($returnValue); + + return $sitemapCmsPageMock; + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php new file mode 100644 index 0000000000000..9bc313120fc04 --- /dev/null +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php @@ -0,0 +1,152 @@ +getStoreConfigMock([ + CmsPageSitemapItemResolver::XML_PATH_PAGE_CHANGEFREQ => 'daily', + CmsPageSitemapItemResolver::XML_PATH_PAGE_PRIORITY => '1.0', + ]); + + $cmsPageCollectionMock = $this->getCmsPageCollectionMock([]); + $cmsPageFactoryMock = $this->getCmsPageFactoryMock($cmsPageCollectionMock); + $itemFactoryMock = $this->getItemFactoryMock(); + + $resolver = new CmsPageSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + self::assertSame([], $resolver->getItems(1)); + } + + /** + * @dataProvider pageProvider + * @param array $pages + */ + public function testGetItems(array $pages = []) + { + $storeConfigMock = $this->getStoreConfigMock([ + CmsPageSitemapItemResolver::XML_PATH_PAGE_CHANGEFREQ => 'daily', + CmsPageSitemapItemResolver::XML_PATH_PAGE_PRIORITY => '1.0', + ]); + + $cmsPageMock = $this->getCmsPageCollectionMock($pages); + + $cmsPageFactoryMock = $this->getCmsPageFactoryMock($cmsPageMock); + $itemFactoryMock = $this->getItemFactoryMock(); + + $resolver = new CmsPageSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + $items = $resolver->getItems(1); + self::assertTrue(count($items) == count($pages)); + foreach($pages as $index => $page) {; + self::assertSame($page->getUpdatedAt(), $items[$index]->getUpdatedAt()); + self::assertSame('daily', $items[$index]->getChangeFrequency()); + self::assertSame('1.0', $items[$index]->getPriority()); + self::assertSame($page->getImages(), $items[$index]->getImages()); + self::assertSame($page->getUrl(), $items[$index]->getUrl()); + } + } + + /** + * @return array + */ + public function pageProvider() + { + return [ + [ + [ + new DataObject([ + 'url' => 'http://dummy.url', + 'id' => '/url', + 'updated_at' => '2017-01-01 23:59:59' + ]) + ] + ] + ]; + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getItemFactoryMock() + { + $itemFactoryMock = $this->getMockBuilder(SitemapItemInterfaceFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + + $itemFactoryMock->expects(self::any()) + ->method('create') + ->willReturnCallback(function ($data) { + $helper = new ObjectManager($this); + + return $helper->getObject(SitemapItem::class, $data); + }); + + return $itemFactoryMock; + } + + /** + * @param $returnValue + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getCmsPageFactoryMock($returnValue) + { + $cmsPageFactoryMock = $this->getMockBuilder(PageFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + + $cmsPageFactoryMock->expects(self::any()) + ->method('create') + ->willReturn($returnValue); + + return $cmsPageFactoryMock; + } + + /** + * @param array $pathMap + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getStoreConfigMock(array $pathMap = []) + { + $scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); + $scopeConfigMock->method('getValue') + ->willReturnCallback(function ($path) use ($pathMap) { + return isset($pathMap[$path]) ? $pathMap[$path] : null; + }); + + return $scopeConfigMock; + } + + /** + * @param $returnValue + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getCmsPageCollectionMock($returnValue) + { + $sitemapCmsPageMock = $this->getMockBuilder(Page::class) + ->setMethods(['getCollection']) + ->disableOriginalConstructor() + ->getMock(); + + $sitemapCmsPageMock->expects(self::any()) + ->method('getCollection') + ->willReturn($returnValue); + + return $sitemapCmsPageMock; + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php new file mode 100644 index 0000000000000..b1db237475f7e --- /dev/null +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php @@ -0,0 +1,69 @@ +getItems(1)); + } + + /** + * @dataProvider sitemapItemsProvider + * @param array $itemResolverData + * @param array $expectedItems + */ + public function testGetItems($itemResolverData, $expectedItems) + { + $mockResolvers = []; + + foreach($itemResolverData as $data) { + $mockResolver = $this->getMockForAbstractClass(SitemapItemResolverInterface::class); + $mockResolver->expects(self::once()) + ->method('getItems') + ->willReturn($data); + + $mockResolvers[] = $mockResolver; + } + + $resolver = new CompositeSitemapItemResolver($mockResolvers); + $items = $resolver->getItems(1); + + self::assertSame($expectedItems, $items); + } + + /** + * @return array + */ + public function sitemapItemsProvider() + { + $testCases = []; + + for($i = 1; $i < 5; $i++) { + $itemProviders = []; + $expectedItems = []; + for($i = 1; $i < $maxProviders = random_int(1, 5); $i++) { + $items = []; + for($i = 1; $i < $maxItems = random_int(2, 5); $i++) { + $sitemapItem = $this->getMockForAbstractClass(SitemapItemInterface::class); + $items[] = $sitemapItem; + $expectedItems[] = $sitemapItem; + } + $itemProviders[] = $items; + } + + $testCases[] = [$itemProviders, $expectedItems]; + } + + return $testCases; + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php new file mode 100644 index 0000000000000..bd7ac0366a95d --- /dev/null +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php @@ -0,0 +1,174 @@ +getStoreConfigMock([ + ProductSitemapItemResolver::XML_PATH_PRODUCT_CHANGEFREQ => 'daily', + ProductSitemapItemResolver::XML_PATH_PRODUCT_PRIORITY => '1.0', + ]); + + $ProductMock = $this->getProductCollectionMock([]); + $cmsPageFactoryMock = $this->getProductFactoryMock($ProductMock); + $itemFactoryMock = $this->getItemFactoryMock(); + + $resolver = new ProductSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + self::assertSame([], $resolver->getItems(1)); + } + + /** + * @dataProvider productProvider + * @param array $categories + */ + public function testGetItems(array $categories) + { + $storeConfigMock = $this->getStoreConfigMock([ + ProductSitemapItemResolver::XML_PATH_PRODUCT_CHANGEFREQ => 'daily', + ProductSitemapItemResolver::XML_PATH_PRODUCT_PRIORITY => '1.0', + ]); + + $ProductMock = $this->getProductCollectionMock($categories); + + $cmsPageFactoryMock = $this->getProductFactoryMock($ProductMock); + $itemFactoryMock = $this->getItemFactoryMock(); + + $resolver = new ProductSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + $items = $resolver->getItems(1); + self::assertTrue(count($items) == count($categories)); + foreach($categories as $index => $product) { + self::assertSame($product->getUpdatedAt(), $items[$index]->getUpdatedAt()); + self::assertSame('daily', $items[$index]->getChangeFrequency()); + self::assertSame('1.0', $items[$index]->getPriority()); + self::assertSame($product->getImages(), $items[$index]->getImages()); + self::assertSame($product->getUrl(), $items[$index]->getUrl()); + } + } + + /** + * @return array + */ + public function productProvider() + { + $storeBaseMediaUrl = 'http://store.com/pub/media/catalog/product/cache/c9e0b0ef589f3508e5ba515cde53c5ff/'; + return [ + [ + [ + new DataObject( + ['url' => 'product.html', 'updated_at' => '2012-12-21 00:00:00'] + ), + new DataObject( + [ + 'url' => 'product2.html', + 'updated_at' => '2012-12-21 00:00:00', + 'images' => new DataObject( + [ + 'collection' => [ + new DataObject( + [ + 'url' => $storeBaseMediaUrl.'i/m/image1.png', + 'caption' => 'caption & > title < "' + ] + ), + new DataObject( + ['url' => $storeBaseMediaUrl.'i/m/image_no_caption.png', 'caption' => null] + ), + ], + 'thumbnail' => $storeBaseMediaUrl.'t/h/thumbnail.jpg', + 'title' => 'Product & > title < "', + ] + ), + ] + ), + ] + ] + ]; + } + + /** + * @param $returnValue + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getProductFactoryMock($returnValue) + { + $cmsPageFactoryMock = $this->getMockBuilder(ProductFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + + $cmsPageFactoryMock->expects(self::any()) + ->method('create') + ->willReturn($returnValue); + + return $cmsPageFactoryMock; + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getItemFactoryMock() + { + $itemFactoryMock = $this->getMockBuilder(SitemapItemInterfaceFactory::class) + ->setMethods(['create']) + ->disableOriginalConstructor() + ->getMock(); + + $itemFactoryMock->expects(self::any()) + ->method('create') + ->willReturnCallback(function ($data) { + $helper = new ObjectManager($this); + + return $helper->getObject(SitemapItem::class, $data); + }); + + return $itemFactoryMock; + } + + /** + * @param array $pathMap + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getStoreConfigMock(array $pathMap = []) + { + $scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); + $scopeConfigMock->method('getValue') + ->willReturnCallback(function ($path) use ($pathMap) { + return isset($pathMap[$path]) ? $pathMap[$path] : null; + }); + + return $scopeConfigMock; + } + + /** + * @param $returnValue + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getProductCollectionMock($returnValue) + { + $sitemapCmsPageMock = $this->getMockBuilder(Product::class) + ->setMethods(['getCollection']) + ->disableOriginalConstructor() + ->getMock(); + + $sitemapCmsPageMock->expects(self::any()) + ->method('getCollection') + ->willReturn($returnValue); + + return $sitemapCmsPageMock; + } +} \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index fb1379ecfca28..0b69dd349696e 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -5,6 +5,8 @@ */ namespace Magento\Sitemap\Test\Unit\Model; +use Magento\Sitemap\Model\SitemapItemResolverInterface; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -55,6 +57,11 @@ class SitemapTest extends \PHPUnit_Framework_TestCase */ private $storeManagerMock; + /** + * @var \Magento\Sitemap\Model\SitemapItemResolverInterface + */ + private $itemResolverMock; + /** * Set helper mocks, create resource model mock */ @@ -146,6 +153,11 @@ protected function setUp() )->will( $this->returnValue($this->_directoryMock) ); + + $this->itemResolverMock = $this->getMockForAbstractClass(SitemapItemResolverInterface::class); + $this->itemResolverMock->expects(self::any()) + ->method('getItems') + ->willReturn([]); } /** @@ -646,7 +658,8 @@ protected function _getModelConstructorArgs() 'cmsFactory' => $cmsFactory, 'storeManager' => $this->storeManagerMock, 'sitemapData' => $this->_helperMockSitemap, - 'filesystem' => $this->_filesystemMock + 'filesystem' => $this->_filesystemMock, + 'itemResolver' => $this->itemResolverMock, ] ); $constructArguments['resource'] = null; diff --git a/app/code/Magento/Sitemap/etc/di.xml b/app/code/Magento/Sitemap/etc/di.xml index 0b45763c41bae..217c65dc61973 100644 --- a/app/code/Magento/Sitemap/etc/di.xml +++ b/app/code/Magento/Sitemap/etc/di.xml @@ -6,6 +6,8 @@ */ --> + + Magento\Sitemap\Model\ResourceModel\Sitemap @@ -18,4 +20,13 @@ + + + + Magento\Sitemap\Model\CategorySitemapItemResolver + Magento\Sitemap\Model\CmsPageSitemapItemResolver + Magento\Sitemap\Model\ProductSitemapItemResolver + + + From becd97c1e5bb9339bb9399dc8e43efc93ad18da2 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Wed, 19 Jul 2017 21:36:37 +0100 Subject: [PATCH 0321/1004] magento/magento2#10045 Sitemap add item refactoring - remove var_dump --- app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php index 196d13a8cf251..f1b702f2649dc 100644 --- a/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php +++ b/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php @@ -65,7 +65,6 @@ public function __construct( public function getItems($storeId) { $collection = $this->cmsPageFactory->create()->getCollection($storeId); - var_dump($collection); $items = array_map(function($item) use ($storeId) { return $this->itemFactory->create([ 'url' => $item->getUrl(), @@ -76,8 +75,6 @@ public function getItems($storeId) ]); }, $collection); - var_dump($items); - return $items; } From d990c95cd007e99e5379797f0b052a25dbfd34b9 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Wed, 19 Jul 2017 21:44:17 +0100 Subject: [PATCH 0322/1004] magento/magento2#10045 Sitemap add item refactoring - fix coding standards --- .../Sitemap/Model/CategorySitemapItemResolver.php | 4 ++-- .../Sitemap/Model/CmsPageSitemapItemResolver.php | 4 ++-- .../Sitemap/Model/CompositeSitemapItemResolver.php | 2 +- .../Sitemap/Model/ProductSitemapItemResolver.php | 4 ++-- app/code/Magento/Sitemap/Model/SitemapItem.php | 2 +- .../Magento/Sitemap/Model/SitemapItemInterface.php | 5 +++-- .../Sitemap/Model/SitemapItemResolverInterface.php | 2 +- .../Unit/Model/CategorySitemapItemResolverTest.php | 2 +- .../Test/Unit/Model/CmsPageSitemapItemResolverTest.php | 2 +- .../Unit/Model/CompositeSitemapItemResolverTest.php | 10 +++++----- 10 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php b/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php index 77dd3f746eef1..f4653c322cef1 100644 --- a/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php +++ b/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php @@ -64,7 +64,7 @@ public function __construct( public function getItems($storeId) { $collection = $this->categoryFactory->create()->getCollection($storeId); - $items = array_map(function($item) use ($storeId) { + $items = array_map(function ($item) use ($storeId) { return $this->itemFactory->create([ 'url' => $item->getUrl(), 'updatedAt' => $item->getUpdatedAt(), @@ -106,4 +106,4 @@ private function getCategoryChangeFrequency($storeId) $storeId ); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php index f1b702f2649dc..dab431e060ebc 100644 --- a/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php +++ b/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php @@ -65,7 +65,7 @@ public function __construct( public function getItems($storeId) { $collection = $this->cmsPageFactory->create()->getCollection($storeId); - $items = array_map(function($item) use ($storeId) { + $items = array_map(function ($item) use ($storeId) { return $this->itemFactory->create([ 'url' => $item->getUrl(), 'updatedAt' => $item->getUpdatedAt(), @@ -107,4 +107,4 @@ private function getPageChangeFrequency($storeId) $storeId ); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php index f6f00be2c763c..d5c5a80624126 100644 --- a/app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php +++ b/app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php @@ -41,4 +41,4 @@ public function getItems($storeId) return $items; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php index 5e321b8a9557e..b11fd3c6aadd9 100644 --- a/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php +++ b/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php @@ -63,7 +63,7 @@ public function __construct( public function getItems($storeId) { $collection = $this->productFactory->create()->getCollection($storeId); - $items = array_map(function($item) use ($storeId) { + $items = array_map(function ($item) use ($storeId) { return $this->itemFactory->create([ 'url' => $item->getUrl(), 'updatedAt' => $item->getUpdatedAt(), @@ -105,4 +105,4 @@ private function getProductChangeFrequency($storeId) $storeId ); } -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/Model/SitemapItem.php b/app/code/Magento/Sitemap/Model/SitemapItem.php index 4a6c4d8fd9e16..2436a6f797d98 100644 --- a/app/code/Magento/Sitemap/Model/SitemapItem.php +++ b/app/code/Magento/Sitemap/Model/SitemapItem.php @@ -90,4 +90,4 @@ public function getUpdatedAt() { return $this->updatedAt; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/Model/SitemapItemInterface.php b/app/code/Magento/Sitemap/Model/SitemapItemInterface.php index 5c87f1805afa2..afd95768a2c84 100644 --- a/app/code/Magento/Sitemap/Model/SitemapItemInterface.php +++ b/app/code/Magento/Sitemap/Model/SitemapItemInterface.php @@ -11,7 +11,8 @@ * * @api */ -interface SitemapItemInterface { +interface SitemapItemInterface +{ /** * Get url @@ -47,4 +48,4 @@ public function getImages(); * @return string|null */ public function getUpdatedAt(); -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/Model/SitemapItemResolverInterface.php b/app/code/Magento/Sitemap/Model/SitemapItemResolverInterface.php index 84c510f9ab4be..eef4290a2a8d5 100644 --- a/app/code/Magento/Sitemap/Model/SitemapItemResolverInterface.php +++ b/app/code/Magento/Sitemap/Model/SitemapItemResolverInterface.php @@ -19,4 +19,4 @@ interface SitemapItemResolverInterface * @return SitemapItemInterface[] */ public function getItems($storeId); -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php index ce7995889aefe..2209192fe1539 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php @@ -149,4 +149,4 @@ private function getCategoryCollectionMock($returnValue) return $sitemapCmsPageMock; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php index 9bc313120fc04..583246562fd1d 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php @@ -51,7 +51,7 @@ public function testGetItems(array $pages = []) $resolver = new CmsPageSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); $items = $resolver->getItems(1); self::assertTrue(count($items) == count($pages)); - foreach($pages as $index => $page) {; + foreach ($pages as $index => $page) { self::assertSame($page->getUpdatedAt(), $items[$index]->getUpdatedAt()); self::assertSame('daily', $items[$index]->getChangeFrequency()); self::assertSame('1.0', $items[$index]->getPriority()); diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php index b1db237475f7e..6b53d39061ead 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php @@ -26,7 +26,7 @@ public function testGetItems($itemResolverData, $expectedItems) { $mockResolvers = []; - foreach($itemResolverData as $data) { + foreach ($itemResolverData as $data) { $mockResolver = $this->getMockForAbstractClass(SitemapItemResolverInterface::class); $mockResolver->expects(self::once()) ->method('getItems') @@ -48,12 +48,12 @@ public function sitemapItemsProvider() { $testCases = []; - for($i = 1; $i < 5; $i++) { + for ($i = 1; $i < 5; $i++) { $itemProviders = []; $expectedItems = []; - for($i = 1; $i < $maxProviders = random_int(1, 5); $i++) { + for ($i = 1; $i < $maxProviders = random_int(1, 5); $i++) { $items = []; - for($i = 1; $i < $maxItems = random_int(2, 5); $i++) { + for ($i = 1; $i < $maxItems = random_int(2, 5); $i++) { $sitemapItem = $this->getMockForAbstractClass(SitemapItemInterface::class); $items[] = $sitemapItem; $expectedItems[] = $sitemapItem; @@ -66,4 +66,4 @@ public function sitemapItemsProvider() return $testCases; } -} \ No newline at end of file +} From f6012a0d0f60f15b904e4ed78bfb5be886faf190 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 20 Jul 2017 11:00:14 +0300 Subject: [PATCH 0323/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../{Command => }/AssignSourcesToStock.php | 3 +- .../Model/ResourceModel/SourceStockLink.php | 6 +- .../AssignSourcesToStockInterface.php | 12 +-- .../Api/Data/SourceItemInterface.php | 2 +- .../Api/Data/SourceStockLinkInterface.php | 87 ------------------- .../SourceStockLinkRepositoryInterface.php | 35 -------- 6 files changed, 10 insertions(+), 135 deletions(-) rename app/code/Magento/Inventory/Model/{Command => }/AssignSourcesToStock.php (98%) rename app/code/Magento/InventoryApi/Api/{Command => }/AssignSourcesToStockInterface.php (64%) delete mode 100644 app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php delete mode 100644 app/code/Magento/InventoryApi/Api/SourceStockLinkRepositoryInterface.php diff --git a/app/code/Magento/Inventory/Model/Command/AssignSourcesToStock.php b/app/code/Magento/Inventory/Model/AssignSourcesToStock.php similarity index 98% rename from app/code/Magento/Inventory/Model/Command/AssignSourcesToStock.php rename to app/code/Magento/Inventory/Model/AssignSourcesToStock.php index 83d308e4d2386..5320288f8ec33 100644 --- a/app/code/Magento/Inventory/Model/Command/AssignSourcesToStock.php +++ b/app/code/Magento/Inventory/Model/AssignSourcesToStock.php @@ -3,8 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -namespace Magento\Inventory\Model\Command; +namespace Magento\Inventory\Model; use Magento\Framework\App\ResourceConnection; use Magento\Framework\DB\Adapter\AdapterInterface; diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php index 1ad5c4f982e6a..8bee6c6b06a3b 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php @@ -9,14 +9,12 @@ use Magento\Inventory\Setup\InstallSchema; /** - * This class needed for service purposes only, to make collection work properly + * Implementation of basic operations for SourceCarrierLink entity for specific db layer */ class SourceStockLink extends AbstractDb { /** - * Initialize resource model - * - * @return void + * @inheritdoc */ protected function _construct() { diff --git a/app/code/Magento/InventoryApi/Api/Command/AssignSourcesToStockInterface.php b/app/code/Magento/InventoryApi/Api/AssignSourcesToStockInterface.php similarity index 64% rename from app/code/Magento/InventoryApi/Api/Command/AssignSourcesToStockInterface.php rename to app/code/Magento/InventoryApi/Api/AssignSourcesToStockInterface.php index 303cbb5da2754..adb29d9fe52a3 100644 --- a/app/code/Magento/InventoryApi/Api/Command/AssignSourcesToStockInterface.php +++ b/app/code/Magento/InventoryApi/Api/AssignSourcesToStockInterface.php @@ -3,24 +3,24 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -namespace Magento\InventoryApi\Api\Command; +namespace Magento\InventoryApi\Api; /** - * Interface to assign source id list by stock id. + * Interface to assign source id list by stock id + * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser * * @api */ interface AssignSourcesToStockInterface { - /** - * Assign source id list by stock id. + * Assign source id list by stock id * * @param int[] $sourceIds * @param int $stockId - * @throws \Magento\Framework\Exception\CouldNotSaveException * @return void + * @throws \Magento\Framework\Exception\CouldNotSaveException */ public function execute(array $sourceIds, $stockId); } diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php index d4c210c629a9e..fffc9853526fc 100644 --- a/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php +++ b/app/code/Magento/InventoryApi/Api/Data/SourceItemInterface.php @@ -10,7 +10,7 @@ /** * Represents amount of product on physical storage - * Entity id getter is missed because entity identifiers are sku and source id + * Entity id getter is missed because entity identifies by compound identifier (sku and source_id) * * Used fully qualified namespaces in annotations for proper work of WebApi request parser * diff --git a/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php b/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php deleted file mode 100644 index d8d273b78fc7d..0000000000000 --- a/app/code/Magento/InventoryApi/Api/Data/SourceStockLinkInterface.php +++ /dev/null @@ -1,87 +0,0 @@ - Date: Thu, 20 Jul 2017 11:10:12 +0300 Subject: [PATCH 0324/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../GetAssignedSourcesByStockIdInterface.php | 23 ------------------ .../GetAssignedSourcesForStockInterface.php | 24 +++++++++++++++++++ .../Api/SourceItemRepositoryInterface.php | 6 ++++- .../Api/SourceRepositoryInterface.php | 2 ++ .../Api/UnassignSourceFromStockInterface.php | 23 ++++++++++++++++++ 5 files changed, 54 insertions(+), 24 deletions(-) delete mode 100644 app/code/Magento/InventoryApi/Api/Command/GetAssignedSourcesByStockIdInterface.php create mode 100644 app/code/Magento/InventoryApi/Api/GetAssignedSourcesForStockInterface.php create mode 100644 app/code/Magento/InventoryApi/Api/UnassignSourceFromStockInterface.php diff --git a/app/code/Magento/InventoryApi/Api/Command/GetAssignedSourcesByStockIdInterface.php b/app/code/Magento/InventoryApi/Api/Command/GetAssignedSourcesByStockIdInterface.php deleted file mode 100644 index 7f38313e13d9a..0000000000000 --- a/app/code/Magento/InventoryApi/Api/Command/GetAssignedSourcesByStockIdInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - Date: Thu, 20 Jul 2017 12:09:24 +0300 Subject: [PATCH 0325/1004] MSI - Msi stock ui aggregation #39 - refactoring --- ...kId.php => GetAssignedSourcesForStock.php} | 21 ++-- app/code/Magento/Inventory/Model/Source.php | 72 +++++++------- .../Inventory/Model/SourceCarrierLink.php | 8 +- .../Magento/Inventory/Model/SourceItem.php | 16 +-- .../Inventory/Model/SourceStockLink.php | 49 ++++------ .../Model/SourceStockLinkRepository.php | 67 ------------- app/code/Magento/Inventory/Model/Stock.php | 8 +- .../Model/UnassignSourceFromStock.php | 97 +++++++++++++++++++ 8 files changed, 175 insertions(+), 163 deletions(-) rename app/code/Magento/Inventory/Model/{Command/GetAssignedSourcesByStockId.php => GetAssignedSourcesForStock.php} (74%) delete mode 100644 app/code/Magento/Inventory/Model/SourceStockLinkRepository.php create mode 100644 app/code/Magento/Inventory/Model/UnassignSourceFromStock.php diff --git a/app/code/Magento/Inventory/Model/Command/GetAssignedSourcesByStockId.php b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php similarity index 74% rename from app/code/Magento/Inventory/Model/Command/GetAssignedSourcesByStockId.php rename to app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php index 7e389b19c062a..cd660c9a54ea3 100644 --- a/app/code/Magento/Inventory/Model/Command/GetAssignedSourcesByStockId.php +++ b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php @@ -3,21 +3,19 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ - -namespace Magento\Inventory\Model\Command; +namespace Magento\Inventory\Model; use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Inventory\Model\ResourceModel\SourceStockLink\Collection as StockLinkCollection; -use Magento\Inventory\Model\ResourceModel\SourceStockLink\CollectionFactory as StockLinkCollectionFactory; -use Magento\InventoryApi\Api\Command\GetAssignedSourcesByStockIdInterface; +use Magento\Inventory\Model\ResourceModel\SourceStockLink\Collection; +use Magento\Inventory\Model\ResourceModel\SourceStockLink\CollectionFactory; use Magento\InventoryApi\Api\Data\StockInterface; - +use Magento\InventoryApi\Api\GetAssignedSourcesForStockInterface; /** * @inheritdoc */ -class GetAssignedSourcesByStockId implements GetAssignedSourcesByStockIdInterface +class GetAssignedSourcesForStock implements GetAssignedSourcesForStockInterface { /** * @var CollectionProcessorInterface @@ -25,7 +23,7 @@ class GetAssignedSourcesByStockId implements GetAssignedSourcesByStockIdInterfac private $collectionProcessor; /** - * @var StockLinkCollectionFactory + * @var CollectionFactory */ private $stockLinkCollectionFactory; @@ -35,14 +33,13 @@ class GetAssignedSourcesByStockId implements GetAssignedSourcesByStockIdInterfac private $searchCriteriaBuilder; /** - * SourceStockLinkManagement constructor. * @param CollectionProcessorInterface $collectionProcessor - * @param StockLinkCollectionFactory $stockLinkCollectionFactory + * @param CollectionFactory $stockLinkCollectionFactory * @param SearchCriteriaBuilder $searchCriteriaBuilder */ public function __construct( CollectionProcessorInterface $collectionProcessor, - StockLinkCollectionFactory $stockLinkCollectionFactory, + CollectionFactory $stockLinkCollectionFactory, SearchCriteriaBuilder $searchCriteriaBuilder ) { $this->collectionProcessor = $collectionProcessor; @@ -59,7 +56,7 @@ public function execute($stockId) ->addFilter(StockInterface::STOCK_ID, $stockId) ->create(); - /** @var StockLinkCollection $collection */ + /** @var Collection $collection */ $collection = $this->stockLinkCollectionFactory->create(); $this->collectionProcessor->process($searchCriteria, $collection); return $collection->getItems(); diff --git a/app/code/Magento/Inventory/Model/Source.php b/app/code/Magento/Inventory/Model/Source.php index 624c744dd83b6..5ca82a6f2dee1 100644 --- a/app/code/Magento/Inventory/Model/Source.php +++ b/app/code/Magento/Inventory/Model/Source.php @@ -30,7 +30,7 @@ protected function _construct() */ public function getSourceId() { - return $this->getData(SourceInterface::SOURCE_ID); + return $this->getData(self::SOURCE_ID); } /** @@ -38,7 +38,7 @@ public function getSourceId() */ public function setSourceId($sourceId) { - $this->setData(SourceInterface::SOURCE_ID, $sourceId); + $this->setData(self::SOURCE_ID, $sourceId); } /** @@ -46,7 +46,7 @@ public function setSourceId($sourceId) */ public function getName() { - return $this->getData(SourceInterface::NAME); + return $this->getData(self::NAME); } /** @@ -54,7 +54,7 @@ public function getName() */ public function setName($name) { - $this->setData(SourceInterface::NAME, $name); + $this->setData(self::NAME, $name); } /** @@ -62,7 +62,7 @@ public function setName($name) */ public function getEmail() { - return $this->getData(SourceInterface::EMAIL); + return $this->getData(self::EMAIL); } /** @@ -70,7 +70,7 @@ public function getEmail() */ public function setEmail($email) { - $this->setData(SourceInterface::EMAIL, $email); + $this->setData(self::EMAIL, $email); } /** @@ -78,7 +78,7 @@ public function setEmail($email) */ public function getContactName() { - return $this->getData(SourceInterface::CONTACT_NAME); + return $this->getData(self::CONTACT_NAME); } /** @@ -86,7 +86,7 @@ public function getContactName() */ public function setContactName($contactName) { - $this->setData(SourceInterface::CONTACT_NAME, $contactName); + $this->setData(self::CONTACT_NAME, $contactName); } /** @@ -94,7 +94,7 @@ public function setContactName($contactName) */ public function isEnabled() { - return $this->getData(SourceInterface::ENABLED); + return $this->getData(self::ENABLED); } /** @@ -102,7 +102,7 @@ public function isEnabled() */ public function setEnabled($enabled) { - $this->setData(SourceInterface::ENABLED, $enabled); + $this->setData(self::ENABLED, $enabled); } /** @@ -110,7 +110,7 @@ public function setEnabled($enabled) */ public function getDescription() { - return $this->getData(SourceInterface::DESCRIPTION); + return $this->getData(self::DESCRIPTION); } /** @@ -118,7 +118,7 @@ public function getDescription() */ public function setDescription($description) { - $this->setData(SourceInterface::DESCRIPTION, $description); + $this->setData(self::DESCRIPTION, $description); } /** @@ -126,7 +126,7 @@ public function setDescription($description) */ public function getLatitude() { - return $this->getData(SourceInterface::LATITUDE); + return $this->getData(self::LATITUDE); } /** @@ -134,7 +134,7 @@ public function getLatitude() */ public function setLatitude($latitude) { - $this->setData(SourceInterface::LATITUDE, $latitude); + $this->setData(self::LATITUDE, $latitude); } /** @@ -142,7 +142,7 @@ public function setLatitude($latitude) */ public function getLongitude() { - return $this->getData(SourceInterface::LONGITUDE); + return $this->getData(self::LONGITUDE); } /** @@ -150,7 +150,7 @@ public function getLongitude() */ public function setLongitude($longitude) { - $this->setData(SourceInterface::LONGITUDE, $longitude); + $this->setData(self::LONGITUDE, $longitude); } /** @@ -158,7 +158,7 @@ public function setLongitude($longitude) */ public function getCountryId() { - return $this->getData(SourceInterface::COUNTRY_ID); + return $this->getData(self::COUNTRY_ID); } /** @@ -166,7 +166,7 @@ public function getCountryId() */ public function setCountryId($countryId) { - $this->setData(SourceInterface::COUNTRY_ID, $countryId); + $this->setData(self::COUNTRY_ID, $countryId); } /** @@ -174,7 +174,7 @@ public function setCountryId($countryId) */ public function getRegionId() { - return $this->getData(SourceInterface::REGION_ID); + return $this->getData(self::REGION_ID); } /** @@ -182,7 +182,7 @@ public function getRegionId() */ public function setRegionId($regionId) { - $this->setData(SourceInterface::REGION_ID, $regionId); + $this->setData(self::REGION_ID, $regionId); } /** @@ -190,7 +190,7 @@ public function setRegionId($regionId) */ public function getRegion() { - return $this->getData(SourceInterface::REGION); + return $this->getData(self::REGION); } /** @@ -198,7 +198,7 @@ public function getRegion() */ public function setRegion($region) { - $this->setData(SourceInterface::REGION, $region); + $this->setData(self::REGION, $region); } /** @@ -206,7 +206,7 @@ public function setRegion($region) */ public function getCity() { - return $this->getData(SourceInterface::CITY); + return $this->getData(self::CITY); } /** @@ -214,7 +214,7 @@ public function getCity() */ public function setCity($city) { - $this->setData(SourceInterface::CITY, $city); + $this->setData(self::CITY, $city); } /** @@ -222,7 +222,7 @@ public function setCity($city) */ public function getStreet() { - return $this->getData(SourceInterface::STREET); + return $this->getData(self::STREET); } /** @@ -230,7 +230,7 @@ public function getStreet() */ public function setStreet($street) { - $this->setData(SourceInterface::STREET, $street); + $this->setData(self::STREET, $street); } /** @@ -238,7 +238,7 @@ public function setStreet($street) */ public function getPostcode() { - return $this->getData(SourceInterface::POSTCODE); + return $this->getData(self::POSTCODE); } /** @@ -246,7 +246,7 @@ public function getPostcode() */ public function setPostcode($postcode) { - $this->setData(SourceInterface::POSTCODE, $postcode); + $this->setData(self::POSTCODE, $postcode); } /** @@ -254,7 +254,7 @@ public function setPostcode($postcode) */ public function getPhone() { - return $this->getData(SourceInterface::PHONE); + return $this->getData(self::PHONE); } /** @@ -262,7 +262,7 @@ public function getPhone() */ public function setPhone($phone) { - $this->setData(SourceInterface::PHONE, $phone); + $this->setData(self::PHONE, $phone); } /** @@ -270,7 +270,7 @@ public function setPhone($phone) */ public function getFax() { - return $this->getData(SourceInterface::FAX); + return $this->getData(self::FAX); } /** @@ -278,7 +278,7 @@ public function getFax() */ public function setFax($fax) { - $this->setData(SourceInterface::FAX, $fax); + $this->setData(self::FAX, $fax); } /** @@ -286,7 +286,7 @@ public function setFax($fax) */ public function getPriority() { - return $this->getData(SourceInterface::PRIORITY); + return $this->getData(self::PRIORITY); } /** @@ -294,7 +294,7 @@ public function getPriority() */ public function setPriority($priority) { - $this->setData(SourceInterface::PRIORITY, $priority); + $this->setData(self::PRIORITY, $priority); } /** @@ -318,7 +318,7 @@ public function setUseDefaultCarrierConfig($useDefaultCarrierConfig) */ public function getCarrierLinks() { - return $this->getData(SourceInterface::CARRIER_LINKS); + return $this->getData(self::CARRIER_LINKS); } /** @@ -326,7 +326,7 @@ public function getCarrierLinks() */ public function setCarrierLinks($carrierLinks) { - $this->setData(SourceInterface::CARRIER_LINKS, $carrierLinks); + $this->setData(self::CARRIER_LINKS, $carrierLinks); } /** diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/SourceCarrierLink.php index 3659573565540..87826747bfbc4 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLink.php @@ -30,7 +30,7 @@ protected function _construct() */ public function getCarrierCode() { - return $this->getData(SourceCarrierLinkInterface::CARRIER_CODE); + return $this->getData(self::CARRIER_CODE); } /** @@ -38,7 +38,7 @@ public function getCarrierCode() */ public function setCarrierCode($carrierCode) { - $this->setData(SourceCarrierLinkInterface::CARRIER_CODE, $carrierCode); + $this->setData(self::CARRIER_CODE, $carrierCode); } /** @@ -46,7 +46,7 @@ public function setCarrierCode($carrierCode) */ public function getPosition() { - return $this->getData(SourceCarrierLinkInterface::POSITION); + return $this->getData(self::POSITION); } /** @@ -54,7 +54,7 @@ public function getPosition() */ public function setPosition($position) { - $this->setData(SourceCarrierLinkInterface::POSITION, $position); + $this->setData(self::POSITION, $position); } /** diff --git a/app/code/Magento/Inventory/Model/SourceItem.php b/app/code/Magento/Inventory/Model/SourceItem.php index 01aecf99650e2..b9246964b2457 100644 --- a/app/code/Magento/Inventory/Model/SourceItem.php +++ b/app/code/Magento/Inventory/Model/SourceItem.php @@ -30,7 +30,7 @@ protected function _construct() */ public function getSku() { - return $this->getData(SourceItemInterface::SKU); + return $this->getData(self::SKU); } /** @@ -38,7 +38,7 @@ public function getSku() */ public function setSku($sku) { - $this->setData(SourceItemInterface::SKU, $sku); + $this->setData(self::SKU, $sku); } /** @@ -46,7 +46,7 @@ public function setSku($sku) */ public function getSourceId() { - return $this->getData(SourceItemInterface::SOURCE_ID); + return $this->getData(self::SOURCE_ID); } /** @@ -54,7 +54,7 @@ public function getSourceId() */ public function setSourceId($sourceId) { - $this->setData(SourceItemInterface::SOURCE_ID, $sourceId); + $this->setData(self::SOURCE_ID, $sourceId); } /** @@ -62,7 +62,7 @@ public function setSourceId($sourceId) */ public function getQuantity() { - return $this->getData(SourceItemInterface::QUANTITY); + return $this->getData(self::QUANTITY); } /** @@ -70,7 +70,7 @@ public function getQuantity() */ public function setQuantity($quantity) { - $this->setData(SourceItemInterface::QUANTITY, $quantity); + $this->setData(self::QUANTITY, $quantity); } /** @@ -78,7 +78,7 @@ public function setQuantity($quantity) */ public function getStatus() { - return $this->getData(SourceItemInterface::STATUS); + return $this->getData(self::STATUS); } /** @@ -86,7 +86,7 @@ public function getStatus() */ public function setStatus($status) { - $this->setData(SourceItemInterface::STATUS, $status); + $this->setData(self::STATUS, $status); } /** diff --git a/app/code/Magento/Inventory/Model/SourceStockLink.php b/app/code/Magento/Inventory/Model/SourceStockLink.php index 88027970212d6..6f9af7ddbf066 100644 --- a/app/code/Magento/Inventory/Model/SourceStockLink.php +++ b/app/code/Magento/Inventory/Model/SourceStockLink.php @@ -5,18 +5,24 @@ */ namespace Magento\Inventory\Model; -use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\Framework\Model\AbstractModel; use Magento\Inventory\Model\ResourceModel\SourceStockLink as SourceStockLinkResourceModel; -use Magento\InventoryApi\Api\Data\SourceStockLinkExtensionInterface; -use Magento\InventoryApi\Api\Data\SourceStockLinkInterface; /** - * {@inheritdoc} + * Doesn't have API interface because this object is need only for internal module using * * @codeCoverageIgnore */ -class SourceStockLink extends AbstractExtensibleModel implements SourceStockLinkInterface +class SourceStockLink extends AbstractModel { + /**#@+ + * Constants for keys of data array. Identical to the name of the getter in snake case + */ + const LINK_ID = 'link_id'; + const SOURCE_ID = 'source_id'; + const STOCK_ID = 'stock_id'; + /**#@-*/ + /** * @inheritdoc */ @@ -30,7 +36,7 @@ protected function _construct() */ public function getLinkId() { - return $this->getData(SourceStockLinkInterface::LINK_ID); + return $this->getData(self::LINK_ID); } /** @@ -38,7 +44,7 @@ public function getLinkId() */ public function setLinkId($linkId) { - $this->setData(SourceStockLinkInterface::LINK_ID, $linkId); + $this->setData(self::LINK_ID, $linkId); } /** @@ -46,7 +52,7 @@ public function setLinkId($linkId) */ public function getSourceId() { - return $this->getData(SourceStockLinkInterface::SOURCE_ID); + return $this->getData(self::SOURCE_ID); } /** @@ -54,7 +60,7 @@ public function getSourceId() */ public function setSourceId($sourceId) { - $this->setData(SourceStockLinkInterface::SOURCE_ID, $sourceId); + $this->setData(self::SOURCE_ID, $sourceId); } /** @@ -62,7 +68,7 @@ public function setSourceId($sourceId) */ public function getStockId() { - return $this->getData(SourceStockLinkInterface::STOCK_ID); + return $this->getData(self::STOCK_ID); } /** @@ -70,27 +76,6 @@ public function getStockId() */ public function setStockId($stockId) { - $this->setData(SourceStockLinkInterface::STOCK_ID, $stockId); - } - - /** - * @inheritdoc - */ - public function getExtensionAttributes() - { - $extensionAttributes = $this->_getExtensionAttributes(); - if (null === $extensionAttributes) { - $extensionAttributes = $this->extensionAttributesFactory->create(SourceStockLinkInterface::class); - $this->setExtensionAttributes($extensionAttributes); - } - return $extensionAttributes; - } - - /** - * @inheritdoc - */ - public function setExtensionAttributes(SourceStockLinkExtensionInterface $extensionAttributes) - { - $this->_setExtensionAttributes($extensionAttributes); + $this->setData(self::STOCK_ID, $stockId); } } diff --git a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php b/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php deleted file mode 100644 index aeef0ebd6097f..0000000000000 --- a/app/code/Magento/Inventory/Model/SourceStockLinkRepository.php +++ /dev/null @@ -1,67 +0,0 @@ -sourceStockLinkResource = $sourceStockLinkResource; - $this->logger = $logger; - } - - /** - * @inheritdoc - */ - public function save(SourceStockLinkInterface $sourceStockLink) - { - try { - $this->sourceStockLinkResource->save($sourceStockLink); - } catch (\Exception $e) { - $this->logger->error($e->getMessage()); - throw new CouldNotSaveException(__('Could not save Source Stock Link'), $e); - } - } - - /** - * @inheritdoc - */ - public function delete(SourceStockLinkInterface $sourceStockLink) - { - try { - $this->sourceStockLinkResource->delete($sourceStockLink); - } catch (\Exception $e) { - $this->logger->error($e->getMessage()); - throw new CouldNotDeleteException(__('Could not delete Source Stock Link'), $e); - } - } -} diff --git a/app/code/Magento/Inventory/Model/Stock.php b/app/code/Magento/Inventory/Model/Stock.php index b89af5ec413d6..81aeba68b24d3 100644 --- a/app/code/Magento/Inventory/Model/Stock.php +++ b/app/code/Magento/Inventory/Model/Stock.php @@ -30,7 +30,7 @@ protected function _construct() */ public function getStockId() { - return $this->getData(StockInterface::STOCK_ID); + return $this->getData(self::STOCK_ID); } /** @@ -38,7 +38,7 @@ public function getStockId() */ public function setStockId($stockId) { - $this->setData(StockInterface::STOCK_ID, $stockId); + $this->setData(self::STOCK_ID, $stockId); } /** @@ -46,7 +46,7 @@ public function setStockId($stockId) */ public function getName() { - return $this->getData(StockInterface::NAME); + return $this->getData(self::NAME); } /** @@ -54,7 +54,7 @@ public function getName() */ public function setName($name) { - $this->setData(StockInterface::NAME, $name); + $this->setData(self::NAME, $name); } /** diff --git a/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php b/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php new file mode 100644 index 0000000000000..e8f0969b64b92 --- /dev/null +++ b/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php @@ -0,0 +1,97 @@ +collectionProcessor = $collectionProcessor; + $this->stockLinkCollectionFactory = $stockLinkCollectionFactory; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->sourceStockLinkResource = $sourceStockLinkResource; + $this->logger = $logger; + } + + /** + * @inheritdoc + */ + public function execute($stockId, $sourceId) + { + $searchCriteria = $this->searchCriteriaBuilder + ->addFilter(SourceStockLink::STOCK_ID, $stockId) + ->addFilter(SourceStockLink::SOURCE_ID, $sourceId) + ->create(); + + /** @var Collection $collection */ + $collection = $this->stockLinkCollectionFactory->create(); + $this->collectionProcessor->process($searchCriteria, $collection); + $items = $collection->getItems(); + + if (empty($items)) { + throw new CouldNotDeleteException( + __('Source Stock Link is missed (Stock id: %1, Source id: %2 )', $stockId, $sourceId) + ); + } + + try { + $sourceStockLink = reset($items); + $this->sourceStockLinkResource->delete($sourceStockLink); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + throw new CouldNotDeleteException(__('Could not delete Source Stock Link'), $e); + } + } +} From 1cac332bda65a95fb4f266d229db0a07fc5accd3 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 20 Jul 2017 12:40:12 +0300 Subject: [PATCH 0326/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../Inventory/Model/AssignSourcesToStock.php | 58 +++++-------------- .../ResourceModel/SourceItem/SaveMultiple.php | 5 +- .../Inventory/Model/SourceItemSave.php | 6 +- .../Model/UnassignSourceFromStock.php | 7 ++- .../Api/AssignSourcesToStockInterface.php | 5 +- .../Api/SourceItemSaveInterface.php | 1 + .../Api/UnassignSourceFromStockInterface.php | 2 + 7 files changed, 30 insertions(+), 54 deletions(-) diff --git a/app/code/Magento/Inventory/Model/AssignSourcesToStock.php b/app/code/Magento/Inventory/Model/AssignSourcesToStock.php index 5320288f8ec33..3f4d7f8872e99 100644 --- a/app/code/Magento/Inventory/Model/AssignSourcesToStock.php +++ b/app/code/Magento/Inventory/Model/AssignSourcesToStock.php @@ -5,24 +5,21 @@ */ namespace Magento\Inventory\Model; -use Magento\Framework\App\ResourceConnection; -use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\Exception\CouldNotSaveException; -use Magento\Inventory\Setup\InstallSchema; -use Magento\InventoryApi\Api\Command\AssignSourcesToStockInterface; -use Magento\InventoryApi\Api\Data\SourceStockLinkInterface; +use Magento\Framework\Exception\InputException; +use Magento\Inventory\Model\ResourceModel\SourceStockLink\SaveMultiple; +use Magento\InventoryApi\Api\AssignSourcesToStockInterface; use Psr\Log\LoggerInterface; - /** * @inheritdoc */ class AssignSourcesToStock implements AssignSourcesToStockInterface { /** - * @var ResourceConnection + * @var SaveMultiple */ - private $connection; + private $saveMultiple; /** * @var LoggerInterface @@ -30,59 +27,30 @@ class AssignSourcesToStock implements AssignSourcesToStockInterface private $logger; /** - * @param ResourceConnection $connection + * @param SaveMultiple $saveMultiple * @param LoggerInterface $logger */ public function __construct( - ResourceConnection $connection, + SaveMultiple $saveMultiple, LoggerInterface $logger ) { - $this->connection = $connection; + $this->saveMultiple = $saveMultiple; $this->logger = $logger; } /** * @inheritdoc */ - public function execute(array $sourceIds, $stockId) + public function execute($stockId, array $sourceIds) { - if (empty($sourceIds)) { - return; + if (0 === (int)$stockId || empty($sourceItems)) { + throw new InputException(__('Input data is invalid')); } - try { - $this->executeQuery($sourceIds, $stockId); + $this->saveMultiple->execute($sourceIds, $stockId); } catch (\Exception $e) { $this->logger->error($e->getMessage()); - throw new CouldNotSaveException(__('Could not save Source Item'), $e); + throw new CouldNotSaveException(__('Could not assign Sources to Stock'), $e); } } - - /** - * Assign the source ids a stock. - * - * @param int[] $sourceIds - * @param int $stockId - * - * @throws \Exception - * @return void - */ - private function executeQuery(array $sourceIds, $stockId) - { - /** @var AdapterInterface $connection */ - $connection = $this->connection->getConnection(); - $tableName = $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_STOCK_LINK); - - $columns = [ - SourceStockLinkInterface::SOURCE_ID, - SourceStockLinkInterface::STOCK_ID - ]; - - $data = []; - foreach ($sourceIds as $sourceId) { - $data[] = [$sourceId, $stockId]; - } - - $connection->insertArray($tableName, $columns, $data); - } } diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php index 3ef195f343bad..80ebaeae54f31 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php @@ -10,7 +10,7 @@ use Magento\InventoryApi\Api\Data\SourceItemInterface; /** - * Implementation of Source Item save multiple operation for specific db layer + * Implementation of SourceItem save multiple operation for specific db layer * Save Multiple used here for performance efficient purposes over single save operation */ class SaveMultiple @@ -39,9 +39,6 @@ public function __construct( */ public function execute(array $sourceItems) { - if (empty($sourceItems)) { - return; - } $connection = $this->connection->getConnection(); $tableName = $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_ITEM); diff --git a/app/code/Magento/Inventory/Model/SourceItemSave.php b/app/code/Magento/Inventory/Model/SourceItemSave.php index 960ab9fc60da1..ee647125219f2 100644 --- a/app/code/Magento/Inventory/Model/SourceItemSave.php +++ b/app/code/Magento/Inventory/Model/SourceItemSave.php @@ -6,6 +6,7 @@ namespace Magento\Inventory\Model; use Magento\Framework\Exception\CouldNotSaveException; +use Magento\Framework\Exception\InputException; use Magento\Inventory\Model\ResourceModel\SourceItem\SaveMultiple; use Magento\InventoryApi\Api\SourceItemSaveInterface; use Psr\Log\LoggerInterface; @@ -26,8 +27,6 @@ class SourceItemSave implements SourceItemSaveInterface private $logger; /** - * SourceItemSaveMultiple constructor - * * @param SaveMultiple $saveMultiple * @param LoggerInterface $logger */ @@ -44,6 +43,9 @@ public function __construct( */ public function execute(array $sourceItems) { + if (empty($sourceItems)) { + throw new InputException(__('Input data is empty')); + } try { $this->saveMultiple->execute($sourceItems); } catch (\Exception $e) { diff --git a/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php b/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php index e8f0969b64b92..f7859f5f92a39 100644 --- a/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php +++ b/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php @@ -8,6 +8,7 @@ use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Exception\CouldNotDeleteException; +use Magento\Framework\Exception\InputException; use Magento\Inventory\Model\ResourceModel\SourceStockLink as SourceStockLinkResourceModel; use Magento\Inventory\Model\ResourceModel\SourceStockLink\Collection; use Magento\Inventory\Model\ResourceModel\SourceStockLink\CollectionFactory; @@ -70,8 +71,12 @@ public function __construct( */ public function execute($stockId, $sourceId) { + if (0 === (int)$stockId || 0 === (int)$sourceId) { + throw new InputException(__('Input data is invalid')); + } + $searchCriteria = $this->searchCriteriaBuilder - ->addFilter(SourceStockLink::STOCK_ID, $stockId) + ->addFilter(SourceStockLink::STOCK_ID, (int)$stockId) ->addFilter(SourceStockLink::SOURCE_ID, $sourceId) ->create(); diff --git a/app/code/Magento/InventoryApi/Api/AssignSourcesToStockInterface.php b/app/code/Magento/InventoryApi/Api/AssignSourcesToStockInterface.php index adb29d9fe52a3..44620c6016c3e 100644 --- a/app/code/Magento/InventoryApi/Api/AssignSourcesToStockInterface.php +++ b/app/code/Magento/InventoryApi/Api/AssignSourcesToStockInterface.php @@ -17,10 +17,11 @@ interface AssignSourcesToStockInterface /** * Assign source id list by stock id * - * @param int[] $sourceIds * @param int $stockId + * @param int[] $sourceIds * @return void + * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\CouldNotSaveException */ - public function execute(array $sourceIds, $stockId); + public function execute($stockId, array $sourceIds); } diff --git a/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php b/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php index b58e758722796..6b3a2347f2920 100644 --- a/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceItemSaveInterface.php @@ -20,6 +20,7 @@ interface SourceItemSaveInterface * * @param \Magento\InventoryApi\Api\Data\SourceItemInterface[] $sourceItems * @return void + * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\CouldNotSaveException */ public function execute(array $sourceItems); diff --git a/app/code/Magento/InventoryApi/Api/UnassignSourceFromStockInterface.php b/app/code/Magento/InventoryApi/Api/UnassignSourceFromStockInterface.php index 21181401b9d61..c8bcb0309daad 100644 --- a/app/code/Magento/InventoryApi/Api/UnassignSourceFromStockInterface.php +++ b/app/code/Magento/InventoryApi/Api/UnassignSourceFromStockInterface.php @@ -18,6 +18,8 @@ interface UnassignSourceFromStockInterface * @param int $stockId * @param int $sourceId * @return void + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\CouldNotDeleteException */ public function execute($stockId, $sourceId); } From f9b3c179608212f159d8a3f56f9400049e072efa Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 20 Jul 2017 13:05:31 +0300 Subject: [PATCH 0327/1004] magento/magento2#10089: Add fulltext/keyword search field for product admin grid - Code style fixes --- .../Product/AddFulltextFilterToCollection.php | 13 +++++++------ .../view/adminhtml/ui_component/product_listing.xml | 6 ++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php b/app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php index 4ef74892080ce..1b05152903aa9 100644 --- a/app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php +++ b/app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php @@ -1,5 +1,8 @@ + From 9a9a9089886ffd28848332e8ca0e180d87cd7e7d Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 20 Jul 2017 13:47:54 +0300 Subject: [PATCH 0328/1004] magento/magento2#10089: Add fulltext/keyword search field for product admin grid - Declared introduced dependency on the module Ui --- app/code/Magento/CatalogSearch/composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json index c02c3034af524..0e328014da0d8 100644 --- a/app/code/Magento/CatalogSearch/composer.json +++ b/app/code/Magento/CatalogSearch/composer.json @@ -11,6 +11,7 @@ "magento/module-eav": "100.2.*", "magento/module-backend": "100.2.*", "magento/module-theme": "100.2.*", + "magento/module-ui": "100.2.*", "magento/module-catalog-inventory": "100.2.*", "magento/framework": "100.2.*" }, From 19122b669185ab533bcf842dfed9d533a58d3aa9 Mon Sep 17 00:00:00 2001 From: Maksym Aposov Date: Thu, 20 Jul 2017 14:13:14 +0300 Subject: [PATCH 0329/1004] MAGETWO-70878: Category position does not save --- .../templates/catalog/category/tree.phtml | 4 +- .../Test/Block/Adminhtml/Category/Tree.php | 2 +- .../AdvancedMoveCategoryEntityTest.php | 156 ++++++++++++++++++ .../AdvancedMoveCategoryEntityTest.xml | 18 ++ 4 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/AdvancedMoveCategoryEntityTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/AdvancedMoveCategoryEntityTest.xml diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml index a3cf4b478ad3b..9865589556e7b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/tree.phtml @@ -59,6 +59,8 @@ } }; + var treeRoot = '#tree-div'; + /** * Fix ext compatibility with prototype 1.6 */ @@ -491,7 +493,7 @@ if (data.error) { reRenderTree(); } else { - $(obj.tree.container.dom).trigger('categoryMove.tree'); + $(treeRoot).trigger('categoryMove.tree'); } $('.page-main-actions').next('.messages').remove(); $('.page-main-actions').next('#messages').remove(); diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php index 978564e482a51..2035e7e83200f 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Category/Tree.php @@ -169,7 +169,7 @@ public function isCategoryVisible(Category $category) */ public function assignCategory($parentCategoryName, $childCategoryName) { - $this->_rootElement->find(sprintf($this->categoryInTree, $childCategoryName), Locator::SELECTOR_XPATH)->click(); + $this->_rootElement->find(sprintf($this->categoryInTree, $childCategoryName), Locator::SELECTOR_XPATH)->hover(); $this->getTemplateBlock()->waitLoader(); $targetElement = $this->_rootElement->find( sprintf($this->categoryInTree, $parentCategoryName), diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/AdvancedMoveCategoryEntityTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/AdvancedMoveCategoryEntityTest.php new file mode 100644 index 0000000000000..95f6a124b8abc --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/AdvancedMoveCategoryEntityTest.php @@ -0,0 +1,156 @@ +Categories + * 3. Select SubCategory + * 4. Drag'n'Drop SubCategory + * 5. Dismiss alert + * 6. Drag'n'Drop SubCategory + * 7. Accept alert + * 8. Save category + * 9. Verify category + * + * @group Category_Management + * @ZephyrId MAGETWO-27319 + */ +class AdvancedMoveCategoryEntityTest extends Injectable +{ + /* tags */ + const MVP = 'no'; + /* end tags */ + + /** + * CatalogCategoryIndex page. + * + * @var CatalogCategoryIndex + */ + private $catalogCategoryIndex; + + /** + * CatalogCategoryEdit page. + * + * @var CatalogCategoryEdit + */ + private $catalogCategoryEdit; + + /** + * Factory for fixtures. + * + * @var FixtureFactory + */ + private $fixtureFactory; + + /** + * Inject page end prepare default category. + * + * @param CatalogCategoryIndex $catalogCategoryIndex + * @param CatalogCategoryEdit $catalogCategoryEdit + * @param FixtureFactory $fixtureFactory + * @return void + */ + public function __inject( + CatalogCategoryIndex $catalogCategoryIndex, + CatalogCategoryEdit $catalogCategoryEdit, + FixtureFactory $fixtureFactory + ) { + $this->catalogCategoryIndex = $catalogCategoryIndex; + $this->catalogCategoryEdit = $catalogCategoryEdit; + $this->fixtureFactory = $fixtureFactory; + } + + /** + * Runs test. + * + * @param Category $childCategory + * @param Category $parentCategory + * @param int|null $moveLevel + * @return array + */ + public function test( + Category $childCategory, + Category $parentCategory, + $moveLevel = null + ) { + // Preconditions: + $parentCategory->persist(); + $childCategory->persist(); + $resultCategory = $childCategory; + + if (!empty($moveLevel)) { + for ($nestingIterator = 1; $nestingIterator < $moveLevel; $nestingIterator++) { + $childCategory = $childCategory->getDataFieldConfig('parent_id')['source']->getParentCategory(); + } + $resultCategory = $this->getMovedCategoryTree($resultCategory, $parentCategory, $childCategory); + } + + // Steps: + $this->catalogCategoryIndex->open(); + $this->catalogCategoryIndex->getTreeCategories()->expandAllCategories(); + $this->catalogCategoryIndex->getTreeCategories()->selectCategory($childCategory); + $this->catalogCategoryIndex->getTreeCategories()->assignCategory( + $parentCategory->getName(), + $childCategory->getName() + ); + $this->catalogCategoryEdit->getModalBlock()->dismissWarning(); + + $this->catalogCategoryIndex->getTreeCategories()->assignCategory( + $parentCategory->getName(), + $childCategory->getName() + ); + $this->catalogCategoryEdit->getModalBlock()->acceptWarning(); + $this->catalogCategoryEdit->getFormPageActions()->save(); + + return [ + 'category' => $resultCategory, + 'parentCategory' => $parentCategory, + 'childCategory' => $childCategory, + ]; + } + + /** + * Get moved category tree. + * + * @param Category $movedCategory + * @param Category $parentCategory + * @param Category $childCategory + * @return Category + */ + public function getMovedCategoryTree(Category $movedCategory, Category $parentCategory, Category $childCategory) + { + $bottomChildCategory = []; + while ($movedCategory->getName() != $childCategory->getName()) { + $bottomChildCategory[] = $movedCategory->getData(); + $movedCategory = $movedCategory->getDataFieldConfig('parent_id')['source']->getParentCategory(); + } + $bottomChildCategory[] = $movedCategory->getData(); + + $newCategory = $parentCategory; + for ($i = count($bottomChildCategory) - 1; $i >= 0; $i--) { + unset($bottomChildCategory[$i]['parent_id']); + $bottomChildCategory[$i]['parent_id']['source'] = $newCategory; + $newCategory = $this->fixtureFactory->createByCode( + 'category', + ['data' => $bottomChildCategory[$i]] + ); + } + + return $newCategory; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/AdvancedMoveCategoryEntityTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/AdvancedMoveCategoryEntityTest.xml new file mode 100644 index 0000000000000..96a9d91a8e5f3 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Category/AdvancedMoveCategoryEntityTest.xml @@ -0,0 +1,18 @@ + + + + + + three_nested_categories + default + 1 + + + + + From d866ad80ccc591646a75537054bca8d0b5f9d2ba Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 20 Jul 2017 14:22:09 +0300 Subject: [PATCH 0330/1004] magento/magento2#3401: Decouple product view gallery images config from Gallery Block - Code style fixes --- .../Catalog/Block/Product/View/Gallery.php | 23 ++++++++++--------- .../Product/Gallery/ImagesConfigFactory.php | 16 ++++--------- .../Gallery/ImagesConfigFactoryInterface.php | 5 ++-- .../Block/Product/View/Gallery.php | 16 ++++++------- 4 files changed, 26 insertions(+), 34 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index f3b58d212c7c7..812b8235712c6 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -19,7 +19,6 @@ use Magento\Framework\DataObject; use Magento\Framework\App\ObjectManager; use Magento\Framework\Json\EncoderInterface; -use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\Stdlib\ArrayUtils; /** @@ -38,9 +37,9 @@ class Gallery extends AbstractView protected $jsonEncoder; /** - * @var DataObject + * @var array */ - protected $galleryImagesConfig; + private $galleryImagesConfig; /** * @var ImagesConfigFactoryInterface @@ -48,12 +47,12 @@ class Gallery extends AbstractView private $galleryImagesConfigFactory; /** - * @param Context $context - * @param ArrayUtils $arrayUtils - * @param EncoderInterface $jsonEncoder + * @param Context $context + * @param ArrayUtils $arrayUtils + * @param EncoderInterface $jsonEncoder + * @param array $data * @param ImagesConfigFactoryInterface $imagesConfigFactory - * @param array $galleryImagesConfig - * @param array $data + * @param array $galleryImagesConfig */ public function __construct( Context $context, @@ -64,8 +63,9 @@ public function __construct( array $galleryImagesConfig = [] ) { parent::__construct($context, $arrayUtils, $data); - $this->jsonEncoder = $jsonEncoder ?: ObjectManager::getInstance()->get(Json::class); - $this->galleryImagesConfigFactory = $imagesConfigFactory ?: ObjectManager::getInstance()->get(ImagesConfigFactoryInterface::class); + $this->jsonEncoder = $jsonEncoder; + $this->galleryImagesConfigFactory = $imagesConfigFactory ?: ObjectManager::getInstance() + ->get(ImagesConfigFactoryInterface::class); $this->galleryImagesConfig = $galleryImagesConfig; } @@ -211,7 +211,8 @@ private function getConfigView() private function getGalleryImagesConfig() { if (false === $this->hasData('gallery_images_config')) { - $this->setData('gallery_images_config', $this->galleryImagesConfigFactory->create($this->galleryImagesConfig)); + $galleryImageConfig = $this->galleryImagesConfigFactory->create($this->galleryImagesConfig); + $this->setData('gallery_images_config', $galleryImageConfig); } return $this->getData('gallery_images_config'); diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php index 80fa53d8ae04d..1653f29be119b 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php @@ -1,24 +1,21 @@ mediaHelper = $mediaHelper; } From c910b9ba7350b7f25b4229a92e155d2e237c95cc Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Thu, 20 Jul 2017 17:20:17 +0300 Subject: [PATCH 0331/1004] magento/magento2#3401: decouple product view gallery images config from Gallery Block - Code Style improvements --- .../Catalog/Block/Product/View/Gallery.php | 27 ++++++++++--------- .../Product/Gallery/ImagesConfigFactory.php | 2 +- .../Unit/Block/Product/View/GalleryTest.php | 9 +++++-- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Catalog/Block/Product/View/Gallery.php b/app/code/Magento/Catalog/Block/Product/View/Gallery.php index 812b8235712c6..35b2d487623fb 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -78,18 +78,19 @@ public function getGalleryImages() { $product = $this->getProduct(); $images = $product->getMediaGalleryImages(); - if ($images instanceof \Magento\Framework\Data\Collection) { - foreach ($images as $image) { - foreach($this->getGalleryImagesConfig()->getItems() as $imageConfig) { - /** @var Product $product */ - $image->setData( - $imageConfig->getData('data_object_key'), - $this->_imageHelper->init($product, - $imageConfig['image_id']) - ->setImageFile($image->getData('file')) - ->getUrl() - ); - } + if (!$images instanceof \Magento\Framework\Data\Collection) { + return $images; + } + + foreach ($images as $image) { + $galleryImagesConfig = $this->getGalleryImagesConfig()->getItems(); + foreach ($galleryImagesConfig as $imageConfig) { + $image->setData( + $imageConfig->getData('data_object_key'), + $this->_imageHelper->init($product, $imageConfig['image_id']) + ->setImageFile($image->getData('file')) + ->getUrl() + ); } } @@ -131,7 +132,7 @@ public function getGalleryImagesJson() 'position' => $image->getData('position'), 'isMain' => $this->isMainImage($image), ]); - foreach($this->getGalleryImagesConfig()->getItems() as $imageConfig) { + foreach ($this->getGalleryImagesConfig()->getItems() as $imageConfig) { $imageItem->setData( $imageConfig->getData('json_object_key'), $image->getData($imageConfig->getData('data_object_key')) diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php index 1653f29be119b..9d4dd0c29460d 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php @@ -30,7 +30,7 @@ public function create(array $imagesConfig, array $data = []) { /** @var \Magento\Framework\Data\Collection $collection */ $collection = $this->dataCollectionFactory->create($data); - array_map(function($imageConfig) use ($collection) { + array_map(function ($imageConfig) use ($collection) { $collection->addItem(new DataObject($imageConfig)); }, $imagesConfig); diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php index 29560fead4f48..da31db20932cc 100644 --- a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Catalog\Test\Unit\Block\Product\View; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class GalleryTest extends \PHPUnit_Framework_TestCase { /** @@ -65,6 +68,7 @@ protected function setUp() $this->context, $this->arrayUtils, $this->jsonEncoderMock, + [], $this->imagesConfigFactoryMock ); } @@ -179,7 +183,7 @@ private function getImagesCollection() */ private function getImagesConfigFactory() { - $this->galleryImagesConfigMock = $this->getMockBuilder('\Magento\Framework\Data\Collection') + $this->galleryImagesConfigMock = $this->getMockBuilder(\Magento\Framework\Data\Collection::class) ->disableOriginalConstructor() ->getMock(); @@ -187,7 +191,8 @@ private function getImagesConfigFactory() ->method('getIterator') ->willReturn(new \ArrayIterator($this->getGalleryImagesConfigItems())); - $galleryImagesConfigFactoryMock = $this->getMockBuilder('Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface') + $galleryImagesConfigFactoryMock = $this + ->getMockBuilder(\Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface::class) ->disableOriginalConstructor() ->getMock(); From 5b9888b5d5411d55e1057db303d06eb5fd65840f Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 21 Jul 2017 12:42:25 +0300 Subject: [PATCH 0332/1004] MAGETWO-70883: Prevent change log entry when nothing has changed #4893 - Coding Style fixes --- app/etc/di.xml | 7 +++++++ .../Magento/Framework/Mview/View/Subscription.php | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/etc/di.xml b/app/etc/di.xml index cc7d10e56bb0e..8d26169307a5f 100755 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -1330,4 +1330,11 @@ Magento\Config\App\Config\Source\EnvironmentConfigSource + + + + updated_at + + + diff --git a/lib/internal/Magento/Framework/Mview/View/Subscription.php b/lib/internal/Magento/Framework/Mview/View/Subscription.php index b443389495872..11c0ad2e37aeb 100644 --- a/lib/internal/Magento/Framework/Mview/View/Subscription.php +++ b/lib/internal/Magento/Framework/Mview/View/Subscription.php @@ -10,6 +10,7 @@ use Magento\Framework\App\ResourceConnection; use Magento\Framework\DB\Ddl\Trigger; +use Magento\Framework\Mview\View\StateInterface; class Subscription implements SubscriptionInterface { @@ -58,7 +59,7 @@ class Subscription implements SubscriptionInterface * * @var array */ - protected $ignoredUpdateColumns = ['updated_at']; + private $ignoredUpdateColumns = []; /** * @var Resource @@ -72,6 +73,7 @@ class Subscription implements SubscriptionInterface * @param \Magento\Framework\Mview\ViewInterface $view * @param string $tableName * @param string $columnName + * @param array $ignoredUpdateColumns */ public function __construct( ResourceConnection $resource, @@ -79,7 +81,8 @@ public function __construct( \Magento\Framework\Mview\View\CollectionInterface $viewCollection, \Magento\Framework\Mview\ViewInterface $view, $tableName, - $columnName + $columnName, + $ignoredUpdateColumns = [] ) { $this->connection = $resource->getConnection(); $this->triggerFactory = $triggerFactory; @@ -88,6 +91,7 @@ public function __construct( $this->tableName = $tableName; $this->columnName = $columnName; $this->resource = $resource; + $this->ignoredUpdateColumns = $ignoredUpdateColumns; } /** @@ -162,7 +166,7 @@ public function remove() protected function getLinkedViews() { if (!$this->linkedViews) { - $viewList = $this->viewCollection->getViewsByStateMode(\Magento\Framework\Mview\View\StateInterface::MODE_ENABLED); + $viewList = $this->viewCollection->getViewsByStateMode(StateInterface::MODE_ENABLED); foreach ($viewList as $view) { /** @var \Magento\Framework\Mview\ViewInterface $view */ From 2e5557451bd2676c4f069d4dd1bc533641952be4 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 21 Jul 2017 13:16:52 +0300 Subject: [PATCH 0333/1004] MAGETWO-70915: decouple product view gallery images config from Gallery Block #3401 - Coding Style fixes --- .../Catalog/Model/Product/Gallery/ImagesConfigFactory.php | 2 +- .../Model/Product/Gallery/ImagesConfigFactoryInterface.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php index 9d4dd0c29460d..d2416a1edab05 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactory.php @@ -13,7 +13,7 @@ class ImagesConfigFactory implements ImagesConfigFactoryInterface /** * @var CollectionFactory */ - protected $dataCollectionFactory; + private $dataCollectionFactory; /** * @param CollectionFactory $dataCollectionFactory diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactoryInterface.php b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactoryInterface.php index d8587e0857e56..7a656951f8b56 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactoryInterface.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/ImagesConfigFactoryInterface.php @@ -12,7 +12,6 @@ interface ImagesConfigFactoryInterface * * @param array $imagesConfig * @param array $data - * * @return \Magento\Framework\Data\Collection */ public function create(array $imagesConfig, array $data = []); From aa9eb0895831b0b049b1cd1e388a4e5ffe80bf65 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 21 Jul 2017 18:19:56 +0300 Subject: [PATCH 0334/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../Controller/Adminhtml/Stock/Save.php | 17 ++- .../Stock/StockSourceLinkProcessor.php | 108 ++++++++++++++++++ .../Inventory/Model/AssignSourcesToStock.php | 6 +- .../Model/GetAssignedSourcesForStock.php | 58 ++++++++-- .../SourceStockLink/Collection.php | 26 ----- ...ourceStockLink.php => StockSourceLink.php} | 4 +- .../StockSourceLink/Collection.php | 25 ++++ .../StockSourceLink/SaveMultiple.php | 58 ++++++++++ ...ourceStockLink.php => StockSourceLink.php} | 6 +- .../Model/UnassignSourceFromStock.php | 24 ++-- .../Observer/SourceItemsProcessor.php | 4 +- .../Ui/DataProvider/StockDataProvider.php | 31 +++++ app/code/Magento/Inventory/etc/di.xml | 9 +- .../ui_component/inventory_stock_form.xml | 26 ----- .../GetAssignedSourcesForStockInterface.php | 2 + 15 files changed, 316 insertions(+), 88 deletions(-) create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php delete mode 100644 app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php rename app/code/Magento/Inventory/Model/ResourceModel/{SourceStockLink.php => StockSourceLink.php} (77%) create mode 100644 app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/Collection.php create mode 100644 app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/SaveMultiple.php rename app/code/Magento/Inventory/Model/{SourceStockLink.php => StockSourceLink.php} (87%) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php index 399cb9d8966c0..35a4ce69f9b5d 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php @@ -41,22 +41,30 @@ class Save extends Action */ private $dataObjectHelper; + /** + * @var StockSourceLinkProcessor + */ + private $stockSourceLinkProcessor; + /** * @param Context $context * @param StockInterfaceFactory $stockFactory * @param StockRepositoryInterface $stockRepository * @param DataObjectHelper $dataObjectHelper + * @param StockSourceLinkProcessor $stockSourceLinkProcessor */ public function __construct( Context $context, StockInterfaceFactory $stockFactory, StockRepositoryInterface $stockRepository, - DataObjectHelper $dataObjectHelper + DataObjectHelper $dataObjectHelper, + StockSourceLinkProcessor $stockSourceLinkProcessor ) { parent::__construct($context); $this->stockFactory = $stockFactory; $this->stockRepository = $stockRepository; $this->dataObjectHelper = $dataObjectHelper; + $this->stockSourceLinkProcessor = $stockSourceLinkProcessor; } /** @@ -109,8 +117,13 @@ private function processSave($stockId, array $requestData) $stock = $this->stockFactory->create(); } $this->dataObjectHelper->populateWithArray($stock, $requestData['general'], StockInterface::class); - $stockId = $this->stockRepository->save($stock); + + $assignedSources = + isset($requestData['sources']['assigned_sources']) && is_array($requestData['sources']['assigned_sources']) + ? $requestData['sources']['assigned_sources'] + : []; + $this->stockSourceLinkProcessor->process($stockId, $assignedSources); return $stockId; } diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php new file mode 100644 index 0000000000000..c89d55b233724 --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php @@ -0,0 +1,108 @@ +searchCriteriaBuilder = $searchCriteriaBuilder; + $this->stockSourceLinkFactory = $stockSourceLinkFactory; + $this->getAssignedSourcesForStock = $getAssignedSourcesForStock; + $this->assignSourcesToStock = $assignSourcesToStock; + $this->unassignSourceFromStock = $unassignSourceFromStock; + } + + /** + * @param string $stockId + * @param array $stockSourceLinksData + * @return void + * @throws InputException + */ + public function process($stockId, array $stockSourceLinksData) + { + $assignedSources = $this->getAssignedSourcesForStock->execute($stockId); + $sourceIdsForSave = array_column($stockSourceLinksData, StockSourceLink::SOURCE_ID); + $sourceIdsForDelete = []; + + foreach ($assignedSources as $assignedSource) { + if (in_array($assignedSource->getSourceId(), $sourceIdsForSave)) { + unset($sourceIdsForSave[$assignedSource->getSourceId()]); + } else { + $sourceIdsForDelete[] = $assignedSource->getSourceId(); + } + } + + if (!empty($sourceIdsForSave)) { + $this->assignSourcesToStock->execute($stockId, $sourceIdsForSave); + } + foreach ($sourceIdsForDelete as $sourceIdForDelete) { + $this->unassignSourceFromStock->execute($stockId, $sourceIdForDelete); + } + } + + /** + * TODO: + * @param array $stockSourceLinkData + * @return void + * @throws InputException + */ + private function validateStockSourceData(array $stockSourceLinkData) + { + if (!isset($stockSourceLinkData[StockSourceLink::SOURCE_ID])) { + throw new InputException(__('Wrong Stock to Source relation parameters given.')); + } + } +} diff --git a/app/code/Magento/Inventory/Model/AssignSourcesToStock.php b/app/code/Magento/Inventory/Model/AssignSourcesToStock.php index 3f4d7f8872e99..ff8a331171eff 100644 --- a/app/code/Magento/Inventory/Model/AssignSourcesToStock.php +++ b/app/code/Magento/Inventory/Model/AssignSourcesToStock.php @@ -7,7 +7,7 @@ use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\InputException; -use Magento\Inventory\Model\ResourceModel\SourceStockLink\SaveMultiple; +use Magento\Inventory\Model\ResourceModel\StockSourceLink\SaveMultiple; use Magento\InventoryApi\Api\AssignSourcesToStockInterface; use Psr\Log\LoggerInterface; @@ -43,11 +43,11 @@ public function __construct( */ public function execute($stockId, array $sourceIds) { - if (0 === (int)$stockId || empty($sourceItems)) { + if (0 === (int)$stockId || empty($sourceIds)) { throw new InputException(__('Input data is invalid')); } try { - $this->saveMultiple->execute($sourceIds, $stockId); + $this->saveMultiple->execute($stockId, $sourceIds); } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotSaveException(__('Could not assign Sources to Stock'), $e); diff --git a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php index cd660c9a54ea3..5d7274f18d760 100644 --- a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php +++ b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php @@ -7,10 +7,14 @@ use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaBuilder; -use Magento\Inventory\Model\ResourceModel\SourceStockLink\Collection; -use Magento\Inventory\Model\ResourceModel\SourceStockLink\CollectionFactory; -use Magento\InventoryApi\Api\Data\StockInterface; +use Magento\Framework\Exception\InputException; +use Magento\Framework\Exception\LocalizedException; +use Magento\Inventory\Model\ResourceModel\StockSourceLink\Collection; +use Magento\Inventory\Model\ResourceModel\StockSourceLink\CollectionFactory; +use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\GetAssignedSourcesForStockInterface; +use Magento\InventoryApi\Api\SourceRepositoryInterface; +use Psr\Log\LoggerInterface; /** * @inheritdoc @@ -32,33 +36,73 @@ class GetAssignedSourcesForStock implements GetAssignedSourcesForStockInterface */ private $searchCriteriaBuilder; + /** + * @var SourceRepositoryInterface + */ + private $sourceRepository; + + /** + * @var LoggerInterface + */ + private $logger; + /** * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $stockLinkCollectionFactory * @param SearchCriteriaBuilder $searchCriteriaBuilder + * @param SourceRepositoryInterface $sourceRepository + * @param LoggerInterface $logger */ public function __construct( CollectionProcessorInterface $collectionProcessor, CollectionFactory $stockLinkCollectionFactory, - SearchCriteriaBuilder $searchCriteriaBuilder + SearchCriteriaBuilder $searchCriteriaBuilder, + SourceRepositoryInterface $sourceRepository, + LoggerInterface $logger ) { $this->collectionProcessor = $collectionProcessor; $this->stockLinkCollectionFactory = $stockLinkCollectionFactory; $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->sourceRepository = $sourceRepository; + $this->logger = $logger; } /** * @inheritdoc */ public function execute($stockId) + { + if (0 === (int)$stockId) { + throw new InputException(__('Input data is empty')); + } + try { + $sourceIds = $this->getSourceIds($stockId); + + $searchCriteria = $this->searchCriteriaBuilder + ->addFilter(SourceInterface::SOURCE_ID, $sourceIds, 'in') + ->create(); + $searchResult = $this->sourceRepository->getList($searchCriteria); + return $searchResult->getItems(); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + // TODO: + throw new LocalizedException(__('Could not load Sources for Stock'), $e); + } + } + + /** + * @param $stockId + * @return \Magento\Framework\DataObject[] + */ + private function getSourceIds($stockId) { $searchCriteria = $this->searchCriteriaBuilder - ->addFilter(StockInterface::STOCK_ID, $stockId) + ->addFilter(StockSourceLink::STOCK_ID, (int)$stockId) ->create(); - /** @var Collection $collection */ $collection = $this->stockLinkCollectionFactory->create(); $this->collectionProcessor->process($searchCriteria, $collection); - return $collection->getItems(); + $data = $collection->getData(); + return $data ? array_column($data, 'source_id') : []; } } diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php deleted file mode 100644 index 0e73095f4bcb3..0000000000000 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink/Collection.php +++ /dev/null @@ -1,26 +0,0 @@ -_init(SourceStockLinkModel::class, SourceStockLinkResourceModel::class); - } -} diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink.php similarity index 77% rename from app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php rename to app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink.php index 8bee6c6b06a3b..2b228b260fe5b 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceStockLink.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink.php @@ -11,13 +11,13 @@ /** * Implementation of basic operations for SourceCarrierLink entity for specific db layer */ -class SourceStockLink extends AbstractDb +class StockSourceLink extends AbstractDb { /** * @inheritdoc */ protected function _construct() { - $this->_init(InstallSchema::TABLE_NAME_SOURCE_STOCK_LINK, 'link_id'); + $this->_init(InstallSchema::TABLE_NAME_STOCK_SOURCE_LINK, 'link_id'); // TODO } } diff --git a/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/Collection.php b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/Collection.php new file mode 100644 index 0000000000000..d2f7d79544442 --- /dev/null +++ b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/Collection.php @@ -0,0 +1,25 @@ +_init(StockSourceLinkModel::class, StockSourceLinkResourceModel::class); + } +} diff --git a/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/SaveMultiple.php b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/SaveMultiple.php new file mode 100644 index 0000000000000..12d48557fa9fc --- /dev/null +++ b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/SaveMultiple.php @@ -0,0 +1,58 @@ +connection = $connection; + } + + /** + * AssignSourcesToStock TODO + * + * @param int $stockId + * @param array $sourceIds + * @return void + */ + public function execute($stockId, array $sourceIds) + { + $connection = $this->connection->getConnection(); + $tableName = $connection->getTableName(InstallSchema::TABLE_NAME_STOCK_SOURCE_LINK); + + $columns = [ + StockSourceLink::SOURCE_ID, + StockSourceLink::STOCK_ID, + ]; + + $data = []; + foreach ($sourceIds as $sourceId) { + $data[] = [$sourceId, $stockId]; + } + + $connection->insertArray($tableName, $columns, $data); + } +} diff --git a/app/code/Magento/Inventory/Model/SourceStockLink.php b/app/code/Magento/Inventory/Model/StockSourceLink.php similarity index 87% rename from app/code/Magento/Inventory/Model/SourceStockLink.php rename to app/code/Magento/Inventory/Model/StockSourceLink.php index 6f9af7ddbf066..0bd0347bd4616 100644 --- a/app/code/Magento/Inventory/Model/SourceStockLink.php +++ b/app/code/Magento/Inventory/Model/StockSourceLink.php @@ -6,14 +6,14 @@ namespace Magento\Inventory\Model; use Magento\Framework\Model\AbstractModel; -use Magento\Inventory\Model\ResourceModel\SourceStockLink as SourceStockLinkResourceModel; +use Magento\Inventory\Model\ResourceModel\StockSourceLink as StockSourceLinkResourceModel; /** * Doesn't have API interface because this object is need only for internal module using * * @codeCoverageIgnore */ -class SourceStockLink extends AbstractModel +class StockSourceLink extends AbstractModel { /**#@+ * Constants for keys of data array. Identical to the name of the getter in snake case @@ -28,7 +28,7 @@ class SourceStockLink extends AbstractModel */ protected function _construct() { - $this->_init(SourceStockLinkResourceModel::class); + $this->_init(StockSourceLinkResourceModel::class); } /** diff --git a/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php b/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php index f7859f5f92a39..8f8f41df5ff5f 100644 --- a/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php +++ b/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php @@ -9,9 +9,9 @@ use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Exception\CouldNotDeleteException; use Magento\Framework\Exception\InputException; -use Magento\Inventory\Model\ResourceModel\SourceStockLink as SourceStockLinkResourceModel; -use Magento\Inventory\Model\ResourceModel\SourceStockLink\Collection; -use Magento\Inventory\Model\ResourceModel\SourceStockLink\CollectionFactory; +use Magento\Inventory\Model\ResourceModel\StockSourceLink as StockSourceLinkResourceModel; +use Magento\Inventory\Model\ResourceModel\StockSourceLink\Collection; +use Magento\Inventory\Model\ResourceModel\StockSourceLink\CollectionFactory; use Magento\InventoryApi\Api\UnassignSourceFromStockInterface; use Psr\Log\LoggerInterface; @@ -36,9 +36,9 @@ class UnassignSourceFromStock implements UnassignSourceFromStockInterface private $searchCriteriaBuilder; /** - * @var SourceStockLinkResourceModel + * @var StockSourceLinkResourceModel */ - private $sourceStockLinkResource; + private $stockSourceLinkResource; /** * @var LoggerInterface @@ -49,20 +49,20 @@ class UnassignSourceFromStock implements UnassignSourceFromStockInterface * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $stockLinkCollectionFactory * @param SearchCriteriaBuilder $searchCriteriaBuilder - * @param SourceStockLinkResourceModel $sourceStockLinkResource + * @param StockSourceLinkResourceModel $stockSourceLinkResource * @param LoggerInterface $logger */ public function __construct( CollectionProcessorInterface $collectionProcessor, CollectionFactory $stockLinkCollectionFactory, SearchCriteriaBuilder $searchCriteriaBuilder, - SourceStockLinkResourceModel $sourceStockLinkResource, + StockSourceLinkResourceModel $stockSourceLinkResource, LoggerInterface $logger ) { $this->collectionProcessor = $collectionProcessor; $this->stockLinkCollectionFactory = $stockLinkCollectionFactory; $this->searchCriteriaBuilder = $searchCriteriaBuilder; - $this->sourceStockLinkResource = $sourceStockLinkResource; + $this->stockSourceLinkResource = $stockSourceLinkResource; $this->logger = $logger; } @@ -76,8 +76,8 @@ public function execute($stockId, $sourceId) } $searchCriteria = $this->searchCriteriaBuilder - ->addFilter(SourceStockLink::STOCK_ID, (int)$stockId) - ->addFilter(SourceStockLink::SOURCE_ID, $sourceId) + ->addFilter(StockSourceLink::STOCK_ID, (int)$stockId) + ->addFilter(StockSourceLink::SOURCE_ID, $sourceId) ->create(); /** @var Collection $collection */ @@ -92,8 +92,8 @@ public function execute($stockId, $sourceId) } try { - $sourceStockLink = reset($items); - $this->sourceStockLinkResource->delete($sourceStockLink); + $stockSourceLink = reset($items); + $this->stockSourceLinkResource->delete($stockSourceLink); } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotDeleteException(__('Could not delete Source Stock Link'), $e); diff --git a/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php b/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php index d1c3307d6b7ed..585ead882799b 100644 --- a/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php +++ b/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php @@ -16,7 +16,7 @@ use Magento\InventoryApi\Api\SourceItemSaveInterface; /** - * At the time of processing Product save form this class used to save source item correctly + * At the time of processing Product save form this class used to save source items correctly * Perform replace strategy of sources for the product */ class SourceItemsProcessor @@ -87,7 +87,7 @@ public function process($sku, array $sourceItemsData) if (isset($sourceItemsForDelete[$sourceId])) { $sourceItem = $sourceItemsForDelete[$sourceId]; } else { - /** @var SourceItemInterface $relation */ + /** @var SourceItemInterface $sourceItem */ $sourceItem = $this->sourceItemFactory->create(); } diff --git a/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php index 4e3c10235c345..065cf10515ba2 100644 --- a/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php +++ b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php @@ -5,6 +5,8 @@ */ namespace Magento\Inventory\Ui\DataProvider; +use Magento\InventoryApi\Api\Data\SourceInterface; +use Magento\InventoryApi\Api\GetAssignedSourcesForStockInterface; use Magento\Ui\DataProvider\SearchResultFactory; use Magento\Framework\Api\FilterBuilder; use Magento\Framework\Api\Search\ReportingInterface; @@ -30,6 +32,11 @@ class StockDataProvider extends DataProvider */ private $searchResultFactory; + /** + * @var GetAssignedSourcesForStockInterface + */ + private $getAssignedSourcesForStock; + /** * @param string $name * @param string $primaryFieldName @@ -40,6 +47,7 @@ class StockDataProvider extends DataProvider * @param FilterBuilder $filterBuilder * @param StockRepositoryInterface $stockRepository * @param SearchResultFactory $searchResultFactory + * @param GetAssignedSourcesForStockInterface $getAssignedSourcesForStock * @param array $meta * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) All parameters are needed for backward compatibility @@ -54,6 +62,7 @@ public function __construct( FilterBuilder $filterBuilder, StockRepositoryInterface $stockRepository, SearchResultFactory $searchResultFactory, + GetAssignedSourcesForStockInterface $getAssignedSourcesForStock, array $meta = [], array $data = [] ) { @@ -70,6 +79,7 @@ public function __construct( ); $this->stockRepository = $stockRepository; $this->searchResultFactory = $searchResultFactory; + $this->getAssignedSourcesForStock = $getAssignedSourcesForStock; } /** @@ -86,6 +96,9 @@ public function getData() $stockGeneralData = $data['items'][0]; $dataForSingle[$stockId] = [ 'general' => $stockGeneralData, + 'sources' => [ + 'assigned_sources' => $this->getAssignedSourcesData($stockId), + ], ]; $data = $dataForSingle; } else { @@ -111,4 +124,22 @@ public function getSearchResult() ); return $searchResult; } + + /** + * @param int $stockId + * @return array + */ + private function getAssignedSourcesData($stockId) + { + $assignedSources = $this->getAssignedSourcesForStock->execute($stockId); + + $assignedSourcesData = []; + foreach ($assignedSources as $assignedSource) { + $assignedSourcesData[] = [ + SourceInterface::SOURCE_ID => $assignedSource->getSourceId(), + SourceInterface::NAME => $assignedSource->getName(), + ]; + } + return $assignedSourcesData; + } } diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index d344e9fcf8519..afbf0f91b9f62 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -11,11 +11,6 @@ - - - - - @@ -27,4 +22,8 @@ + + + + diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml index 26bde8c66d4a9..628863d70e343 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_stock_form.xml @@ -118,7 +118,6 @@ source_id name - qty source_id source_id @@ -164,31 +163,6 @@ - - - Magento\Inventory\Model\OptionSource\SourceItemStatus - - select - text - status - field - Status - ui/dynamic-rows/cells/text - - - - - - - input - text - quantity - field - Qty - ui/dynamic-rows/cells/text - - - diff --git a/app/code/Magento/InventoryApi/Api/GetAssignedSourcesForStockInterface.php b/app/code/Magento/InventoryApi/Api/GetAssignedSourcesForStockInterface.php index 61bc17d7c3e0c..d7018f38dbcee 100644 --- a/app/code/Magento/InventoryApi/Api/GetAssignedSourcesForStockInterface.php +++ b/app/code/Magento/InventoryApi/Api/GetAssignedSourcesForStockInterface.php @@ -19,6 +19,8 @@ interface GetAssignedSourcesForStockInterface * * @param int $stockId * @return \Magento\InventoryApi\Api\Data\SourceInterface[] + * @throws \Magento\Framework\Exception\InputException + * @throws \Magento\Framework\Exception\LocalizedException */ public function execute($stockId); } From 725112dd243e03a38511af1d641b3a1e81a927bc Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 21 Jul 2017 18:22:07 +0300 Subject: [PATCH 0335/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../Magento/Inventory/Setup/InstallSchema.php | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index 6163beef82083..a7205a4daef3d 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -10,11 +10,11 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; +use Magento\Inventory\Model\StockSourceLink; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceItemInterface; use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; use Magento\InventoryApi\Api\Data\StockInterface; -use Magento\InventoryApi\Api\Data\SourceStockLinkInterface; /** * @codeCoverageIgnore @@ -38,9 +38,9 @@ class InstallSchema implements InstallSchemaInterface const TABLE_NAME_STOCK = 'inventory_stock'; /** - * Constant for table name of \Magento\Inventory\Model\SourceStockLink + * Constant for table name of \Magento\Inventory\Model\StockSourceLink */ - const TABLE_NAME_SOURCE_STOCK_LINK = 'inventory_source_stock_link'; + const TABLE_NAME_STOCK_SOURCE_LINK = 'inventory_source_stock_link'; /** * Constant for decimal precision for latitude and longitude @@ -79,7 +79,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con $setup->getConnection()->createTable($this->createSourceItemTable($setup)); $setup->getConnection()->createTable($this->createStockTable($setup)); - $setup->getConnection()->createTable($this->createSourceStockLinkTable($setup)); + $setup->getConnection()->createTable($this->createStockSourceLinkTable($setup)); $setup->endSetup(); } @@ -487,16 +487,17 @@ private function createStockTable(SchemaSetupInterface $setup) { * @param SchemaSetupInterface $setup * @return Table */ - private function createSourceStockLinkTable(SchemaSetupInterface $setup) { - $sourceStockLinkTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE_STOCK_LINK); + private function createStockSourceLinkTable(SchemaSetupInterface $setup) { + $stockSourceLinkTable = $setup->getTable(InstallSchema::TABLE_NAME_STOCK_SOURCE_LINK); $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE); return $setup->getConnection()->newTable( - $sourceStockLinkTable + $stockSourceLinkTable )->setComment( 'Inventory Source Stock Link Table' )->addColumn( - SourceStockLinkInterface::LINK_ID, + // TODO: + 'link_id', Table::TYPE_INTEGER, null, [ @@ -507,7 +508,7 @@ private function createSourceStockLinkTable(SchemaSetupInterface $setup) { ], 'Link ID' )->addColumn( - SourceStockLinkInterface::STOCK_ID, + StockSourceLink::STOCK_ID, Table::TYPE_INTEGER, null, [ @@ -516,7 +517,7 @@ private function createSourceStockLinkTable(SchemaSetupInterface $setup) { ], 'Stock ID' )->addColumn( - SourceStockLinkInterface::SOURCE_ID, + StockSourceLink::SOURCE_ID, Table::TYPE_INTEGER, null, [ @@ -524,17 +525,20 @@ private function createSourceStockLinkTable(SchemaSetupInterface $setup) { InstallSchema::OPTION_UNSIGNED => true, ], 'Source ID' - )->addForeignKey( - $setup->getFkName( - $sourceStockLinkTable, - SourceStockLinkInterface::SOURCE_ID, - $sourceTable, - SourceInterface::SOURCE_ID - ), - SourceStockLinkInterface::SOURCE_ID, - $sourceTable, - SourceInterface::SOURCE_ID, - AdapterInterface::FK_ACTION_CASCADE - ); + ) + // TODO: uniqe key: stock, source, foreign key +// ->addForeignKey( +// $setup->getFkName( +// $stockSourceLinkTable, +// StockSourceLink::SOURCE_ID, +// $sourceTable, +// SourceInterface::SOURCE_ID +// ), +// StockSourceLink::SOURCE_ID, +// $sourceTable, +// SourceInterface::SOURCE_ID, +// AdapterInterface::FK_ACTION_CASCADE +// ) + ; } } From 79d15add3a0c2f2ad1757f66177237ee0021a293 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Sun, 23 Jul 2017 20:15:35 +0100 Subject: [PATCH 0336/1004] magento/magento2#10045 Fix coding standards --- .../Unit/Model/CategorySitemapItemResolverTest.php | 2 +- .../Unit/Model/CmsPageSitemapItemResolverTest.php | 2 +- .../Unit/Model/CompositeSitemapItemResolverTest.php | 3 ++- .../Unit/Model/ProductSitemapItemResolverTest.php | 12 ++++++------ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php index 2209192fe1539..6681c5744f037 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php @@ -50,7 +50,7 @@ public function testGetItems(array $categories) $resolver = new CategorySitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); $items = $resolver->getItems(1); self::assertTrue(count($items) == count($categories)); - foreach($categories as $index => $category) { + foreach ($categories as $index => $category) { self::assertSame($category->getUpdatedAt(), $items[$index]->getUpdatedAt()); self::assertSame('daily', $items[$index]->getChangeFrequency()); self::assertSame('1.0', $items[$index]->getPriority()); diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php index 583246562fd1d..ade0ab456caac 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php @@ -149,4 +149,4 @@ private function getCmsPageCollectionMock($returnValue) return $sitemapCmsPageMock; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php index 6b53d39061ead..b71088de811b6 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php @@ -12,7 +12,8 @@ class CompositeSitemapItemResolverTest extends \PHPUnit_Framework_TestCase { - public function testNoResolvers() { + public function testNoResolvers() + { $resolver = new CompositeSitemapItemResolver(); self::assertSame([], $resolver->getItems(1)); } diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php index bd7ac0366a95d..38535bb9c47de 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php @@ -34,24 +34,24 @@ public function testGetItemsEmpty() /** * @dataProvider productProvider - * @param array $categories + * @param array $products */ - public function testGetItems(array $categories) + public function testGetItems(array $products) { $storeConfigMock = $this->getStoreConfigMock([ ProductSitemapItemResolver::XML_PATH_PRODUCT_CHANGEFREQ => 'daily', ProductSitemapItemResolver::XML_PATH_PRODUCT_PRIORITY => '1.0', ]); - $ProductMock = $this->getProductCollectionMock($categories); + $ProductMock = $this->getProductCollectionMock($products); $cmsPageFactoryMock = $this->getProductFactoryMock($ProductMock); $itemFactoryMock = $this->getItemFactoryMock(); $resolver = new ProductSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); $items = $resolver->getItems(1); - self::assertTrue(count($items) == count($categories)); - foreach($categories as $index => $product) { + self::assertTrue(count($items) == count($products)); + foreach ($products as $index => $product) { self::assertSame($product->getUpdatedAt(), $items[$index]->getUpdatedAt()); self::assertSame('daily', $items[$index]->getChangeFrequency()); self::assertSame('1.0', $items[$index]->getPriority()); @@ -171,4 +171,4 @@ private function getProductCollectionMock($returnValue) return $sitemapCmsPageMock; } -} \ No newline at end of file +} From 6c137a8d1b6615345aeaadac35fdf76c08fa7fc4 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Sun, 23 Jul 2017 20:41:26 +0100 Subject: [PATCH 0337/1004] magento/magento2#10045 Fix unit tests --- .../Model/CmsPageSitemapItemResolverTest.php | 4 +-- .../CompositeSitemapItemResolverTest.php | 6 ++-- .../Sitemap/Test/Unit/Model/SitemapTest.php | 29 +++++++++++++++++-- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php index ade0ab456caac..5b55e7ba9658e 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php @@ -24,8 +24,8 @@ public function testGetItemsEmpty() CmsPageSitemapItemResolver::XML_PATH_PAGE_PRIORITY => '1.0', ]); - $cmsPageCollectionMock = $this->getCmsPageCollectionMock([]); - $cmsPageFactoryMock = $this->getCmsPageFactoryMock($cmsPageCollectionMock); + $cmsPageMock = $this->getCmsPageCollectionMock([]); + $cmsPageFactoryMock = $this->getCmsPageFactoryMock($cmsPageMock); $itemFactoryMock = $this->getItemFactoryMock(); $resolver = new CmsPageSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php index b71088de811b6..6e93c58083d79 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php @@ -52,9 +52,11 @@ public function sitemapItemsProvider() for ($i = 1; $i < 5; $i++) { $itemProviders = []; $expectedItems = []; - for ($i = 1; $i < $maxProviders = random_int(1, 5); $i++) { + $maxProviders = random_int(1, 5); + for ($i = 1; $i < $maxProviders; $i++) { $items = []; - for ($i = 1; $i < $maxItems = random_int(2, 5); $i++) { + $maxItems = random_int(2, 5); + for ($i = 1; $i < $maxItems; $i++) { $sitemapItem = $this->getMockForAbstractClass(SitemapItemInterface::class); $items[] = $sitemapItem; $expectedItems[] = $sitemapItem; diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index 0b69dd349696e..2c7c7eef21695 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -5,6 +5,7 @@ */ namespace Magento\Sitemap\Test\Unit\Model; +use Magento\Sitemap\Model\SitemapItem; use Magento\Sitemap\Model\SitemapItemResolverInterface; /** @@ -155,9 +156,6 @@ protected function setUp() ); $this->itemResolverMock = $this->getMockForAbstractClass(SitemapItemResolverInterface::class); - $this->itemResolverMock->expects(self::any()) - ->method('getItems') - ->willReturn([]); } /** @@ -587,6 +585,31 @@ protected function _getModelMock($mockBeforeSave = false) ); $this->_sitemapCmsPageMock->expects($this->any())->method('getCollection')->will($this->returnValue([])); + $this->itemResolverMock->expects(self::any()) + ->method('getItems') + ->willReturn([ + new SitemapItem('category.html', '1.0', 'daily', '2012-12-21 00:00:00'), + new SitemapItem('/category/sub-category.html', '1.0', 'daily', '2012-12-21 00:00:00'), + new SitemapItem('product.html', '0.5', 'monthly', '2012-12-21 00:00:00'), + new SitemapItem('product2.html', '0.5', 'monthly', '2012-12-21 00:00:00', new \Magento\Framework\DataObject( + [ + 'collection' => [ + new \Magento\Framework\DataObject( + [ + 'url' => $storeBaseMediaUrl.'i/m/image1.png', + 'caption' => 'caption & > title < "' + ] + ), + new \Magento\Framework\DataObject( + ['url' => $storeBaseMediaUrl.'i/m/image_no_caption.png', 'caption' => null] + ), + ], + 'thumbnail' => $storeBaseMediaUrl.'t/h/thumbnail.jpg', + 'title' => 'Product & > title < "', + ] + )) + ]); + /** @var $model \Magento\Sitemap\Model\Sitemap */ $model = $this->getMockBuilder( \Magento\Sitemap\Model\Sitemap::class From 4bc880b5730e209b32ac51dafc7506a54f7f6579 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Sun, 23 Jul 2017 21:19:33 +0100 Subject: [PATCH 0338/1004] magento/magento2#10045 Clean up sitemapTest --- .../Sitemap/Test/Unit/Model/SitemapTest.php | 81 ++----------------- 1 file changed, 8 insertions(+), 73 deletions(-) diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index 2c7c7eef21695..f5ce4ad870503 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -529,61 +529,7 @@ protected function _getModelMock($mockBeforeSave = false) $methods[] = 'beforeSave'; } - $this->_sitemapCategoryMock->expects( - $this->any() - )->method( - 'getCollection' - )->will( - $this->returnValue( - [ - new \Magento\Framework\DataObject( - ['url' => 'category.html', 'updated_at' => '2012-12-21 00:00:00'] - ), - new \Magento\Framework\DataObject( - ['url' => '/category/sub-category.html', 'updated_at' => '2012-12-21 00:00:00'] - ), - ] - ) - ); - $storeBaseMediaUrl = 'http://store.com/pub/media/catalog/product/cache/c9e0b0ef589f3508e5ba515cde53c5ff/'; - $this->_sitemapProductMock->expects( - $this->any() - )->method( - 'getCollection' - )->will( - $this->returnValue( - [ - new \Magento\Framework\DataObject( - ['url' => 'product.html', 'updated_at' => '2012-12-21 00:00:00'] - ), - new \Magento\Framework\DataObject( - [ - 'url' => 'product2.html', - 'updated_at' => '2012-12-21 00:00:00', - 'images' => new \Magento\Framework\DataObject( - [ - 'collection' => [ - new \Magento\Framework\DataObject( - [ - 'url' => $storeBaseMediaUrl.'i/m/image1.png', - 'caption' => 'caption & > title < "' - ] - ), - new \Magento\Framework\DataObject( - ['url' => $storeBaseMediaUrl.'i/m/image_no_caption.png', 'caption' => null] - ), - ], - 'thumbnail' => $storeBaseMediaUrl.'t/h/thumbnail.jpg', - 'title' => 'Product & > title < "', - ] - ), - ] - ), - ] - ) - ); - $this->_sitemapCmsPageMock->expects($this->any())->method('getCollection')->will($this->returnValue([])); $this->itemResolverMock->expects(self::any()) ->method('getItems') @@ -591,8 +537,12 @@ protected function _getModelMock($mockBeforeSave = false) new SitemapItem('category.html', '1.0', 'daily', '2012-12-21 00:00:00'), new SitemapItem('/category/sub-category.html', '1.0', 'daily', '2012-12-21 00:00:00'), new SitemapItem('product.html', '0.5', 'monthly', '2012-12-21 00:00:00'), - new SitemapItem('product2.html', '0.5', 'monthly', '2012-12-21 00:00:00', new \Magento\Framework\DataObject( - [ + new SitemapItem( + 'product2.html', + '0.5', + 'monthly', + '2012-12-21 00:00:00', + new \Magento\Framework\DataObject([ 'collection' => [ new \Magento\Framework\DataObject( [ @@ -606,8 +556,8 @@ protected function _getModelMock($mockBeforeSave = false) ], 'thumbnail' => $storeBaseMediaUrl.'t/h/thumbnail.jpg', 'title' => 'Product & > title < "', - ] - )) + ]) + ) ]); /** @var $model \Magento\Sitemap\Model\Sitemap */ @@ -643,30 +593,15 @@ protected function _getModelConstructorArgs() { $categoryFactory = $this->getMockBuilder( \Magento\Sitemap\Model\ResourceModel\Catalog\CategoryFactory::class - )->setMethods( - ['create'] )->disableOriginalConstructor()->getMock(); - $categoryFactory->expects( - $this->any() - )->method( - 'create' - )->will( - $this->returnValue($this->_sitemapCategoryMock) - ); $productFactory = $this->getMockBuilder( \Magento\Sitemap\Model\ResourceModel\Catalog\ProductFactory::class - )->setMethods( - ['create'] )->disableOriginalConstructor()->getMock(); - $productFactory->expects($this->any())->method('create')->will($this->returnValue($this->_sitemapProductMock)); $cmsFactory = $this->getMockBuilder( \Magento\Sitemap\Model\ResourceModel\Cms\PageFactory::class - )->setMethods( - ['create'] )->disableOriginalConstructor()->getMock(); - $cmsFactory->expects($this->any())->method('create')->will($this->returnValue($this->_sitemapCmsPageMock)); $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class) ->setMethods(['getStore']) From e8f9b352e1a3f0afa44a2f821858b0b6ed261f4d Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 18 Jul 2017 15:49:19 +0000 Subject: [PATCH 0339/1004] Replay the static call to Zend_Json with a static call to Magento JsonConverter. - This is only in place for this one use case and should not be used for other times with converting json --- lib/internal/Magento/Framework/DataObject.php | 10 +++++--- .../Framework/Serialize/JsonConverter.php | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 lib/internal/Magento/Framework/Serialize/JsonConverter.php diff --git a/lib/internal/Magento/Framework/DataObject.php b/lib/internal/Magento/Framework/DataObject.php index 547a23ed979d1..a6ebc50fe98bc 100644 --- a/lib/internal/Magento/Framework/DataObject.php +++ b/lib/internal/Magento/Framework/DataObject.php @@ -325,19 +325,21 @@ public function convertToXml( * Convert object data to JSON * * @param array $keys array of required keys - * @return string + * @return bool|string + * @throws \InvalidArgumentException */ public function toJson(array $keys = []) { $data = $this->toArray($keys); - return \Zend_Json::encode($data); + return \Magento\Framework\Serialize\JsonConverter::convert($data); } /** * The "__" style wrapper for toJson * - * @param array $keys - * @return string + * @param array $keys + * @return bool|string + * @throws \InvalidArgumentException */ public function convertToJson(array $keys = []) { diff --git a/lib/internal/Magento/Framework/Serialize/JsonConverter.php b/lib/internal/Magento/Framework/Serialize/JsonConverter.php new file mode 100644 index 0000000000000..b9b72cad10d2a --- /dev/null +++ b/lib/internal/Magento/Framework/Serialize/JsonConverter.php @@ -0,0 +1,25 @@ +serialize($data); + } +} From dd8ef3a40d1e8aa85bc5938c732e5c29dd6fef2b Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 24 Jul 2017 13:09:43 +0300 Subject: [PATCH 0340/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../Stock/StockSourceLinkProcessor.php | 13 +- .../Inventory/Model/ResourceModel/Source.php | 9 +- .../Model/ResourceModel/SourceCarrierLink.php | 10 +- .../Model/ResourceModel/SourceItem.php | 11 +- .../ResourceModel/SourceItem/SaveMultiple.php | 4 +- .../Inventory/Model/ResourceModel/Stock.php | 9 +- .../Model/ResourceModel/StockSourceLink.php | 10 +- .../Model/SourceCarrierLinkManagement.php | 5 +- .../Inventory/Model/StockSourceLink.php | 17 -- .../Magento/Inventory/Setup/InstallSchema.php | 230 +++++++++--------- .../Product/Form/Modifier/Sources.php | 4 +- 11 files changed, 171 insertions(+), 151 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php index c89d55b233724..2794cec0d8598 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php @@ -73,6 +73,8 @@ public function __construct( */ public function process($stockId, array $stockSourceLinksData) { + $this->validateStockSourceData($stockSourceLinksData); + $assignedSources = $this->getAssignedSourcesForStock->execute($stockId); $sourceIdsForSave = array_column($stockSourceLinksData, StockSourceLink::SOURCE_ID); $sourceIdsForDelete = []; @@ -94,15 +96,16 @@ public function process($stockId, array $stockSourceLinksData) } /** - * TODO: - * @param array $stockSourceLinkData + * @param array $stockSourceLinksData * @return void * @throws InputException */ - private function validateStockSourceData(array $stockSourceLinkData) + private function validateStockSourceData(array $stockSourceLinksData) { - if (!isset($stockSourceLinkData[StockSourceLink::SOURCE_ID])) { - throw new InputException(__('Wrong Stock to Source relation parameters given.')); + foreach ($stockSourceLinksData as $stockSourceLinkData) { + if (!isset($stockSourceLinkData[StockSourceLink::SOURCE_ID])) { + throw new InputException(__('Wrong Stock to Source relation parameters given.')); + } } } } diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Source.php b/app/code/Magento/Inventory/Model/ResourceModel/Source.php index ba83c03c4564b..9e42315cac447 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/Source.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Source.php @@ -10,7 +10,6 @@ use Magento\Framework\Model\ResourceModel\Db\AbstractDb; use Magento\Framework\Model\ResourceModel\Db\Context; use Magento\Inventory\Model\SourceCarrierLinkManagementInterface; -use Magento\Inventory\Setup\InstallSchema; use Magento\InventoryApi\Api\Data\SourceInterface; /** @@ -18,6 +17,12 @@ */ class Source extends AbstractDb { + /**#@+ + * Constants related to specific db layer + */ + const TABLE_NAME_SOURCE = 'inventory_source'; + /**#@-*/ + /** * @var SourceCarrierLinkManagementInterface */ @@ -44,7 +49,7 @@ public function __construct( */ protected function _construct() { - $this->_init(InstallSchema::TABLE_NAME_SOURCE, SourceInterface::SOURCE_ID); + $this->_init(self::TABLE_NAME_SOURCE, SourceInterface::SOURCE_ID); } /** diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php index f96c040cab1e6..da3c59a8a82c9 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php @@ -6,7 +6,6 @@ namespace Magento\Inventory\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; -use Magento\Inventory\Setup\InstallSchema; /** * Implementation of basic operations for SourceCarrierLink entity for specific db layer @@ -14,11 +13,18 @@ */ class SourceCarrierLink extends AbstractDb { + /**#@+ + * Constants related to specific db layer + */ + const TABLE_NAME_SOURCE_CARRIER_LINK = 'inventory_source_stock_link'; + const ID_FIELD_NAME = 'link_id'; + /**#@-*/ + /** * @inheritdoc */ protected function _construct() { - $this->_init(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK, 'source_carrier_link_id'); + $this->_init(self::TABLE_NAME_SOURCE_CARRIER_LINK, self::ID_FIELD_NAME); } } diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php index 2437394550832..a6e0e37a5303b 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php @@ -6,19 +6,24 @@ namespace Magento\Inventory\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; -use Magento\Inventory\Setup\InstallSchema; -use Magento\InventoryApi\Api\Data\SourceItemInterface; /** * Implementation of basic operations for Source Item entity for specific db layer */ class SourceItem extends AbstractDb { + /**#@+ + * Constants related to specific db layer + */ + const TABLE_NAME_SOURCE_ITEM = 'inventory_source_carrier_link'; + const ID_FIELD_NAME = 'source_item_id'; + /**#@-*/ + /** * @inheritdoc */ protected function _construct() { - $this->_init(InstallSchema::TABLE_NAME_SOURCE_ITEM, 'source_item_id'); + $this->_init(self::TABLE_NAME_SOURCE_ITEM, self::ID_FIELD_NAME); } } diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php index 80ebaeae54f31..ea314da85e661 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem/SaveMultiple.php @@ -6,7 +6,7 @@ namespace Magento\Inventory\Model\ResourceModel\SourceItem; use Magento\Framework\App\ResourceConnection; -use Magento\Inventory\Setup\InstallSchema; +use Magento\Inventory\Model\ResourceModel\SourceItem as SourceItemResourceModel; use Magento\InventoryApi\Api\Data\SourceItemInterface; /** @@ -40,7 +40,7 @@ public function __construct( public function execute(array $sourceItems) { $connection = $this->connection->getConnection(); - $tableName = $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_ITEM); + $tableName = $connection->getTableName(SourceItemResourceModel::TABLE_NAME_SOURCE_ITEM); $columnsSql = $this->buildColumnsSqlPart([ SourceItemInterface::SOURCE_ID, diff --git a/app/code/Magento/Inventory/Model/ResourceModel/Stock.php b/app/code/Magento/Inventory/Model/ResourceModel/Stock.php index 7993192a85a20..46afd4763d60b 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/Stock.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/Stock.php @@ -6,7 +6,6 @@ namespace Magento\Inventory\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; -use Magento\Inventory\Setup\InstallSchema; use Magento\InventoryApi\Api\Data\StockInterface; /** @@ -14,11 +13,17 @@ */ class Stock extends AbstractDb { + /**#@+ + * Constants related to specific db layer + */ + const TABLE_NAME_STOCK = 'inventory_stock'; + /**#@-*/ + /** * @inheritdoc */ protected function _construct() { - $this->_init(InstallSchema::TABLE_NAME_STOCK, StockInterface::STOCK_ID); + $this->_init(self::TABLE_NAME_STOCK, StockInterface::STOCK_ID); } } diff --git a/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink.php b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink.php index 2b228b260fe5b..96b8a76d95485 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink.php @@ -6,18 +6,24 @@ namespace Magento\Inventory\Model\ResourceModel; use Magento\Framework\Model\ResourceModel\Db\AbstractDb; -use Magento\Inventory\Setup\InstallSchema; /** * Implementation of basic operations for SourceCarrierLink entity for specific db layer */ class StockSourceLink extends AbstractDb { + /**#@+ + * Constants related to specific db layer + */ + const TABLE_NAME_STOCK_SOURCE_LINK = 'inventory_source_stock_link'; + const ID_FIELD_NAME = 'link_id'; + /**#@-*/ + /** * @inheritdoc */ protected function _construct() { - $this->_init(InstallSchema::TABLE_NAME_STOCK_SOURCE_LINK, 'link_id'); // TODO + $this->_init(self::TABLE_NAME_STOCK_SOURCE_LINK, self::ID_FIELD_NAME); } } diff --git a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php index 97fd96bb3cbda..fab9b722b9f38 100644 --- a/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php +++ b/app/code/Magento/Inventory/Model/SourceCarrierLinkManagement.php @@ -10,6 +10,7 @@ use Magento\Framework\App\ResourceConnection; use Magento\Framework\Exception\StateException; use Magento\Inventory\Model\ResourceModel\SourceCarrierLink as SourceCarrierLinkResourceModel; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink; use Magento\Inventory\Model\ResourceModel\SourceCarrierLink\Collection; use Magento\Inventory\Model\ResourceModel\SourceCarrierLink\CollectionFactory; use Magento\Inventory\Setup\InstallSchema; @@ -94,7 +95,7 @@ private function deleteCurrentCarrierLinks(SourceInterface $source) { $connection = $this->connection->getConnection(); $connection->delete( - $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK), + $connection->getTableName(SourceCarrierLink::TABLE_NAME_SOURCE_CARRIER_LINK), $connection->quoteInto('source_id = ?', $source->getSourceId()) ); } @@ -116,7 +117,7 @@ private function saveNewCarrierLinks(SourceInterface $source) $connection = $this->connection->getConnection(); $connection->insertMultiple( - $connection->getTableName(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK), + $connection->getTableName(SourceCarrierLink::TABLE_NAME_SOURCE_CARRIER_LINK), $carrierLinkData ); } diff --git a/app/code/Magento/Inventory/Model/StockSourceLink.php b/app/code/Magento/Inventory/Model/StockSourceLink.php index 0bd0347bd4616..575295e6a2c6e 100644 --- a/app/code/Magento/Inventory/Model/StockSourceLink.php +++ b/app/code/Magento/Inventory/Model/StockSourceLink.php @@ -18,7 +18,6 @@ class StockSourceLink extends AbstractModel /**#@+ * Constants for keys of data array. Identical to the name of the getter in snake case */ - const LINK_ID = 'link_id'; const SOURCE_ID = 'source_id'; const STOCK_ID = 'stock_id'; /**#@-*/ @@ -31,22 +30,6 @@ protected function _construct() $this->_init(StockSourceLinkResourceModel::class); } - /** - * @inheritdoc - */ - public function getLinkId() - { - return $this->getData(self::LINK_ID); - } - - /** - * @inheritdoc - */ - public function setLinkId($linkId) - { - $this->setData(self::LINK_ID, $linkId); - } - /** * @inheritdoc */ diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index a7205a4daef3d..36c43f11ce90e 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -10,6 +10,11 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; +use Magento\Inventory\Model\ResourceModel\Source as SourceResourceModel; +use Magento\Inventory\Model\ResourceModel\SourceCarrierLink; +use Magento\Inventory\Model\ResourceModel\SourceItem as SourceItemResourceModel; +use Magento\Inventory\Model\ResourceModel\Stock as StockResourceModel; +use Magento\Inventory\Model\ResourceModel\StockSourceLink as StockSourceLinkResourceModel; use Magento\Inventory\Model\StockSourceLink; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceItemInterface; @@ -21,27 +26,6 @@ */ class InstallSchema implements InstallSchemaInterface { - /** - * Constant for table names of the model \Magento\Inventory\Model\Source - */ - const TABLE_NAME_SOURCE = 'inventory_source'; - const TABLE_NAME_SOURCE_ITEM = 'inventory_source_item'; - - /** - * Constant for table name of \Magento\Inventory\Model\SourceCarrierLink - */ - const TABLE_NAME_SOURCE_CARRIER_LINK = 'inventory_source_carrier_link'; - - /** - * Constant for table names of the model \Magento\Inventory\Model\Stock - */ - const TABLE_NAME_STOCK = 'inventory_stock'; - - /** - * Constant for table name of \Magento\Inventory\Model\StockSourceLink - */ - const TABLE_NAME_STOCK_SOURCE_LINK = 'inventory_source_stock_link'; - /** * Constant for decimal precision for latitude and longitude */ @@ -90,7 +74,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con */ private function createSourceTable(SchemaSetupInterface $setup) { - $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE); + $sourceTable = $setup->getTable(SourceResourceModel::TABLE_NAME_SOURCE); return $setup->getConnection()->newTable( $sourceTable @@ -101,10 +85,10 @@ private function createSourceTable(SchemaSetupInterface $setup) Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true, + self::OPTION_IDENTITY => true, + self::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => false, + self::OPTION_PRIMARY => true, ], 'Source ID' )->addColumn( @@ -112,7 +96,7 @@ private function createSourceTable(SchemaSetupInterface $setup) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => false, + self::OPTION_NULLABLE => false, ], 'Source Name' )->addColumn( @@ -120,9 +104,9 @@ private function createSourceTable(SchemaSetupInterface $setup) Table::TYPE_SMALLINT, null, [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_DEFAULT => 1, + self::OPTION_NULLABLE => false, + self::OPTION_UNSIGNED => true, + self::OPTION_DEFAULT => 1, ], 'Defines Is Source Enabled' )->addColumn( @@ -130,7 +114,7 @@ private function createSourceTable(SchemaSetupInterface $setup) Table::TYPE_TEXT, 1000, [ - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_NULLABLE => true, ], 'Description' )->addColumn( @@ -138,10 +122,10 @@ private function createSourceTable(SchemaSetupInterface $setup) Table::TYPE_DECIMAL, null, [ - InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LAT, - InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, - InstallSchema::OPTION_UNSIGNED => false, - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_PRECISION => self::LATLON_PRECISION_LAT, + self::OPTION_SCALE => self::LATLON_SCALE, + self::OPTION_UNSIGNED => false, + self::OPTION_NULLABLE => true, ], 'Latitude' )->addColumn( @@ -149,10 +133,10 @@ private function createSourceTable(SchemaSetupInterface $setup) Table::TYPE_DECIMAL, null, [ - InstallSchema::OPTION_PRECISION => InstallSchema::LATLON_PRECISION_LON, - InstallSchema::OPTION_SCALE => InstallSchema::LATLON_SCALE, - InstallSchema::OPTION_UNSIGNED => false, - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_PRECISION => self::LATLON_PRECISION_LON, + self::OPTION_SCALE => self::LATLON_SCALE, + self::OPTION_UNSIGNED => false, + self::OPTION_NULLABLE => true, ], 'Longitude' )->addColumn( @@ -160,8 +144,8 @@ private function createSourceTable(SchemaSetupInterface $setup) Table::TYPE_SMALLINT, null, [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => true, + self::OPTION_UNSIGNED => true, ], 'Priority' ); @@ -178,7 +162,7 @@ private function addAddressFields(Table $sourceTable) Table::TYPE_TEXT, 2, [ - InstallSchema::OPTION_NULLABLE => false, + self::OPTION_NULLABLE => false, ], 'Country Id' )->addColumn( @@ -186,8 +170,8 @@ private function addAddressFields(Table $sourceTable) Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => true, + self::OPTION_UNSIGNED => true, ], 'Region Id' )->addColumn( @@ -195,7 +179,7 @@ private function addAddressFields(Table $sourceTable) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_NULLABLE => true, ], 'Region' )->addColumn( @@ -203,7 +187,7 @@ private function addAddressFields(Table $sourceTable) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_NULLABLE => true, ], 'City' )->addColumn( @@ -211,7 +195,7 @@ private function addAddressFields(Table $sourceTable) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_NULLABLE => true, ], 'Street' )->addColumn( @@ -219,7 +203,7 @@ private function addAddressFields(Table $sourceTable) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => false, + self::OPTION_NULLABLE => false, ], 'Postcode' ); @@ -237,7 +221,7 @@ private function addContactInfoFields(Table $sourceTable) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_NULLABLE => true, ], 'Contact Name' )->addColumn( @@ -245,7 +229,7 @@ private function addContactInfoFields(Table $sourceTable) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_NULLABLE => true, ], 'Email' )->addColumn( @@ -253,7 +237,7 @@ private function addContactInfoFields(Table $sourceTable) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_NULLABLE => true, ], 'Phone' )->addColumn( @@ -261,7 +245,7 @@ private function addContactInfoFields(Table $sourceTable) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => true, + self::OPTION_NULLABLE => true, ], 'Fax' ); @@ -294,22 +278,22 @@ private function addSourceCarrierFields(Table $sourceTable) */ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) { - $sourceCarrierLinkTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE_CARRIER_LINK); - $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE); + $sourceCarrierLinkTable = $setup->getTable(SourceCarrierLink::TABLE_NAME_SOURCE_CARRIER_LINK); + $sourceTable = $setup->getTable(SourceResourceModel::TABLE_NAME_SOURCE); return $setup->getConnection()->newTable( $sourceCarrierLinkTable )->setComment( 'Inventory Source Carrier Link Table' )->addColumn( - 'source_carrier_link_id', + SourceCarrierLink::ID_FIELD_NAME, Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true, + self::OPTION_IDENTITY => true, + self::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => false, + self::OPTION_PRIMARY => true, ], 'Source Carrier Link ID' )->addColumn( @@ -317,8 +301,8 @@ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => false, + self::OPTION_UNSIGNED => true, ], 'Source ID' )->addColumn( @@ -326,7 +310,7 @@ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => false, + self::OPTION_NULLABLE => false, ], 'Carrier Code' )->addColumn( @@ -334,8 +318,8 @@ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) Table::TYPE_SMALLINT, null, [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => true, + self::OPTION_UNSIGNED => true, ], 'Position' )->addForeignKey( @@ -358,21 +342,21 @@ private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) */ private function createSourceItemTable(SchemaSetupInterface $setup) { - $sourceItemTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE_ITEM); + $sourceItemTable = $setup->getTable(SourceItemResourceModel::TABLE_NAME_SOURCE_ITEM); return $setup->getConnection()->newTable( $sourceItemTable )->setComment( 'Inventory Source item Table' )->addColumn( - 'source_item_id', + SourceItemResourceModel::ID_FIELD_NAME, Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true, + self::OPTION_IDENTITY => true, + self::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => false, + self::OPTION_PRIMARY => true, ], 'Source Item ID' )->addColumn( @@ -380,8 +364,8 @@ private function createSourceItemTable(SchemaSetupInterface $setup) Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, + self::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => false, ], 'Source ID' )->addColumn( @@ -389,7 +373,7 @@ private function createSourceItemTable(SchemaSetupInterface $setup) Table::TYPE_TEXT, 64, [ - InstallSchema::OPTION_NULLABLE => false, + self::OPTION_NULLABLE => false, ], 'Sku' )->addColumn( @@ -397,9 +381,9 @@ private function createSourceItemTable(SchemaSetupInterface $setup) Table::TYPE_DECIMAL, null, [ - InstallSchema::OPTION_UNSIGNED => false, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_DEFAULT => 0, + self::OPTION_UNSIGNED => false, + self::OPTION_NULLABLE => false, + self::OPTION_DEFAULT => 0, ], 'Quantity' )->addColumn( @@ -407,19 +391,19 @@ private function createSourceItemTable(SchemaSetupInterface $setup) Table::TYPE_SMALLINT, null, [ - InstallSchema::OPTION_NULLABLE => true, - InstallSchema::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => true, + self::OPTION_UNSIGNED => true, ], 'Status' )->addForeignKey( $setup->getFkName( $sourceItemTable, SourceItemInterface::SOURCE_ID, - InstallSchema::TABLE_NAME_SOURCE, + SourceResourceModel::TABLE_NAME_SOURCE, SourceInterface::SOURCE_ID ), SourceItemInterface::SOURCE_ID, - InstallSchema::TABLE_NAME_SOURCE, + SourceResourceModel::TABLE_NAME_SOURCE, SourceInterface::SOURCE_ID, AdapterInterface::FK_ACTION_CASCADE )->addForeignKey( @@ -455,7 +439,7 @@ private function createSourceItemTable(SchemaSetupInterface $setup) * @return Table */ private function createStockTable(SchemaSetupInterface $setup) { - $stockTable = $setup->getTable(InstallSchema::TABLE_NAME_STOCK); + $stockTable = $setup->getTable(StockResourceModel::TABLE_NAME_STOCK); return $setup->getConnection()->newTable( $stockTable @@ -466,10 +450,10 @@ private function createStockTable(SchemaSetupInterface $setup) { Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true, + self::OPTION_IDENTITY => true, + self::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => false, + self::OPTION_PRIMARY => true, ], 'Stock ID' )->addColumn( @@ -477,7 +461,7 @@ private function createStockTable(SchemaSetupInterface $setup) { Table::TYPE_TEXT, 255, [ - InstallSchema::OPTION_NULLABLE => false, + self::OPTION_NULLABLE => false, ], 'Stock Name' ); @@ -488,23 +472,23 @@ private function createStockTable(SchemaSetupInterface $setup) { * @return Table */ private function createStockSourceLinkTable(SchemaSetupInterface $setup) { - $stockSourceLinkTable = $setup->getTable(InstallSchema::TABLE_NAME_STOCK_SOURCE_LINK); - $sourceTable = $setup->getTable(InstallSchema::TABLE_NAME_SOURCE); + $stockSourceLinkTable = $setup->getTable(StockSourceLinkResourceModel::TABLE_NAME_STOCK_SOURCE_LINK); + $stockTable = $setup->getTable(StockResourceModel::TABLE_NAME_STOCK); + $sourceTable = $setup->getTable(SourceResourceModel::TABLE_NAME_SOURCE); return $setup->getConnection()->newTable( $stockSourceLinkTable )->setComment( 'Inventory Source Stock Link Table' )->addColumn( - // TODO: 'link_id', Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_IDENTITY => true, - InstallSchema::OPTION_UNSIGNED => true, - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_PRIMARY => true, + self::OPTION_IDENTITY => true, + self::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => false, + self::OPTION_PRIMARY => true, ], 'Link ID' )->addColumn( @@ -512,8 +496,8 @@ private function createStockSourceLinkTable(SchemaSetupInterface $setup) { Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => false, + self::OPTION_UNSIGNED => true, ], 'Stock ID' )->addColumn( @@ -521,24 +505,46 @@ private function createStockSourceLinkTable(SchemaSetupInterface $setup) { Table::TYPE_INTEGER, null, [ - InstallSchema::OPTION_NULLABLE => false, - InstallSchema::OPTION_UNSIGNED => true, + self::OPTION_NULLABLE => false, + self::OPTION_UNSIGNED => true, ], 'Source ID' - ) - // TODO: uniqe key: stock, source, foreign key -// ->addForeignKey( -// $setup->getFkName( -// $stockSourceLinkTable, -// StockSourceLink::SOURCE_ID, -// $sourceTable, -// SourceInterface::SOURCE_ID -// ), -// StockSourceLink::SOURCE_ID, -// $sourceTable, -// SourceInterface::SOURCE_ID, -// AdapterInterface::FK_ACTION_CASCADE -// ) - ; + )->addForeignKey( + $setup->getFkName( + $stockSourceLinkTable, + StockSourceLink::STOCK_ID, + $stockTable, + StockInterface::STOCK_ID + ), + StockSourceLink::STOCK_ID, + $stockTable, + StockInterface::STOCK_ID, + AdapterInterface::FK_ACTION_CASCADE + )->addForeignKey( + $setup->getFkName( + $stockSourceLinkTable, + StockSourceLink::SOURCE_ID, + $sourceTable, + SourceInterface::SOURCE_ID + ), + StockSourceLink::SOURCE_ID, + $sourceTable, + SourceInterface::SOURCE_ID, + AdapterInterface::FK_ACTION_CASCADE + )->addIndex( + $setup->getIdxName( + $stockSourceLinkTable, + [ + StockSourceLink::STOCK_ID, + StockSourceLink::SOURCE_ID, + ], + AdapterInterface::INDEX_TYPE_UNIQUE + ), + [ + StockSourceLink::STOCK_ID, + StockSourceLink::SOURCE_ID, + ], + ['type' => AdapterInterface::INDEX_TYPE_UNIQUE] + ); } } diff --git a/app/code/Magento/Inventory/Ui/DataProvider/Product/Form/Modifier/Sources.php b/app/code/Magento/Inventory/Ui/DataProvider/Product/Form/Modifier/Sources.php index df4a4781929c7..db4a194e842c3 100644 --- a/app/code/Magento/Inventory/Ui/DataProvider/Product/Form/Modifier/Sources.php +++ b/app/code/Magento/Inventory/Ui/DataProvider/Product/Form/Modifier/Sources.php @@ -7,9 +7,9 @@ use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier; use Magento\Catalog\Model\Locator\LocatorInterface; +use Magento\Inventory\Model\ResourceModel\Source as SourceResourceModel; use Magento\Inventory\Model\ResourceModel\SourceItem\Collection; use Magento\Inventory\Model\ResourceModel\SourceItem\CollectionFactory; -use Magento\Inventory\Setup\InstallSchema; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceItemInterface; @@ -64,7 +64,7 @@ private function getSourceItemsData() $collection = $this->sourceItemCollectionFactory->create(); $collection->addFilter(SourceItemInterface::SKU, $product->getSku()); $collection->join( - ['s' => InstallSchema::TABLE_NAME_SOURCE], + ['s' => SourceResourceModel::TABLE_NAME_SOURCE], sprintf('s.%s = main_table.%s', SourceInterface::SOURCE_ID, SourceItemInterface::SOURCE_ID), ['source_name' => SourceInterface::NAME] ); From 4be0150671f2ddb10c93cfd01496ed55d4296219 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 24 Jul 2017 13:24:34 +0300 Subject: [PATCH 0341/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../Magento/Inventory/Controller/Adminhtml/Stock/Save.php | 4 ++++ .../Inventory/Model/ResourceModel/SourceCarrierLink.php | 2 +- app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php | 2 +- app/code/Magento/Inventory/Setup/InstallSchema.php | 3 ++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php index 35a4ce69f9b5d..674e322926ef7 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php @@ -11,6 +11,7 @@ use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Exception\CouldNotSaveException; +use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\InventoryApi\Api\Data\StockInterface; use Magento\InventoryApi\Api\Data\StockInterfaceFactory; @@ -90,6 +91,9 @@ public function execute() } catch (CouldNotSaveException $e) { $this->messageManager->addErrorMessage($e->getMessage()); $this->processRedirectAfterFailureSave($resultRedirect, $stockId); + } catch (InputException $e) { + $this->messageManager->addErrorMessage($e->getMessage()); + $this->processRedirectAfterFailureSave($resultRedirect, $stockId); } catch (Exception $e) { $this->messageManager->addErrorMessage(__('Could not save stock.')); $this->processRedirectAfterFailureSave($resultRedirect, $stockId); diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php index da3c59a8a82c9..1cdce71e6662d 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceCarrierLink.php @@ -16,7 +16,7 @@ class SourceCarrierLink extends AbstractDb /**#@+ * Constants related to specific db layer */ - const TABLE_NAME_SOURCE_CARRIER_LINK = 'inventory_source_stock_link'; + const TABLE_NAME_SOURCE_CARRIER_LINK = 'inventory_source_carrier_link'; const ID_FIELD_NAME = 'link_id'; /**#@-*/ diff --git a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php index a6e0e37a5303b..aace60790dd10 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/SourceItem.php @@ -15,7 +15,7 @@ class SourceItem extends AbstractDb /**#@+ * Constants related to specific db layer */ - const TABLE_NAME_SOURCE_ITEM = 'inventory_source_carrier_link'; + const TABLE_NAME_SOURCE_ITEM = 'inventory_source_item'; const ID_FIELD_NAME = 'source_item_id'; /**#@-*/ diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index 36c43f11ce90e..186bdd77235da 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -438,7 +438,8 @@ private function createSourceItemTable(SchemaSetupInterface $setup) * @param SchemaSetupInterface $setup * @return Table */ - private function createStockTable(SchemaSetupInterface $setup) { + private function createStockTable(SchemaSetupInterface $setup) + { $stockTable = $setup->getTable(StockResourceModel::TABLE_NAME_STOCK); return $setup->getConnection()->newTable( From 878e361276cab287bfc1994fc27f86350f1aea8b Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Mon, 24 Jul 2017 11:40:37 +0100 Subject: [PATCH 0342/1004] magento/magento2#10045 tests clean up --- .../Model/CategorySitemapItemResolverTest.php | 14 +- .../Model/CmsPageSitemapItemResolverTest.php | 14 +- .../CompositeSitemapItemResolverTest.php | 4 +- .../Model/ProductSitemapItemResolverTest.php | 8 +- .../Sitemap/Test/Unit/Model/SitemapTest.php | 402 +++++++++--------- 5 files changed, 224 insertions(+), 218 deletions(-) diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php index 6681c5744f037..6bcea418acf68 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php @@ -28,7 +28,7 @@ public function testGetItemsEmpty() $itemFactoryMock = $this->getItemFactoryMock(); $resolver = new CategorySitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); - self::assertSame([], $resolver->getItems(1)); + $this->assertSame([], $resolver->getItems(1)); } /** @@ -49,13 +49,13 @@ public function testGetItems(array $categories) $resolver = new CategorySitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); $items = $resolver->getItems(1); - self::assertTrue(count($items) == count($categories)); + $this->assertTrue(count($items) == count($categories)); foreach ($categories as $index => $category) { - self::assertSame($category->getUpdatedAt(), $items[$index]->getUpdatedAt()); - self::assertSame('daily', $items[$index]->getChangeFrequency()); - self::assertSame('1.0', $items[$index]->getPriority()); - self::assertSame($category->getImages(), $items[$index]->getImages()); - self::assertSame($category->getUrl(), $items[$index]->getUrl()); + $this->assertSame($category->getUpdatedAt(), $items[$index]->getUpdatedAt()); + $this->assertSame('daily', $items[$index]->getChangeFrequency()); + $this->assertSame('1.0', $items[$index]->getPriority()); + $this->assertSame($category->getImages(), $items[$index]->getImages()); + $this->assertSame($category->getUrl(), $items[$index]->getUrl()); } } diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php index 5b55e7ba9658e..c046a34ea5737 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php @@ -29,7 +29,7 @@ public function testGetItemsEmpty() $itemFactoryMock = $this->getItemFactoryMock(); $resolver = new CmsPageSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); - self::assertSame([], $resolver->getItems(1)); + $this->assertSame([], $resolver->getItems(1)); } /** @@ -50,13 +50,13 @@ public function testGetItems(array $pages = []) $resolver = new CmsPageSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); $items = $resolver->getItems(1); - self::assertTrue(count($items) == count($pages)); + $this->assertTrue(count($items) == count($pages)); foreach ($pages as $index => $page) { - self::assertSame($page->getUpdatedAt(), $items[$index]->getUpdatedAt()); - self::assertSame('daily', $items[$index]->getChangeFrequency()); - self::assertSame('1.0', $items[$index]->getPriority()); - self::assertSame($page->getImages(), $items[$index]->getImages()); - self::assertSame($page->getUrl(), $items[$index]->getUrl()); + $this->assertSame($page->getUpdatedAt(), $items[$index]->getUpdatedAt()); + $this->assertSame('daily', $items[$index]->getChangeFrequency()); + $this->assertSame('1.0', $items[$index]->getPriority()); + $this->assertSame($page->getImages(), $items[$index]->getImages()); + $this->assertSame($page->getUrl(), $items[$index]->getUrl()); } } diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php index 6e93c58083d79..4072400608611 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php @@ -15,7 +15,7 @@ class CompositeSitemapItemResolverTest extends \PHPUnit_Framework_TestCase public function testNoResolvers() { $resolver = new CompositeSitemapItemResolver(); - self::assertSame([], $resolver->getItems(1)); + $this->assertSame([], $resolver->getItems(1)); } /** @@ -39,7 +39,7 @@ public function testGetItems($itemResolverData, $expectedItems) $resolver = new CompositeSitemapItemResolver($mockResolvers); $items = $resolver->getItems(1); - self::assertSame($expectedItems, $items); + $this->assertSame($expectedItems, $items); } /** diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php index 38535bb9c47de..190553a51784c 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php @@ -24,8 +24,8 @@ public function testGetItemsEmpty() ProductSitemapItemResolver::XML_PATH_PRODUCT_PRIORITY => '1.0', ]); - $ProductMock = $this->getProductCollectionMock([]); - $cmsPageFactoryMock = $this->getProductFactoryMock($ProductMock); + $productMock = $this->getProductCollectionMock([]); + $cmsPageFactoryMock = $this->getProductFactoryMock($productMock); $itemFactoryMock = $this->getItemFactoryMock(); $resolver = new ProductSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); @@ -43,9 +43,9 @@ public function testGetItems(array $products) ProductSitemapItemResolver::XML_PATH_PRODUCT_PRIORITY => '1.0', ]); - $ProductMock = $this->getProductCollectionMock($products); + $productMock = $this->getProductCollectionMock($products); - $cmsPageFactoryMock = $this->getProductFactoryMock($ProductMock); + $cmsPageFactoryMock = $this->getProductFactoryMock($productMock); $itemFactoryMock = $this->getItemFactoryMock(); $resolver = new ProductSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index f5ce4ad870503..35b3523ce119b 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -5,8 +5,24 @@ */ namespace Magento\Sitemap\Test\Unit\Model; +use Magento\Framework\DataObject; +use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\Write as DirectoryWrite; +use Magento\Framework\Filesystem\File\Write; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Sitemap\Helper\Data; +use Magento\Sitemap\Model\ResourceModel\Catalog\Category; +use Magento\Sitemap\Model\ResourceModel\Catalog\CategoryFactory; +use Magento\Sitemap\Model\ResourceModel\Catalog\Product; +use Magento\Sitemap\Model\ResourceModel\Catalog\ProductFactory; +use Magento\Sitemap\Model\ResourceModel\Cms\Page; +use Magento\Sitemap\Model\ResourceModel\Cms\PageFactory; +use Magento\Sitemap\Model\ResourceModel\Sitemap as SitemapResource; +use Magento\Sitemap\Model\Sitemap; use Magento\Sitemap\Model\SitemapItem; use Magento\Sitemap\Model\SitemapItemResolverInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -14,47 +30,47 @@ class SitemapTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Sitemap\Helper\Data + * @var Data */ protected $_helperMockSitemap; /** - * @var \Magento\Sitemap\Model\ResourceModel\Sitemap + * @var SitemapResource */ protected $_resourceMock; /** - * @var \Magento\Sitemap\Model\ResourceModel\Catalog\Category + * @var Category */ protected $_sitemapCategoryMock; /** - * @var \Magento\Sitemap\Model\ResourceModel\Catalog\Product + * @var Product */ protected $_sitemapProductMock; /** - * @var \Magento\Sitemap\Model\ResourceModel\Cms\Page + * @var Page */ protected $_sitemapCmsPageMock; /** - * @var \Magento\Framework\Filesystem + * @var Filesystem */ protected $_filesystemMock; /** - * @var \Magento\Framework\Filesystem\Directory\Write + * @var DirectoryWrite */ protected $_directoryMock; /** - * @var \Magento\Framework\Filesystem\File\Write + * @var Write */ protected $_fileMock; /** - * @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ private $storeManagerMock; @@ -68,92 +84,70 @@ class SitemapTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->_sitemapCategoryMock = $this->getMockBuilder( - \Magento\Sitemap\Model\ResourceModel\Catalog\Category::class - )->disableOriginalConstructor()->getMock(); - $this->_sitemapProductMock = $this->getMockBuilder( - \Magento\Sitemap\Model\ResourceModel\Catalog\Product::class - )->disableOriginalConstructor()->getMock(); - $this->_sitemapCmsPageMock = $this->getMockBuilder( - \Magento\Sitemap\Model\ResourceModel\Cms\Page::class - )->disableOriginalConstructor()->getMock(); - $this->_helperMockSitemap = $this->getMock( - \Magento\Sitemap\Helper\Data::class, - [ - 'getCategoryChangefreq', - 'getProductChangefreq', - 'getPageChangefreq', - 'getCategoryPriority', - 'getProductPriority', - 'getPagePriority', - 'getMaximumLinesNumber', - 'getMaximumFileSize', - 'getEnableSubmissionRobots' - ], - [], - '', - false, - false - ); - $this->_helperMockSitemap->expects( - $this->any() - )->method( - 'getCategoryChangefreq' - )->will( - $this->returnValue('daily') - ); - $this->_helperMockSitemap->expects( - $this->any() - )->method( - 'getProductChangefreq' - )->will( - $this->returnValue('monthly') - ); - $this->_helperMockSitemap->expects( - $this->any() - )->method( - 'getPageChangefreq' - )->will( - $this->returnValue('daily') - ); - $this->_helperMockSitemap->expects($this->any())->method('getCategoryPriority')->will($this->returnValue('1')); - $this->_helperMockSitemap->expects( - $this->any() - )->method( - 'getProductPriority' - )->will( - $this->returnValue('0.5') - ); - $this->_helperMockSitemap->expects($this->any())->method('getPagePriority')->will($this->returnValue('0.25')); - - $this->_resourceMock = $this->getMockBuilder( - \Magento\Sitemap\Model\ResourceModel\Sitemap::class - )->setMethods( - ['_construct', 'beginTransaction', 'rollBack', 'save', 'addCommitCallback', 'commit', '__wakeup'] - )->disableOriginalConstructor()->getMock(); - $this->_resourceMock->expects($this->any())->method('addCommitCallback')->will($this->returnSelf()); - - $this->_fileMock = $this->getMockBuilder( - \Magento\Framework\Filesystem\File\Write::class - )->disableOriginalConstructor()->getMock(); - - $this->_directoryMock = $this->getMockBuilder( - \Magento\Framework\Filesystem\Directory\Write::class - )->disableOriginalConstructor()->getMock(); - $this->_directoryMock->expects($this->any())->method('openFile')->will($this->returnValue($this->_fileMock)); - - $this->_filesystemMock = $this->getMockBuilder( - \Magento\Framework\Filesystem::class - )->setMethods( - ['getDirectoryWrite'] - )->disableOriginalConstructor()->getMock(); - $this->_filesystemMock->expects( - $this->any() - )->method( - 'getDirectoryWrite' - )->will( - $this->returnValue($this->_directoryMock) - ); + $this->_sitemapCategoryMock = $this->getMockBuilder(Category::class) + ->disableOriginalConstructor() + ->getMock(); + $this->_sitemapProductMock = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); + $this->_sitemapCmsPageMock = $this->getMockBuilder(Page::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->_helperMockSitemap = $this->getMockBuilder(Data::class) + ->setMethods( + [ + 'getCategoryChangefreq', + 'getProductChangefreq', + 'getPageChangefreq', + 'getCategoryPriority', + 'getProductPriority', + 'getPagePriority', + 'getMaximumLinesNumber', + 'getMaximumFileSize', + 'getEnableSubmissionRobots', + ]) + ->disableOriginalConstructor() + ->getMock(); + + $this->_resourceMock = $this->getMockBuilder(SitemapResource::class) + ->setMethods( + [ + '_construct', + 'beginTransaction', + 'rollBack', + 'save', + 'addCommitCallback', + 'commit', + '__wakeup', + ]) + ->disableOriginalConstructor() + ->getMock(); + + $this->_resourceMock->expects($this->any()) + ->method('addCommitCallback') + ->willReturnSelf(); + + $this->_fileMock = $this->getMockBuilder(Write::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->_directoryMock = $this->getMockBuilder(DirectoryWrite::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->_directoryMock->expects($this->any()) + ->method('openFile') + ->willReturn($this->_fileMock); + + $this->_filesystemMock = $this->getMockBuilder(Filesystem::class) + ->setMethods(['getDirectoryWrite']) + ->disableOriginalConstructor() + ->getMock(); + + $this->_filesystemMock->expects($this->any()) + ->method('getDirectoryWrite') + ->willReturn($this->_directoryMock); $this->itemResolverMock = $this->getMockForAbstractClass(SitemapItemResolverInterface::class); } @@ -179,7 +173,9 @@ public function testNotAllowedPath() */ public function testPathNotExists() { - $this->_directoryMock->expects($this->once())->method('isExist')->will($this->returnValue(false)); + $this->_directoryMock->expects($this->once()) + ->method('isExist') + ->willReturn(false); $model = $this->_getModelMock(); $model->beforeSave(); @@ -193,8 +189,13 @@ public function testPathNotExists() */ public function testPathNotWritable() { - $this->_directoryMock->expects($this->once())->method('isExist')->will($this->returnValue(true)); - $this->_directoryMock->expects($this->once())->method('isWritable')->will($this->returnValue(false)); + $this->_directoryMock->expects($this->once()) + ->method('isExist') + ->willReturn(true); + + $this->_directoryMock->expects($this->once()) + ->method('isWritable') + ->willReturn(false); $model = $this->_getModelMock(); $model->beforeSave(); @@ -211,8 +212,13 @@ public function testPathNotWritable() //@codingStandardsIgnoreEnd public function testFilenameInvalidChars() { - $this->_directoryMock->expects($this->once())->method('isExist')->will($this->returnValue(true)); - $this->_directoryMock->expects($this->once())->method('isWritable')->will($this->returnValue(true)); + $this->_directoryMock->expects($this->once()) + ->method('isExist') + ->willReturn(true); + + $this->_directoryMock->expects($this->once()) + ->method('isWritable') + ->willReturn(true); $model = $this->_getModelMock(); $model->setSitemapFilename('*sitemap?.xml'); @@ -244,7 +250,7 @@ public static function sitemapDataProvider() return [ [50000, 10485760, $expectedSingleFile, 6], [1, 10485760, $expectedMultiFile, 18], - [50000, 264, $expectedMultiFile, 18] + [50000, 264, $expectedMultiFile, 18], ]; } @@ -387,7 +393,7 @@ public function testAddSitemapToRobotsTxt($maxLines, $maxFileSize, $expectedFile * @param array $expectedFile * @param int $expectedWrites * @param array $robotsInfo - * @return \Magento\Sitemap\Model\Sitemap|PHPUnit_Framework_MockObject_MockObject + * @return Sitemap|PHPUnit_Framework_MockObject_MockObject * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ protected function _prepareSitemapModelMock( @@ -409,35 +415,30 @@ protected function _prepareSitemapModelMock( }; // Check that all expected lines were written - $this->_fileMock->expects( - $this->exactly($expectedWrites) - )->method( - 'write' - )->will( - $this->returnCallback($streamWriteCallback) - ); + $this->_fileMock->expects($this->exactly($expectedWrites)) + ->method('write') + ->willReturnCallback($streamWriteCallback); // Check that all expected file descriptors were created - $this->_directoryMock->expects($this->exactly(count($expectedFile)))->method('openFile')->will( - $this->returnCallback( - function ($file) use (&$currentFile) { + $this->_directoryMock->expects($this->exactly(count($expectedFile))) + ->method('openFile') + ->willReturnCallback(function ($file) use (&$currentFile) { $currentFile = $file; } - ) - ); + ); // Check that all file descriptors were closed - $this->_fileMock->expects($this->exactly(count($expectedFile)))->method('close'); + $this->_fileMock->expects($this->exactly(count($expectedFile))) + ->method('close'); if (count($expectedFile) == 1) { - $this->_directoryMock->expects($this->once())->method('renameFile')->will( - $this->returnCallback( - function ($from, $to) { + $this->_directoryMock->expects($this->once()) + ->method('renameFile') + ->willReturnCallback(function ($from, $to) { \PHPUnit_Framework_Assert::assertEquals('/sitemap-1-1.xml', $from); \PHPUnit_Framework_Assert::assertEquals('/sitemap.xml', $to); } - ) - ); + ); } // Check robots txt @@ -449,54 +450,50 @@ function ($from, $to) { if (isset($robotsInfo['robotsFinish'])) { $robotsFinish = $robotsInfo['robotsFinish']; } - $this->_directoryMock->expects($this->any())->method('readFile')->will($this->returnValue($robotsStart)); - $this->_directoryMock->expects( - $this->any() - )->method( - 'write' - )->with( - $this->equalTo('robots.txt'), - $this->equalTo($robotsFinish) - ); + $this->_directoryMock->expects($this->any()) + ->method('readFile') + ->willReturn($robotsStart); + + $this->_directoryMock->expects($this->any()) + ->method('write') + ->with( + $this->equalTo('robots.txt'), + $this->equalTo($robotsFinish) + ); // Mock helper methods $pushToRobots = 0; if (isset($robotsInfo['pushToRobots'])) { $pushToRobots = (int)$robotsInfo['pushToRobots']; } - $this->_helperMockSitemap->expects( - $this->any() - )->method( - 'getMaximumLinesNumber' - )->will( - $this->returnValue($maxLines) - ); - $this->_helperMockSitemap->expects( - $this->any() - )->method( - 'getMaximumFileSize' - )->will( - $this->returnValue($maxFileSize) - ); - $this->_helperMockSitemap->expects( - $this->any() - )->method( - 'getEnableSubmissionRobots' - )->will( - $this->returnValue($pushToRobots) - ); + $this->_helperMockSitemap->expects($this->any()) + ->method('getMaximumLinesNumber') + ->willReturn($maxLines); + + $this->_helperMockSitemap->expects($this->any()) + ->method('getMaximumFileSize') + ->willReturn($maxFileSize); + + $this->_helperMockSitemap->expects($this->any()) + ->method('getEnableSubmissionRobots') + ->willReturn($pushToRobots); $model = $this->_getModelMock(true); - $storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) + $storeMock = $this->getMockBuilder(Store::class) ->setMethods(['isFrontUrlSecure', 'getBaseUrl']) ->disableOriginalConstructor() ->getMock(); - $storeMock->expects($this->atLeastOnce())->method('isFrontUrlSecure')->willReturn(false); + + $storeMock->expects($this->atLeastOnce()) + ->method('isFrontUrlSecure') + ->willReturn(false); + $storeMock->expects($this->atLeastOnce()) ->method('getBaseUrl') ->with($this->isType('string'), false) ->willReturn('http://store.com/'); + $this->storeManagerMock->expects($this->atLeastOnce()) ->method('getStore') ->with(1) @@ -509,7 +506,7 @@ function ($from, $to) { * Get model mock object * * @param bool $mockBeforeSave - * @return \Magento\Sitemap\Model\Sitemap|PHPUnit_Framework_MockObject_MockObject + * @return Sitemap|PHPUnit_Framework_MockObject_MockObject */ protected function _getModelMock($mockBeforeSave = false) { @@ -531,7 +528,7 @@ protected function _getModelMock($mockBeforeSave = false) $storeBaseMediaUrl = 'http://store.com/pub/media/catalog/product/cache/c9e0b0ef589f3508e5ba515cde53c5ff/'; - $this->itemResolverMock->expects(self::any()) + $this->itemResolverMock->expects($this->any()) ->method('getItems') ->willReturn([ new SitemapItem('category.html', '1.0', 'daily', '2012-12-21 00:00:00'), @@ -542,15 +539,15 @@ protected function _getModelMock($mockBeforeSave = false) '0.5', 'monthly', '2012-12-21 00:00:00', - new \Magento\Framework\DataObject([ + new DataObject([ 'collection' => [ - new \Magento\Framework\DataObject( + new DataObject( [ 'url' => $storeBaseMediaUrl.'i/m/image1.png', 'caption' => 'caption & > title < "' ] ), - new \Magento\Framework\DataObject( + new DataObject( ['url' => $storeBaseMediaUrl.'i/m/image_no_caption.png', 'caption' => null] ), ], @@ -560,24 +557,23 @@ protected function _getModelMock($mockBeforeSave = false) ) ]); - /** @var $model \Magento\Sitemap\Model\Sitemap */ - $model = $this->getMockBuilder( - \Magento\Sitemap\Model\Sitemap::class - )->setMethods( - $methods - )->setConstructorArgs( - $this->_getModelConstructorArgs() - )->getMock(); - - $model->expects($this->any())->method('_getResource')->will($this->returnValue($this->_resourceMock)); - $model->expects( - $this->any() - )->method( - '_getCurrentDateTime' - )->will( - $this->returnValue('2012-12-21T00:00:00-08:00') - ); - $model->expects($this->any())->method('_getDocumentRoot')->will($this->returnValue('/project')); + /** @var $model Sitemap */ + $model = $this->getMockBuilder(Sitemap::class) + ->setMethods($methods) + ->setConstructorArgs($this->_getModelConstructorArgs()) + ->getMock(); + + $model->expects($this->any()) + ->method('_getResource') + ->willReturn($this->_resourceMock); + + $model->expects($this->any()) + ->method('_getCurrentDateTime') + ->willReturn('2012-12-21T00:00:00-08:00'); + + $model->expects($this->any()) + ->method('_getDocumentRoot') + ->willReturn('/project'); $model->setSitemapFilename('sitemap.xml'); $model->setStoreId(1); @@ -591,25 +587,25 @@ protected function _getModelMock($mockBeforeSave = false) */ protected function _getModelConstructorArgs() { - $categoryFactory = $this->getMockBuilder( - \Magento\Sitemap\Model\ResourceModel\Catalog\CategoryFactory::class - )->disableOriginalConstructor()->getMock(); + $categoryFactory = $this->getMockBuilder(CategoryFactory::class) + ->disableOriginalConstructor() + ->getMock(); - $productFactory = $this->getMockBuilder( - \Magento\Sitemap\Model\ResourceModel\Catalog\ProductFactory::class - )->disableOriginalConstructor()->getMock(); + $productFactory = $this->getMockBuilder(ProductFactory::class) + ->disableOriginalConstructor() + ->getMock(); - $cmsFactory = $this->getMockBuilder( - \Magento\Sitemap\Model\ResourceModel\Cms\PageFactory::class - )->disableOriginalConstructor()->getMock(); + $cmsFactory = $this->getMockBuilder(PageFactory::class) + ->disableOriginalConstructor() + ->getMock(); - $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class) + $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class) ->setMethods(['getStore']) ->getMockForAbstractClass(); - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $objectManager = new ObjectManager($this); $constructArguments = $objectManager->getConstructArguments( - \Magento\Sitemap\Model\Sitemap::class, + Sitemap::class, [ 'categoryFactory' => $categoryFactory, 'productFactory' => $productFactory, @@ -637,20 +633,30 @@ protected function _getModelConstructorArgs() */ public function testGetSitemapUrl($storeBaseUrl, $documentRoot, $baseDir, $sitemapPath, $sitemapFileName, $result) { - /** @var $model \Magento\Sitemap\Model\Sitemap */ - $model = $this->getMockBuilder( - \Magento\Sitemap\Model\Sitemap::class - )->setMethods( - ['_getStoreBaseUrl', '_getDocumentRoot', '_getBaseDir', '_construct'] - )->setConstructorArgs( - $this->_getModelConstructorArgs() - )->getMock(); + /** @var $model Sitemap */ + $model = $this->getMockBuilder(Sitemap::class) + ->setMethods( + [ + '_getStoreBaseUrl', + '_getDocumentRoot', + '_getBaseDir', + '_construct', + ] + ) + ->setConstructorArgs($this->_getModelConstructorArgs()) + ->getMock(); - $model->expects($this->any())->method('_getStoreBaseUrl')->will($this->returnValue($storeBaseUrl)); + $model->expects($this->any()) + ->method('_getStoreBaseUrl') + ->willReturn($storeBaseUrl); - $model->expects($this->any())->method('_getDocumentRoot')->will($this->returnValue($documentRoot)); + $model->expects($this->any()) + ->method('_getDocumentRoot') + ->willReturn($documentRoot); - $model->expects($this->any())->method('_getBaseDir')->will($this->returnValue($baseDir)); + $model->expects($this->any()) + ->method('_getBaseDir') + ->willReturn($baseDir); $this->assertEquals($result, $model->getSitemapUrl($sitemapPath, $sitemapFileName)); } From 7ab108a9c0a2ca0d34df25186baf6beb5f0607ea Mon Sep 17 00:00:00 2001 From: dmanners Date: Mon, 24 Jul 2017 13:50:20 +0000 Subject: [PATCH 0343/1004] Update the class and method comment to highlight that this should only be used in a single case --- .../Magento/Framework/Serialize/JsonConverter.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Serialize/JsonConverter.php b/lib/internal/Magento/Framework/Serialize/JsonConverter.php index b9b72cad10d2a..6f6fdfb249408 100644 --- a/lib/internal/Magento/Framework/Serialize/JsonConverter.php +++ b/lib/internal/Magento/Framework/Serialize/JsonConverter.php @@ -6,14 +6,17 @@ namespace Magento\Framework\Serialize; /** - * Used to convert \Magento\Framework\DataObject to Json - * - * @deprecated @see \Magento\Framework\Serialize\Serializer\Json::serialize + * This class was introducted only for usage in the \Magento\Framework\DataObject::toJson method. + * It should not be used in other cases and instead \Magento\Framework\Serialize\Serializer\Json::serialize + * should be used. */ class JsonConverter { /** - * @param $data + * This method should only be used by \Magento\Framework\DataObject::toJson + * All other cases should use \Magento\Framework\Serialize\Serializer\Json::serialize directly + * + * @param string|int|float|bool|array|null $data * @return bool|string * @throws \InvalidArgumentException */ From b0d34c1fd865c12ed66588ebac29050020e7e76a Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Mon, 24 Jul 2017 18:21:26 +0300 Subject: [PATCH 0344/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../Controller/Adminhtml/Stock/StockSourceLinkProcessor.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php index 2794cec0d8598..7f871e8d83941 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php @@ -76,11 +76,11 @@ public function process($stockId, array $stockSourceLinksData) $this->validateStockSourceData($stockSourceLinksData); $assignedSources = $this->getAssignedSourcesForStock->execute($stockId); - $sourceIdsForSave = array_column($stockSourceLinksData, StockSourceLink::SOURCE_ID); + $sourceIdsForSave = array_flip(array_column($stockSourceLinksData, StockSourceLink::SOURCE_ID)); $sourceIdsForDelete = []; foreach ($assignedSources as $assignedSource) { - if (in_array($assignedSource->getSourceId(), $sourceIdsForSave)) { + if (array_key_exists($assignedSource->getSourceId(), $sourceIdsForSave)) { unset($sourceIdsForSave[$assignedSource->getSourceId()]); } else { $sourceIdsForDelete[] = $assignedSource->getSourceId(); @@ -88,7 +88,7 @@ public function process($stockId, array $stockSourceLinksData) } if (!empty($sourceIdsForSave)) { - $this->assignSourcesToStock->execute($stockId, $sourceIdsForSave); + $this->assignSourcesToStock->execute($stockId, array_keys($sourceIdsForSave)); } foreach ($sourceIdsForDelete as $sourceIdForDelete) { $this->unassignSourceFromStock->execute($stockId, $sourceIdForDelete); From b6ddaa73d5b7e4448a199b82283893aa7a79ce34 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Mon, 24 Jul 2017 22:36:32 +0100 Subject: [PATCH 0345/1004] magento/magento2#10045 add item resolver configs, sitemap config, clean up tests --- app/code/Magento/Sitemap/Helper/Data.php | 29 ++++ .../Model/CategorySitemapItemResolver.php | 109 ------------- .../Model/CmsPageSitemapItemResolver.php | 110 ------------- .../Sitemap/Model/ItemResolver/Category.php | 72 +++++++++ .../ItemResolver/CategoryConfigReader.php | 61 ++++++++ .../Sitemap/Model/ItemResolver/CmsPage.php | 70 +++++++++ .../ItemResolver/CmsPageConfigReader.php | 61 ++++++++ .../Composite.php} | 11 +- .../ItemResolver/ConfigReaderInterface.php | 31 ++++ .../ItemResolverInterface.php} | 6 +- .../Sitemap/Model/ItemResolver/Product.php | 72 +++++++++ .../ItemResolver/ProductConfigReader.php | 61 ++++++++ .../Model/ProductSitemapItemResolver.php | 108 ------------- app/code/Magento/Sitemap/Model/Sitemap.php | 62 ++++---- .../Sitemap/Model/SitemapConfigReader.php | 116 ++++++++++++++ .../Model/SitemapConfigReaderInterface.php | 54 +++++++ .../Sitemap/Test/Unit/Helper/DataTest.php | 44 ------ .../CategoryTest.php} | 67 ++++---- .../CmsPageTest.php} | 50 +++--- .../CompositeTest.php} | 14 +- .../ProductTest.php} | 66 ++++---- .../Unit/Model/SitemapConfigReaderTest.php | 39 +++++ .../Sitemap/Test/Unit/Model/SitemapTest.php | 145 +++++++++--------- app/code/Magento/Sitemap/etc/di.xml | 27 +++- .../Magento/Sitemap/Helper/DataTest.php | 138 ----------------- .../ItemResolver/CategoryConfigReaderTest.php | 41 +++++ .../ItemResolver/CmsPageConfigReaderTest.php | 41 +++++ .../ItemResolver/ProductConfigReaderTest.php | 41 +++++ .../Sitemap/Model/SitemapConfigReaderTest.php | 67 ++++++++ 29 files changed, 1084 insertions(+), 729 deletions(-) delete mode 100644 app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php delete mode 100644 app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php create mode 100644 app/code/Magento/Sitemap/Model/ItemResolver/Category.php create mode 100644 app/code/Magento/Sitemap/Model/ItemResolver/CategoryConfigReader.php create mode 100644 app/code/Magento/Sitemap/Model/ItemResolver/CmsPage.php create mode 100644 app/code/Magento/Sitemap/Model/ItemResolver/CmsPageConfigReader.php rename app/code/Magento/Sitemap/Model/{CompositeSitemapItemResolver.php => ItemResolver/Composite.php} (70%) create mode 100644 app/code/Magento/Sitemap/Model/ItemResolver/ConfigReaderInterface.php rename app/code/Magento/Sitemap/Model/{SitemapItemResolverInterface.php => ItemResolver/ItemResolverInterface.php} (71%) create mode 100644 app/code/Magento/Sitemap/Model/ItemResolver/Product.php create mode 100644 app/code/Magento/Sitemap/Model/ItemResolver/ProductConfigReader.php delete mode 100644 app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php create mode 100644 app/code/Magento/Sitemap/Model/SitemapConfigReader.php create mode 100644 app/code/Magento/Sitemap/Model/SitemapConfigReaderInterface.php delete mode 100644 app/code/Magento/Sitemap/Test/Unit/Helper/DataTest.php rename app/code/Magento/Sitemap/Test/Unit/Model/{CategorySitemapItemResolverTest.php => ItemResolver/CategoryTest.php} (64%) rename app/code/Magento/Sitemap/Test/Unit/Model/{CmsPageSitemapItemResolverTest.php => ItemResolver/CmsPageTest.php} (72%) rename app/code/Magento/Sitemap/Test/Unit/Model/{CompositeSitemapItemResolverTest.php => ItemResolver/CompositeTest.php} (78%) rename app/code/Magento/Sitemap/Test/Unit/Model/{ProductSitemapItemResolverTest.php => ItemResolver/ProductTest.php} (72%) create mode 100644 app/code/Magento/Sitemap/Test/Unit/Model/SitemapConfigReaderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/CategoryConfigReaderTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/CmsPageConfigReaderTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/ProductConfigReaderTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Sitemap/Model/SitemapConfigReaderTest.php diff --git a/app/code/Magento/Sitemap/Helper/Data.php b/app/code/Magento/Sitemap/Helper/Data.php index cc3e6ec3cb9ab..6dc2346aa0b87 100644 --- a/app/code/Magento/Sitemap/Helper/Data.php +++ b/app/code/Magento/Sitemap/Helper/Data.php @@ -10,8 +10,15 @@ */ namespace Magento\Sitemap\Helper; +use Magento\Sitemap\Model\ItemResolver\CategoryConfigReader; +use Magento\Sitemap\Model\ItemResolver\CmsPageConfigReader; +use Magento\Sitemap\Model\ItemResolver\ProductConfigReader; +use Magento\Sitemap\Model\SitemapConfigReader; use Magento\Store\Model\ScopeInterface; +/** + * @deprecated + */ class Data extends \Magento\Framework\App\Helper\AbstractHelper { /** @@ -68,6 +75,8 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * * @param int $storeId * @return int + * @deprecated + * @see SitemapConfigReader::getMaximumLinesNumber() */ public function getMaximumLinesNumber($storeId) { @@ -83,6 +92,8 @@ public function getMaximumLinesNumber($storeId) * * @param int $storeId * @return int + * @deprecated + * @see SitemapConfigReader::getMaximumFileSize() */ public function getMaximumFileSize($storeId) { @@ -98,6 +109,8 @@ public function getMaximumFileSize($storeId) * * @param int $storeId * @return string + * @deprecated + * @see CategoryConfigReader::getChangeFrequency() */ public function getCategoryChangefreq($storeId) { @@ -113,6 +126,8 @@ public function getCategoryChangefreq($storeId) * * @param int $storeId * @return string + * @deprecated + * @see ProductConfigReader::getChangeFrequency() */ public function getProductChangefreq($storeId) { @@ -128,6 +143,8 @@ public function getProductChangefreq($storeId) * * @param int $storeId * @return string + * @deprecated + * @see CmsPageConfigReader::getChangeFrequency() */ public function getPageChangefreq($storeId) { @@ -143,6 +160,8 @@ public function getPageChangefreq($storeId) * * @param int $storeId * @return string + * @deprecated + * @see CategoryConfigReader::getPriority() */ public function getCategoryPriority($storeId) { @@ -158,6 +177,8 @@ public function getCategoryPriority($storeId) * * @param int $storeId * @return string + * @deprecated + * @see ProductConfigReader::getPriority() */ public function getProductPriority($storeId) { @@ -173,6 +194,8 @@ public function getProductPriority($storeId) * * @param int $storeId * @return string + * @deprecated + * @see CmsPageConfigReader::getPriority() */ public function getPagePriority($storeId) { @@ -188,6 +211,8 @@ public function getPagePriority($storeId) * * @param int $storeId * @return int + * @deprecated + * @see SitemapConfigReader::getEnableSubmissionRobots() */ public function getEnableSubmissionRobots($storeId) { @@ -203,6 +228,8 @@ public function getEnableSubmissionRobots($storeId) * * @param int $storeId * @return string + * @deprecated + * @see SitemapConfigReader::getProductImageIncludePolicy() */ public function getProductImageIncludePolicy($storeId) { @@ -217,6 +244,8 @@ public function getProductImageIncludePolicy($storeId) * Get list valid paths for generate a sitemap XML file * * @return string[] + * @deprecated + * @see SitemapConfigReader::getValidPaths() */ public function getValidPaths() { diff --git a/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php b/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php deleted file mode 100644 index f4653c322cef1..0000000000000 --- a/app/code/Magento/Sitemap/Model/CategorySitemapItemResolver.php +++ /dev/null @@ -1,109 +0,0 @@ -categoryFactory = $categoryFactory; - $this->itemFactory = $itemFactory; - $this->scopeConfig = $scopeConfig; - } - - /** - * {@inheritdoc} - */ - public function getItems($storeId) - { - $collection = $this->categoryFactory->create()->getCollection($storeId); - $items = array_map(function ($item) use ($storeId) { - return $this->itemFactory->create([ - 'url' => $item->getUrl(), - 'updatedAt' => $item->getUpdatedAt(), - 'images' => $item->getImages(), - 'priority' => $this->getCategoryPriority($storeId), - 'changeFrequency' => $this->getCategoryChangeFrequency($storeId), - ]); - }, $collection); - - return $items; - } - - /** - * Get page priority - * - * @param int $storeId - * @return string - */ - private function getCategoryPriority($storeId) - { - return (string)$this->scopeConfig->getValue( - self::XML_PATH_CATEGORY_PRIORITY, - ScopeInterface::SCOPE_STORE, - $storeId - ); - } - - /** - * Get page change frequency - * - * @param int $storeId - * @return string - */ - private function getCategoryChangeFrequency($storeId) - { - return (string)$this->scopeConfig->getValue( - self::XML_PATH_CATEGORY_CHANGEFREQ, - ScopeInterface::SCOPE_STORE, - $storeId - ); - } -} diff --git a/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php deleted file mode 100644 index dab431e060ebc..0000000000000 --- a/app/code/Magento/Sitemap/Model/CmsPageSitemapItemResolver.php +++ /dev/null @@ -1,110 +0,0 @@ -scopeConfig = $scopeConfig; - $this->cmsPageFactory = $cmsPageFactory; - $this->itemFactory = $itemFactory; - } - - /** - * {@inheritdoc} - */ - public function getItems($storeId) - { - $collection = $this->cmsPageFactory->create()->getCollection($storeId); - $items = array_map(function ($item) use ($storeId) { - return $this->itemFactory->create([ - 'url' => $item->getUrl(), - 'updatedAt' => $item->getUpdatedAt(), - 'images' => $item->getImages(), - 'priority' => $this->getPagePriority($storeId), - 'changeFrequency' => $this->getPageChangeFrequency($storeId), - ]); - }, $collection); - - return $items; - } - - /** - * Get page priority - * - * @param int $storeId - * @return string - */ - private function getPagePriority($storeId) - { - return (string)$this->scopeConfig->getValue( - self::XML_PATH_PAGE_PRIORITY, - ScopeInterface::SCOPE_STORE, - $storeId - ); - } - - /** - * Get page change frequency - * - * @param int $storeId - * @return string - */ - private function getPageChangeFrequency($storeId) - { - return (string)$this->scopeConfig->getValue( - self::XML_PATH_PAGE_CHANGEFREQ, - ScopeInterface::SCOPE_STORE, - $storeId - ); - } -} diff --git a/app/code/Magento/Sitemap/Model/ItemResolver/Category.php b/app/code/Magento/Sitemap/Model/ItemResolver/Category.php new file mode 100644 index 0000000000000..e95be6519d509 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/ItemResolver/Category.php @@ -0,0 +1,72 @@ +categoryFactory = $categoryFactory; + $this->itemFactory = $itemFactory; + $this->configReader = $configReader; + } + + /** + * {@inheritdoc} + */ + public function getItems($storeId) + { + $collection = $this->categoryFactory->create() + ->getCollection($storeId); + + $items = array_map(function ($item) use ($storeId) { + return $this->itemFactory->create([ + 'url' => $item->getUrl(), + 'updatedAt' => $item->getUpdatedAt(), + 'images' => $item->getImages(), + 'priority' => $this->configReader->getPriority($storeId), + 'changeFrequency' => $this->configReader->getChangeFrequency($storeId), + ]); + }, $collection); + + return $items; + } +} diff --git a/app/code/Magento/Sitemap/Model/ItemResolver/CategoryConfigReader.php b/app/code/Magento/Sitemap/Model/ItemResolver/CategoryConfigReader.php new file mode 100644 index 0000000000000..7f6622825dd28 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/ItemResolver/CategoryConfigReader.php @@ -0,0 +1,61 @@ +scopeConfig = $scopeConfig; + } + + /** + * {@inheritdoc} + */ + public function getPriority($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_PRIORITY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * {@inheritdoc} + */ + public function getChangeFrequency($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_CHANGE_FREQUENCY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } +} diff --git a/app/code/Magento/Sitemap/Model/ItemResolver/CmsPage.php b/app/code/Magento/Sitemap/Model/ItemResolver/CmsPage.php new file mode 100644 index 0000000000000..f46cf5b310f30 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/ItemResolver/CmsPage.php @@ -0,0 +1,70 @@ +cmsPageFactory = $cmsPageFactory; + $this->itemFactory = $itemFactory; + $this->configReader = $configReader; + } + + /** + * {@inheritdoc} + */ + public function getItems($storeId) + { + $collection = $this->cmsPageFactory->create()->getCollection($storeId); + $items = array_map(function ($item) use ($storeId) { + return $this->itemFactory->create([ + 'url' => $item->getUrl(), + 'updatedAt' => $item->getUpdatedAt(), + 'images' => $item->getImages(), + 'priority' => $this->configReader->getPriority($storeId), + 'changeFrequency' => $this->configReader->getChangeFrequency($storeId), + ]); + }, $collection); + + return $items; + } +} diff --git a/app/code/Magento/Sitemap/Model/ItemResolver/CmsPageConfigReader.php b/app/code/Magento/Sitemap/Model/ItemResolver/CmsPageConfigReader.php new file mode 100644 index 0000000000000..6139c9c46b680 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/ItemResolver/CmsPageConfigReader.php @@ -0,0 +1,61 @@ +scopeConfig = $scopeConfig; + } + + /** + * {@inheritdoc} + */ + public function getPriority($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_PRIORITY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * {@inheritdoc} + */ + public function getChangeFrequency($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_CHANGE_FREQUENCY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } +} diff --git a/app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/ItemResolver/Composite.php similarity index 70% rename from app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php rename to app/code/Magento/Sitemap/Model/ItemResolver/Composite.php index d5c5a80624126..f60b07e18620a 100644 --- a/app/code/Magento/Sitemap/Model/CompositeSitemapItemResolver.php +++ b/app/code/Magento/Sitemap/Model/ItemResolver/Composite.php @@ -4,22 +4,21 @@ * See COPYING.txt for license details. */ -namespace Magento\Sitemap\Model; +namespace Magento\Sitemap\Model\ItemResolver; - -class CompositeSitemapItemResolver implements SitemapItemResolverInterface +class Composite implements ItemResolverInterface { /** * Item resolvers * - * @var SitemapItemResolverInterface[] + * @var ItemResolverInterface[] */ private $itemResolvers; /** - * CompositeSitemapItemResolver constructor. + * Composite constructor. * - * @param SitemapItemResolverInterface[] $itemResolvers + * @param ItemResolverInterface[] $itemResolvers */ public function __construct($itemResolvers = []) { diff --git a/app/code/Magento/Sitemap/Model/ItemResolver/ConfigReaderInterface.php b/app/code/Magento/Sitemap/Model/ItemResolver/ConfigReaderInterface.php new file mode 100644 index 0000000000000..49d33bf4f39a7 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/ItemResolver/ConfigReaderInterface.php @@ -0,0 +1,31 @@ +productFactory = $productFactory; + $this->itemFactory = $itemFactory; + $this->configReader = $configReader; + } + + /** + * {@inheritdoc} + */ + public function getItems($storeId) + { + $collection = $this->productFactory->create() + ->getCollection($storeId); + + $items = array_map(function ($item) use ($storeId) { + return $this->itemFactory->create([ + 'url' => $item->getUrl(), + 'updatedAt' => $item->getUpdatedAt(), + 'images' => $item->getImages(), + 'priority' => $this->configReader->getPriority($storeId), + 'changeFrequency' => $this->configReader->getChangeFrequency($storeId), + ]); + }, $collection); + + return $items; + } +} diff --git a/app/code/Magento/Sitemap/Model/ItemResolver/ProductConfigReader.php b/app/code/Magento/Sitemap/Model/ItemResolver/ProductConfigReader.php new file mode 100644 index 0000000000000..c8a1df24a6f74 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/ItemResolver/ProductConfigReader.php @@ -0,0 +1,61 @@ +scopeConfig = $scopeConfig; + } + + /** + * {@inheritdoc} + */ + public function getPriority($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_PRIORITY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * {@inheritdoc} + */ + public function getChangeFrequency($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_CHANGE_FREQUENCY, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } +} diff --git a/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php b/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php deleted file mode 100644 index b11fd3c6aadd9..0000000000000 --- a/app/code/Magento/Sitemap/Model/ProductSitemapItemResolver.php +++ /dev/null @@ -1,108 +0,0 @@ -scopeConfig = $scopeConfig; - $this->productFactory = $productFactory; - $this->itemFactory = $itemFactory; - } - - /** - * {@inheritdoc} - */ - public function getItems($storeId) - { - $collection = $this->productFactory->create()->getCollection($storeId); - $items = array_map(function ($item) use ($storeId) { - return $this->itemFactory->create([ - 'url' => $item->getUrl(), - 'updatedAt' => $item->getUpdatedAt(), - 'images' => $item->getImages(), - 'priority' => $this->getProductPriority($storeId), - 'changeFrequency' => $this->getProductChangeFrequency($storeId), - ]); - }, $collection); - - return $items; - } - - /** - * Get page priority - * - * @param int $storeId - * @return string - */ - private function getProductPriority($storeId) - { - return (string)$this->scopeConfig->getValue( - self::XML_PATH_PRODUCT_PRIORITY, - ScopeInterface::SCOPE_STORE, - $storeId - ); - } - - /** - * Get page change frequency - * - * @param int $storeId - * @return string - */ - private function getProductChangeFrequency($storeId) - { - return (string)$this->scopeConfig->getValue( - self::XML_PATH_PRODUCT_CHANGEFREQ, - ScopeInterface::SCOPE_STORE, - $storeId - ); - } -} diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index cd1c8dc9fbf06..a3f1e85400246 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -10,13 +10,17 @@ use Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot; use Magento\Framework\App\ObjectManager; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\UrlInterface; use Magento\Robots\Model\Config\Value; +use Magento\Sitemap\Model\ItemResolver\ItemResolverInterface; +use Magento\Sitemap\Model\ResourceModel\Sitemap as SitemapResource; /** * Sitemap model * - * @method \Magento\Sitemap\Model\ResourceModel\Sitemap _getResource() - * @method \Magento\Sitemap\Model\ResourceModel\Sitemap getResource() + * @method SitemapResource _getResource() + * @method SitemapResource getResource() * @method string getSitemapType() * @method \Magento\Sitemap\Model\Sitemap setSitemapType(string $value) * @method string getSitemapFilename() @@ -159,10 +163,17 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento /** * Item resolver * - * @var SitemapItemResolverInterface + * @var ItemResolverInterface */ private $itemResolver; + /** + * Sitemap config reader + * + * @var SitemapConfigReaderInterface + */ + private $configReader; + /** * Initialize dependencies. * @@ -182,7 +193,8 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection * @param array $data * @param DocumentRoot|null $documentRoot - * @param SitemapItemResolverInterface|null $itemResolver + * @param ItemResolverInterface|null $itemResolver + * @param SitemapConfigReaderInterface|null $configReader * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -202,7 +214,8 @@ public function __construct( \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [], \Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot $documentRoot = null, - SitemapItemResolverInterface $itemResolver = null + ItemResolverInterface $itemResolver = null, + SitemapConfigReaderInterface $configReader = null ) { $this->_escaper = $escaper; $this->_sitemapData = $sitemapData; @@ -215,7 +228,8 @@ public function __construct( $this->_storeManager = $storeManager; $this->_request = $request; $this->dateTime = $dateTime; - $this->itemResolver = $itemResolver ?: ObjectManager::getInstance()->get(SitemapItemResolverInterface::class); + $this->itemResolver = $itemResolver ?: ObjectManager::getInstance()->get(ItemResolverInterface::class); + $this->configReader = $configReader ?: ObjectManager::getInstance()->get(SitemapConfigReaderInterface::class); parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -227,21 +241,21 @@ public function __construct( */ protected function _construct() { - $this->_init(\Magento\Sitemap\Model\ResourceModel\Sitemap::class); + $this->_init(SitemapResource::class); } /** * Get file handler * * @return \Magento\Framework\Filesystem\File\WriteInterface - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException */ protected function _getStream() { if ($this->_stream) { return $this->_stream; } else { - throw new \Magento\Framework\Exception\LocalizedException(__('File handler unreachable')); + throw new LocalizedException(__('File handler unreachable')); } } @@ -278,7 +292,7 @@ protected function _initSitemapItems() * Check sitemap file location and permissions * * @return \Magento\Framework\Model\AbstractModel - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException */ public function beforeSave() { @@ -288,13 +302,13 @@ public function beforeSave() * Check path is allow */ if ($path && preg_match('#\.\.[\\\/]#', $path)) { - throw new \Magento\Framework\Exception\LocalizedException(__('Please define a correct path.')); + throw new LocalizedException(__('Please define a correct path.')); } /** * Check exists and writable path */ if (!$this->_directory->isExist($path)) { - throw new \Magento\Framework\Exception\LocalizedException( + throw new LocalizedException( __( 'Please create the specified folder "%1" before saving the sitemap.', $this->_escaper->escapeHtml($this->getSitemapPath()) @@ -303,7 +317,7 @@ public function beforeSave() } if (!$this->_directory->isWritable($path)) { - throw new \Magento\Framework\Exception\LocalizedException( + throw new LocalizedException( __('Please make sure that "%1" is writable by the web-server.', $this->getSitemapPath()) ); } @@ -311,7 +325,7 @@ public function beforeSave() * Check allow filename */ if (!preg_match('#^[a-zA-Z0-9_\.]+$#', $this->getSitemapFilename())) { - throw new \Magento\Framework\Exception\LocalizedException( + throw new LocalizedException( __( 'Please use only letters (a-z or A-Z), numbers (0-9) or underscores (_) in the filename. No spaces or other characters are allowed.' ) @@ -418,14 +432,12 @@ protected function _getCurrentDateTime() */ protected function _isSplitRequired($row) { - /** @var $helper \Magento\Sitemap\Helper\Data */ - $helper = $this->_sitemapData; $storeId = $this->getStoreId(); - if ($this->_lineCount + 1 > $helper->getMaximumLinesNumber($storeId)) { + if ($this->_lineCount + 1 > $this->configReader->getMaximumLinesNumber($storeId)) { return true; } - if ($this->_fileSize + strlen($row) > $helper->getMaximumFileSize($storeId)) { + if ($this->_fileSize + strlen($row) > $this->configReader->getMaximumFileSize($storeId)) { return true; } @@ -505,7 +517,7 @@ protected function _getSitemapIndexRow($sitemapFilename, $lastmod = null) * @param null|string $fileName * @param string $type * @return void - * @throws \Magento\Framework\Exception\LocalizedException + * @throws LocalizedException */ protected function _createSitemap($fileName = null, $type = self::TYPE_URL) { @@ -578,7 +590,7 @@ protected function _getBaseDir() * @param string $type * @return string */ - protected function _getStoreBaseUrl($type = \Magento\Framework\UrlInterface::URL_TYPE_LINK) + protected function _getStoreBaseUrl($type = UrlInterface::URL_TYPE_LINK) { /** @var \Magento\Store\Model\Store $store */ $store = $this->_storeManager->getStore($this->getStoreId()); @@ -593,7 +605,7 @@ protected function _getStoreBaseUrl($type = \Magento\Framework\UrlInterface::URL * @param string $type * @return string */ - protected function _getUrl($url, $type = \Magento\Framework\UrlInterface::URL_TYPE_LINK) + protected function _getUrl($url, $type = UrlInterface::URL_TYPE_LINK) { return $this->_getStoreBaseUrl($type) . ltrim($url, '/'); } @@ -608,7 +620,7 @@ protected function _getUrl($url, $type = \Magento\Framework\UrlInterface::URL_TY */ protected function _getMediaUrl($url) { - return $this->_getUrl($url, \Magento\Framework\UrlInterface::URL_TYPE_MEDIA); + return $this->_getUrl($url, UrlInterface::URL_TYPE_MEDIA); } /** @@ -651,7 +663,7 @@ protected function _getStoreBaseDomain() $storeDomain = rtrim($url . '/' . $installationFolder, '/'); } else { //case when documentRoot contains symlink to basedir - $url = $this->_getStoreBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB); + $url = $this->_getStoreBaseUrl(UrlInterface::URL_TYPE_WEB); $storeDomain = rtrim($url, '/'); } @@ -679,10 +691,8 @@ public function getSitemapUrl($sitemapPath, $sitemapFileName) */ protected function _isEnabledSubmissionRobots() { - /** @var $helper \Magento\Sitemap\Helper\Data */ - $helper = $this->_sitemapData; $storeId = $this->getStoreId(); - return (bool)$helper->getEnableSubmissionRobots($storeId); + return (bool)$this->configReader->getEnableSubmissionRobots($storeId); } /** diff --git a/app/code/Magento/Sitemap/Model/SitemapConfigReader.php b/app/code/Magento/Sitemap/Model/SitemapConfigReader.php new file mode 100644 index 0000000000000..201e80d281ca3 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/SitemapConfigReader.php @@ -0,0 +1,116 @@ +scopeConfig = $scopeConfig; + } + + /** + * {@inheritdoc} + */ + public function getEnableSubmissionRobots($storeId) + { + return $this->scopeConfig->getValue( + self::XML_PATH_SUBMISSION_ROBOTS, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * {@inheritdoc} + */ + public function getMaximumFileSize($storeId) + { + return $this->scopeConfig->getValue( + self::XML_PATH_MAX_FILE_SIZE, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * {@inheritdoc} + */ + public function getMaximumLinesNumber($storeId) + { + return $this->scopeConfig->getValue( + self::XML_PATH_MAX_LINES, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * {@inheritdoc} + */ + public function getProductImageIncludePolicy($storeId) + { + return (string)$this->scopeConfig->getValue( + self::XML_PATH_PRODUCT_IMAGES_INCLUDE, + ScopeInterface::SCOPE_STORE, + $storeId + ); + } + + /** + * {@inheritdoc} + */ + public function getValidPaths() + { + return array_merge( + $this->scopeConfig->getValue(self::XML_PATH_SITEMAP_VALID_PATHS, ScopeInterface::SCOPE_STORE), + $this->scopeConfig->getValue(self::XML_PATH_PUBLIC_FILES_VALID_PATHS, ScopeInterface::SCOPE_STORE) + ); + } +} diff --git a/app/code/Magento/Sitemap/Model/SitemapConfigReaderInterface.php b/app/code/Magento/Sitemap/Model/SitemapConfigReaderInterface.php new file mode 100644 index 0000000000000..f094b8856ab14 --- /dev/null +++ b/app/code/Magento/Sitemap/Model/SitemapConfigReaderInterface.php @@ -0,0 +1,54 @@ +getConstructArguments($className); - /** @var \Magento\Framework\App\Helper\Context $context */ - $context = $arguments['context']; - $this->scopeConfig = $context->getScopeConfig(); - $this->data = $objectManagerHelper->getObject($className, $arguments); - } - - public function testGetValidPaths() - { - $this->scopeConfig->expects($this->any())->method('getValue')->will($this->returnValueMap( - [ - [Data::XML_PATH_SITEMAP_VALID_PATHS, ScopeInterface::SCOPE_STORE, null, ['path1']], - [Data::XML_PATH_PUBLIC_FILES_VALID_PATHS, ScopeInterface::SCOPE_STORE, null, ['path2']], - ] - )); - - $this->assertEquals(['path1', 'path2'], $this->data->getValidPaths()); - } -} diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CategoryTest.php similarity index 64% rename from app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php rename to app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CategoryTest.php index 6bcea418acf68..0d46f6b75e6c7 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CategorySitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CategoryTest.php @@ -4,30 +4,28 @@ * See COPYING.txt for license details. */ -namespace Magento\Sitemap\Test\Unit\Model; +namespace Magento\Sitemap\Test\Unit\Model\ItemResolver; -use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Sitemap\Model\CategorySitemapItemResolver; -use Magento\Sitemap\Model\ResourceModel\Catalog\Category; +use Magento\Sitemap\Model\ItemResolver\Category as CategoryItemResolver; +use Magento\Sitemap\Model\ItemResolver\ConfigReaderInterface; +use Magento\Sitemap\Model\ResourceModel\Catalog\Category as CategoryResource; +use Magento\Sitemap\Model\ResourceModel\Catalog\CategoryFactory; use Magento\Sitemap\Model\SitemapItem; use Magento\Sitemap\Model\SitemapItemInterfaceFactory; -use Magento\Sitemap\Model\ResourceModel\Catalog\CategoryFactory; -class CategorySitemapItemResolverTest extends \PHPUnit_Framework_TestCase +class CategoryTest extends \PHPUnit_Framework_TestCase { public function testGetItemsEmpty() { - $storeConfigMock = $this->getStoreConfigMock([ - CategorySitemapItemResolver::XML_PATH_CATEGORY_CHANGEFREQ => 'daily', - CategorySitemapItemResolver::XML_PATH_CATEGORY_PRIORITY => '1.0', - ]); - + $configReaderMock = $this->getConfigReaderMock(); $categoryMock = $this->getCategoryCollectionMock([]); - $cmsPageFactoryMock = $this->getCategoryFactoryMock($categoryMock); + $categoryFactoryMock = $this->getCategoryFactoryMock($categoryMock); $itemFactoryMock = $this->getItemFactoryMock(); - $resolver = new CategorySitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + $resolver = new CategoryItemResolver($configReaderMock, $categoryFactoryMock, $itemFactoryMock); + $this->assertSame([], $resolver->getItems(1)); } @@ -37,18 +35,14 @@ public function testGetItemsEmpty() */ public function testGetItems(array $categories) { - $storeConfigMock = $this->getStoreConfigMock([ - CategorySitemapItemResolver::XML_PATH_CATEGORY_CHANGEFREQ => 'daily', - CategorySitemapItemResolver::XML_PATH_CATEGORY_PRIORITY => '1.0', - ]); - + $configReaderMock = $this->getConfigReaderMock(); $categoryMock = $this->getCategoryCollectionMock($categories); - - $cmsPageFactoryMock = $this->getCategoryFactoryMock($categoryMock); + $categoryFactoryMock = $this->getCategoryFactoryMock($categoryMock); $itemFactoryMock = $this->getItemFactoryMock(); - $resolver = new CategorySitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + $resolver = new CategoryItemResolver($configReaderMock, $categoryFactoryMock, $itemFactoryMock); $items = $resolver->getItems(1); + $this->assertTrue(count($items) == count($categories)); foreach ($categories as $index => $category) { $this->assertSame($category->getUpdatedAt(), $items[$index]->getUpdatedAt()); @@ -67,10 +61,10 @@ public function categoryProvider() return [ [ [ - new \Magento\Framework\DataObject( + new DataObject( ['url' => 'category.html', 'updated_at' => '2012-12-21 00:00:00'] ), - new \Magento\Framework\DataObject( + new DataObject( ['url' => '/category/sub-category.html', 'updated_at' => '2012-12-21 00:00:00'] ), ] @@ -89,7 +83,7 @@ private function getCategoryFactoryMock($returnValue) ->disableOriginalConstructor() ->getMock(); - $cmsPageFactoryMock->expects(self::any()) + $cmsPageFactoryMock->expects($this->any()) ->method('create') ->willReturn($returnValue); @@ -106,7 +100,7 @@ private function getItemFactoryMock() ->disableOriginalConstructor() ->getMock(); - $itemFactoryMock->expects(self::any()) + $itemFactoryMock->expects($this->any()) ->method('create') ->willReturnCallback(function ($data) { $helper = new ObjectManager($this); @@ -118,18 +112,19 @@ private function getItemFactoryMock() } /** - * @param array $pathMap * @return \PHPUnit_Framework_MockObject_MockObject */ - private function getStoreConfigMock(array $pathMap = []) + private function getConfigReaderMock() { - $scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); - $scopeConfigMock->method('getValue') - ->willReturnCallback(function ($path) use ($pathMap) { - return isset($pathMap[$path]) ? $pathMap[$path] : null; - }); - - return $scopeConfigMock; + $configReaderMock = $this->getMockForAbstractClass(ConfigReaderInterface::class); + $configReaderMock->expects($this->any()) + ->method('getPriority') + ->willReturn('1.0'); + $configReaderMock->expects($this->any()) + ->method('getChangeFrequency') + ->willReturn('daily'); + + return $configReaderMock; } /** @@ -138,12 +133,12 @@ private function getStoreConfigMock(array $pathMap = []) */ private function getCategoryCollectionMock($returnValue) { - $sitemapCmsPageMock = $this->getMockBuilder(Category::class) + $sitemapCmsPageMock = $this->getMockBuilder(CategoryResource::class) ->setMethods(['getCollection']) ->disableOriginalConstructor() ->getMock(); - $sitemapCmsPageMock->expects(self::any()) + $sitemapCmsPageMock->expects($this->any()) ->method('getCollection') ->willReturn($returnValue); diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CmsPageTest.php similarity index 72% rename from app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php rename to app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CmsPageTest.php index c046a34ea5737..9cefe19280b2c 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CmsPageSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CmsPageTest.php @@ -6,29 +6,26 @@ namespace Magento\Sitemap\Test\Unit\Model; -use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\DataObject; -use Magento\Sitemap\Model\CmsPageSitemapItemResolver; -use Magento\Sitemap\Model\ResourceModel\Cms\Page; -use Magento\Sitemap\Model\ResourceModel\Cms\PageFactory; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Sitemap\Model\ItemResolver\CmsPage as CmsPageItemResolver; +use Magento\Sitemap\Model\ItemResolver\ConfigReaderInterface; +use Magento\Sitemap\Model\ResourceModel\Cms\Page as CmsPageResource; +use Magento\Sitemap\Model\ResourceModel\Cms\PageFactory; use Magento\Sitemap\Model\SitemapItem; use Magento\Sitemap\Model\SitemapItemInterfaceFactory; -class CmsPageSitemapItemResolverTest extends \PHPUnit_Framework_TestCase +class CmsPageTest extends \PHPUnit_Framework_TestCase { public function testGetItemsEmpty() { - $storeConfigMock = $this->getStoreConfigMock([ - CmsPageSitemapItemResolver::XML_PATH_PAGE_CHANGEFREQ => 'daily', - CmsPageSitemapItemResolver::XML_PATH_PAGE_PRIORITY => '1.0', - ]); - + $configReaderMock = $this->getConfigReaderMock(); $cmsPageMock = $this->getCmsPageCollectionMock([]); $cmsPageFactoryMock = $this->getCmsPageFactoryMock($cmsPageMock); $itemFactoryMock = $this->getItemFactoryMock(); - $resolver = new CmsPageSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + $resolver = new CmsPageItemResolver($configReaderMock, $cmsPageFactoryMock, $itemFactoryMock); + $this->assertSame([], $resolver->getItems(1)); } @@ -38,18 +35,14 @@ public function testGetItemsEmpty() */ public function testGetItems(array $pages = []) { - $storeConfigMock = $this->getStoreConfigMock([ - CmsPageSitemapItemResolver::XML_PATH_PAGE_CHANGEFREQ => 'daily', - CmsPageSitemapItemResolver::XML_PATH_PAGE_PRIORITY => '1.0', - ]); - + $configReaderMock = $this->getConfigReaderMock(); $cmsPageMock = $this->getCmsPageCollectionMock($pages); - $cmsPageFactoryMock = $this->getCmsPageFactoryMock($cmsPageMock); $itemFactoryMock = $this->getItemFactoryMock(); - $resolver = new CmsPageSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + $resolver = new CmsPageItemResolver($configReaderMock, $cmsPageFactoryMock, $itemFactoryMock); $items = $resolver->getItems(1); + $this->assertTrue(count($items) == count($pages)); foreach ($pages as $index => $page) { $this->assertSame($page->getUpdatedAt(), $items[$index]->getUpdatedAt()); @@ -118,18 +111,19 @@ private function getCmsPageFactoryMock($returnValue) } /** - * @param array $pathMap * @return \PHPUnit_Framework_MockObject_MockObject */ - private function getStoreConfigMock(array $pathMap = []) + private function getConfigReaderMock() { - $scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); - $scopeConfigMock->method('getValue') - ->willReturnCallback(function ($path) use ($pathMap) { - return isset($pathMap[$path]) ? $pathMap[$path] : null; - }); - - return $scopeConfigMock; + $configReaderMock = $this->getMockForAbstractClass(ConfigReaderInterface::class); + $configReaderMock->expects($this->any()) + ->method('getPriority') + ->willReturn('1.0'); + $configReaderMock->expects($this->any()) + ->method('getChangeFrequency') + ->willReturn('daily'); + + return $configReaderMock; } /** @@ -138,7 +132,7 @@ private function getStoreConfigMock(array $pathMap = []) */ private function getCmsPageCollectionMock($returnValue) { - $sitemapCmsPageMock = $this->getMockBuilder(Page::class) + $sitemapCmsPageMock = $this->getMockBuilder(CmsPageResource::class) ->setMethods(['getCollection']) ->disableOriginalConstructor() ->getMock(); diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CompositeTest.php similarity index 78% rename from app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php rename to app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CompositeTest.php index 4072400608611..58438b6606ae0 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/CompositeSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CompositeTest.php @@ -4,17 +4,17 @@ * See COPYING.txt for license details. */ -namespace Magento\Sitemap\Test\Unit\Model; +namespace Magento\Sitemap\Test\Unit\Model\ItemResolver; -use Magento\Sitemap\Model\CompositeSitemapItemResolver; +use Magento\Sitemap\Model\ItemResolver\Composite as CompositeItemResolver; +use Magento\Sitemap\Model\ItemResolver\ItemResolverInterface; use Magento\Sitemap\Model\SitemapItemInterface; -use Magento\Sitemap\Model\SitemapItemResolverInterface; -class CompositeSitemapItemResolverTest extends \PHPUnit_Framework_TestCase +class CompositeTest extends \PHPUnit_Framework_TestCase { public function testNoResolvers() { - $resolver = new CompositeSitemapItemResolver(); + $resolver = new CompositeItemResolver(); $this->assertSame([], $resolver->getItems(1)); } @@ -28,7 +28,7 @@ public function testGetItems($itemResolverData, $expectedItems) $mockResolvers = []; foreach ($itemResolverData as $data) { - $mockResolver = $this->getMockForAbstractClass(SitemapItemResolverInterface::class); + $mockResolver = $this->getMockForAbstractClass(ItemResolverInterface::class); $mockResolver->expects(self::once()) ->method('getItems') ->willReturn($data); @@ -36,7 +36,7 @@ public function testGetItems($itemResolverData, $expectedItems) $mockResolvers[] = $mockResolver; } - $resolver = new CompositeSitemapItemResolver($mockResolvers); + $resolver = new CompositeItemResolver($mockResolvers); $items = $resolver->getItems(1); $this->assertSame($expectedItems, $items); diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php similarity index 72% rename from app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php rename to app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php index 190553a51784c..9fd1620230182 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ProductSitemapItemResolverTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php @@ -6,29 +6,26 @@ namespace Magento\Sitemap\Test\Unit\Model; -use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Sitemap\Model\ProductSitemapItemResolver; -use Magento\Sitemap\Model\ResourceModel\Catalog\Product; +use Magento\Sitemap\Model\ItemResolver\ConfigReaderInterface; +use Magento\Sitemap\Model\ItemResolver\Product as ProductItemResolver; +use Magento\Sitemap\Model\ResourceModel\Catalog\Product as ProductResource; +use Magento\Sitemap\Model\ResourceModel\Catalog\ProductFactory; use Magento\Sitemap\Model\SitemapItem; use Magento\Sitemap\Model\SitemapItemInterfaceFactory; -use Magento\Sitemap\Model\ResourceModel\Catalog\ProductFactory; -class ProductSitemapItemResolverTest extends \PHPUnit_Framework_TestCase +class ProductTest extends \PHPUnit_Framework_TestCase { public function testGetItemsEmpty() { - $storeConfigMock = $this->getStoreConfigMock([ - ProductSitemapItemResolver::XML_PATH_PRODUCT_CHANGEFREQ => 'daily', - ProductSitemapItemResolver::XML_PATH_PRODUCT_PRIORITY => '1.0', - ]); - + $configReaderMock = $this->getConfigReaderMock(); $productMock = $this->getProductCollectionMock([]); - $cmsPageFactoryMock = $this->getProductFactoryMock($productMock); + $productFactoryMock = $this->getProductFactoryMock($productMock); $itemFactoryMock = $this->getItemFactoryMock(); - $resolver = new ProductSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + $resolver = new ProductItemResolver($configReaderMock, $productFactoryMock, $itemFactoryMock); + self::assertSame([], $resolver->getItems(1)); } @@ -38,18 +35,14 @@ public function testGetItemsEmpty() */ public function testGetItems(array $products) { - $storeConfigMock = $this->getStoreConfigMock([ - ProductSitemapItemResolver::XML_PATH_PRODUCT_CHANGEFREQ => 'daily', - ProductSitemapItemResolver::XML_PATH_PRODUCT_PRIORITY => '1.0', - ]); - + $configReaderMock = $this->getConfigReaderMock(); $productMock = $this->getProductCollectionMock($products); - - $cmsPageFactoryMock = $this->getProductFactoryMock($productMock); + $productFactoryMock = $this->getProductFactoryMock($productMock); $itemFactoryMock = $this->getItemFactoryMock(); - $resolver = new ProductSitemapItemResolver($storeConfigMock, $cmsPageFactoryMock, $itemFactoryMock); + $resolver = new ProductItemResolver($configReaderMock, $productFactoryMock, $itemFactoryMock); $items = $resolver->getItems(1); + self::assertTrue(count($items) == count($products)); foreach ($products as $index => $product) { self::assertSame($product->getUpdatedAt(), $items[$index]->getUpdatedAt()); @@ -81,15 +74,15 @@ public function productProvider() 'collection' => [ new DataObject( [ - 'url' => $storeBaseMediaUrl.'i/m/image1.png', + 'url' => $storeBaseMediaUrl . 'i/m/image1.png', 'caption' => 'caption & > title < "' ] ), new DataObject( - ['url' => $storeBaseMediaUrl.'i/m/image_no_caption.png', 'caption' => null] + ['url' => $storeBaseMediaUrl . 'i/m/image_no_caption.png', 'caption' => null] ), ], - 'thumbnail' => $storeBaseMediaUrl.'t/h/thumbnail.jpg', + 'thumbnail' => $storeBaseMediaUrl . 't/h/thumbnail.jpg', 'title' => 'Product & > title < "', ] ), @@ -111,7 +104,7 @@ private function getProductFactoryMock($returnValue) ->disableOriginalConstructor() ->getMock(); - $cmsPageFactoryMock->expects(self::any()) + $cmsPageFactoryMock->expects($this->any()) ->method('create') ->willReturn($returnValue); @@ -128,7 +121,7 @@ private function getItemFactoryMock() ->disableOriginalConstructor() ->getMock(); - $itemFactoryMock->expects(self::any()) + $itemFactoryMock->expects($this->any()) ->method('create') ->willReturnCallback(function ($data) { $helper = new ObjectManager($this); @@ -140,18 +133,19 @@ private function getItemFactoryMock() } /** - * @param array $pathMap * @return \PHPUnit_Framework_MockObject_MockObject */ - private function getStoreConfigMock(array $pathMap = []) + private function getConfigReaderMock() { - $scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); - $scopeConfigMock->method('getValue') - ->willReturnCallback(function ($path) use ($pathMap) { - return isset($pathMap[$path]) ? $pathMap[$path] : null; - }); - - return $scopeConfigMock; + $configReaderMock = $this->getMockForAbstractClass(ConfigReaderInterface::class); + $configReaderMock->expects($this->any()) + ->method('getPriority') + ->willReturn('1.0'); + $configReaderMock->expects($this->any()) + ->method('getChangeFrequency') + ->willReturn('daily'); + + return $configReaderMock; } /** @@ -160,12 +154,12 @@ private function getStoreConfigMock(array $pathMap = []) */ private function getProductCollectionMock($returnValue) { - $sitemapCmsPageMock = $this->getMockBuilder(Product::class) + $sitemapCmsPageMock = $this->getMockBuilder(ProductResource::class) ->setMethods(['getCollection']) ->disableOriginalConstructor() ->getMock(); - $sitemapCmsPageMock->expects(self::any()) + $sitemapCmsPageMock->expects($this->any()) ->method('getCollection') ->willReturn($returnValue); diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapConfigReaderTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapConfigReaderTest.php new file mode 100644 index 0000000000000..5aac0ef9b6d76 --- /dev/null +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapConfigReaderTest.php @@ -0,0 +1,39 @@ +getScopeConfigMock(); + + $configReader = new SitemapConfigReader($scopeConfigMock); + + $this->assertEquals(['path1', 'path2'], $configReader->getValidPaths()); + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getScopeConfigMock(): \PHPUnit_Framework_MockObject_MockObject + { + $scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class); + $scopeConfigMock->expects($this->any()) + ->method('getValue') + ->willReturnMap([ + [SitemapConfigReader::XML_PATH_SITEMAP_VALID_PATHS, ScopeInterface::SCOPE_STORE, null, ['path1']], + [SitemapConfigReader::XML_PATH_PUBLIC_FILES_VALID_PATHS, ScopeInterface::SCOPE_STORE, null, ['path2']], + ]); + + return $scopeConfigMock; + } +} diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index 35b3523ce119b..8b137e6fc1546 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -11,6 +11,8 @@ use Magento\Framework\Filesystem\File\Write; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\Sitemap\Helper\Data; +use Magento\Sitemap\Model\ItemResolver\ConfigReaderInterface; +use Magento\Sitemap\Model\ItemResolver\ItemResolverInterface; use Magento\Sitemap\Model\ResourceModel\Catalog\Category; use Magento\Sitemap\Model\ResourceModel\Catalog\CategoryFactory; use Magento\Sitemap\Model\ResourceModel\Catalog\Product; @@ -19,8 +21,8 @@ use Magento\Sitemap\Model\ResourceModel\Cms\PageFactory; use Magento\Sitemap\Model\ResourceModel\Sitemap as SitemapResource; use Magento\Sitemap\Model\Sitemap; +use Magento\Sitemap\Model\SitemapConfigReaderInterface; use Magento\Sitemap\Model\SitemapItem; -use Magento\Sitemap\Model\SitemapItemResolverInterface; use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; @@ -32,42 +34,42 @@ class SitemapTest extends \PHPUnit_Framework_TestCase /** * @var Data */ - protected $_helperMockSitemap; + private $helperMockSitemap; /** * @var SitemapResource */ - protected $_resourceMock; + private $resourceMock; /** * @var Category */ - protected $_sitemapCategoryMock; + private $sitemapCategoryMock; /** * @var Product */ - protected $_sitemapProductMock; + private $sitemapProductMock; /** * @var Page */ - protected $_sitemapCmsPageMock; + private $sitemapCmsPageMock; /** * @var Filesystem */ - protected $_filesystemMock; + private $filesystemMock; /** * @var DirectoryWrite */ - protected $_directoryMock; + private $directoryMock; /** * @var Write */ - protected $_fileMock; + private $fileMock; /** * @var StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject @@ -75,42 +77,35 @@ class SitemapTest extends \PHPUnit_Framework_TestCase private $storeManagerMock; /** - * @var \Magento\Sitemap\Model\SitemapItemResolverInterface + * @var ItemResolverInterface|\PHPUnit_Framework_MockObject_MockObject */ private $itemResolverMock; + /** + * @var ConfigReaderInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $configReaderMock; + /** * Set helper mocks, create resource model mock */ protected function setUp() { - $this->_sitemapCategoryMock = $this->getMockBuilder(Category::class) + $this->sitemapCategoryMock = $this->getMockBuilder(Category::class) ->disableOriginalConstructor() ->getMock(); - $this->_sitemapProductMock = $this->getMockBuilder(Product::class) + $this->sitemapProductMock = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->getMock(); - $this->_sitemapCmsPageMock = $this->getMockBuilder(Page::class) + $this->sitemapCmsPageMock = $this->getMockBuilder(Page::class) ->disableOriginalConstructor() ->getMock(); - $this->_helperMockSitemap = $this->getMockBuilder(Data::class) - ->setMethods( - [ - 'getCategoryChangefreq', - 'getProductChangefreq', - 'getPageChangefreq', - 'getCategoryPriority', - 'getProductPriority', - 'getPagePriority', - 'getMaximumLinesNumber', - 'getMaximumFileSize', - 'getEnableSubmissionRobots', - ]) + $this->helperMockSitemap = $this->getMockBuilder(Data::class) ->disableOriginalConstructor() ->getMock(); - $this->_resourceMock = $this->getMockBuilder(SitemapResource::class) + $this->resourceMock = $this->getMockBuilder(SitemapResource::class) ->setMethods( [ '_construct', @@ -124,32 +119,34 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); - $this->_resourceMock->expects($this->any()) + $this->resourceMock->expects($this->any()) ->method('addCommitCallback') ->willReturnSelf(); - $this->_fileMock = $this->getMockBuilder(Write::class) + $this->fileMock = $this->getMockBuilder(Write::class) ->disableOriginalConstructor() ->getMock(); - $this->_directoryMock = $this->getMockBuilder(DirectoryWrite::class) + $this->directoryMock = $this->getMockBuilder(DirectoryWrite::class) ->disableOriginalConstructor() ->getMock(); - $this->_directoryMock->expects($this->any()) + $this->directoryMock->expects($this->any()) ->method('openFile') - ->willReturn($this->_fileMock); + ->willReturn($this->fileMock); - $this->_filesystemMock = $this->getMockBuilder(Filesystem::class) + $this->filesystemMock = $this->getMockBuilder(Filesystem::class) ->setMethods(['getDirectoryWrite']) ->disableOriginalConstructor() ->getMock(); - $this->_filesystemMock->expects($this->any()) + $this->filesystemMock->expects($this->any()) ->method('getDirectoryWrite') - ->willReturn($this->_directoryMock); + ->willReturn($this->directoryMock); - $this->itemResolverMock = $this->getMockForAbstractClass(SitemapItemResolverInterface::class); + $this->configReaderMock = $this->getMockForAbstractClass(SitemapConfigReaderInterface::class); + + $this->itemResolverMock = $this->getMockForAbstractClass(ItemResolverInterface::class); } /** @@ -160,7 +157,7 @@ protected function setUp() */ public function testNotAllowedPath() { - $model = $this->_getModelMock(); + $model = $this->getModelMock(); $model->setSitemapPath('../'); $model->beforeSave(); } @@ -173,11 +170,11 @@ public function testNotAllowedPath() */ public function testPathNotExists() { - $this->_directoryMock->expects($this->once()) + $this->directoryMock->expects($this->once()) ->method('isExist') ->willReturn(false); - $model = $this->_getModelMock(); + $model = $this->getModelMock(); $model->beforeSave(); } @@ -189,15 +186,15 @@ public function testPathNotExists() */ public function testPathNotWritable() { - $this->_directoryMock->expects($this->once()) + $this->directoryMock->expects($this->once()) ->method('isExist') ->willReturn(true); - $this->_directoryMock->expects($this->once()) + $this->directoryMock->expects($this->once()) ->method('isWritable') ->willReturn(false); - $model = $this->_getModelMock(); + $model = $this->getModelMock(); $model->beforeSave(); } @@ -212,15 +209,15 @@ public function testPathNotWritable() //@codingStandardsIgnoreEnd public function testFilenameInvalidChars() { - $this->_directoryMock->expects($this->once()) + $this->directoryMock->expects($this->once()) ->method('isExist') ->willReturn(true); - $this->_directoryMock->expects($this->once()) + $this->directoryMock->expects($this->once()) ->method('isWritable') ->willReturn(true); - $model = $this->_getModelMock(); + $model = $this->getModelMock(); $model->setSitemapFilename('*sitemap?.xml'); $model->beforeSave(); } @@ -266,7 +263,7 @@ public static function sitemapDataProvider() public function testGenerateXml($maxLines, $maxFileSize, $expectedFile, $expectedWrites) { $actualData = []; - $model = $this->_prepareSitemapModelMock( + $model = $this->prepareSitemapModelMock( $actualData, $maxLines, $maxFileSize, @@ -373,7 +370,7 @@ public static function robotsDataProvider() public function testAddSitemapToRobotsTxt($maxLines, $maxFileSize, $expectedFile, $expectedWrites, $robotsInfo) { $actualData = []; - $model = $this->_prepareSitemapModelMock( + $model = $this->prepareSitemapModelMock( $actualData, $maxLines, $maxFileSize, @@ -396,7 +393,7 @@ public function testAddSitemapToRobotsTxt($maxLines, $maxFileSize, $expectedFile * @return Sitemap|PHPUnit_Framework_MockObject_MockObject * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - protected function _prepareSitemapModelMock( + protected function prepareSitemapModelMock( &$actualData, $maxLines, $maxFileSize, @@ -415,30 +412,29 @@ protected function _prepareSitemapModelMock( }; // Check that all expected lines were written - $this->_fileMock->expects($this->exactly($expectedWrites)) + $this->fileMock->expects($this->exactly($expectedWrites)) ->method('write') ->willReturnCallback($streamWriteCallback); // Check that all expected file descriptors were created - $this->_directoryMock->expects($this->exactly(count($expectedFile))) + $this->directoryMock->expects($this->exactly(count($expectedFile))) ->method('openFile') ->willReturnCallback(function ($file) use (&$currentFile) { - $currentFile = $file; - } + $currentFile = $file; + } ); // Check that all file descriptors were closed - $this->_fileMock->expects($this->exactly(count($expectedFile))) + $this->fileMock->expects($this->exactly(count($expectedFile))) ->method('close'); if (count($expectedFile) == 1) { - $this->_directoryMock->expects($this->once()) + $this->directoryMock->expects($this->once()) ->method('renameFile') ->willReturnCallback(function ($from, $to) { - \PHPUnit_Framework_Assert::assertEquals('/sitemap-1-1.xml', $from); - \PHPUnit_Framework_Assert::assertEquals('/sitemap.xml', $to); - } - ); + \PHPUnit_Framework_Assert::assertEquals('/sitemap-1-1.xml', $from); + \PHPUnit_Framework_Assert::assertEquals('/sitemap.xml', $to); + }); } // Check robots txt @@ -450,11 +446,11 @@ protected function _prepareSitemapModelMock( if (isset($robotsInfo['robotsFinish'])) { $robotsFinish = $robotsInfo['robotsFinish']; } - $this->_directoryMock->expects($this->any()) + $this->directoryMock->expects($this->any()) ->method('readFile') ->willReturn($robotsStart); - $this->_directoryMock->expects($this->any()) + $this->directoryMock->expects($this->any()) ->method('write') ->with( $this->equalTo('robots.txt'), @@ -466,19 +462,19 @@ protected function _prepareSitemapModelMock( if (isset($robotsInfo['pushToRobots'])) { $pushToRobots = (int)$robotsInfo['pushToRobots']; } - $this->_helperMockSitemap->expects($this->any()) + $this->configReaderMock->expects($this->any()) ->method('getMaximumLinesNumber') ->willReturn($maxLines); - $this->_helperMockSitemap->expects($this->any()) + $this->configReaderMock->expects($this->any()) ->method('getMaximumFileSize') ->willReturn($maxFileSize); - $this->_helperMockSitemap->expects($this->any()) + $this->configReaderMock->expects($this->any()) ->method('getEnableSubmissionRobots') ->willReturn($pushToRobots); - $model = $this->_getModelMock(true); + $model = $this->getModelMock(true); $storeMock = $this->getMockBuilder(Store::class) ->setMethods(['isFrontUrlSecure', 'getBaseUrl']) @@ -508,7 +504,7 @@ protected function _prepareSitemapModelMock( * @param bool $mockBeforeSave * @return Sitemap|PHPUnit_Framework_MockObject_MockObject */ - protected function _getModelMock($mockBeforeSave = false) + protected function getModelMock($mockBeforeSave = false) { $methods = [ '_construct', @@ -543,15 +539,15 @@ protected function _getModelMock($mockBeforeSave = false) 'collection' => [ new DataObject( [ - 'url' => $storeBaseMediaUrl.'i/m/image1.png', + 'url' => $storeBaseMediaUrl . 'i/m/image1.png', 'caption' => 'caption & > title < "' ] ), new DataObject( - ['url' => $storeBaseMediaUrl.'i/m/image_no_caption.png', 'caption' => null] + ['url' => $storeBaseMediaUrl . 'i/m/image_no_caption.png', 'caption' => null] ), ], - 'thumbnail' => $storeBaseMediaUrl.'t/h/thumbnail.jpg', + 'thumbnail' => $storeBaseMediaUrl . 't/h/thumbnail.jpg', 'title' => 'Product & > title < "', ]) ) @@ -560,12 +556,12 @@ protected function _getModelMock($mockBeforeSave = false) /** @var $model Sitemap */ $model = $this->getMockBuilder(Sitemap::class) ->setMethods($methods) - ->setConstructorArgs($this->_getModelConstructorArgs()) + ->setConstructorArgs($this->getModelConstructorArgs()) ->getMock(); $model->expects($this->any()) ->method('_getResource') - ->willReturn($this->_resourceMock); + ->willReturn($this->resourceMock); $model->expects($this->any()) ->method('_getCurrentDateTime') @@ -585,7 +581,7 @@ protected function _getModelMock($mockBeforeSave = false) /** * @return array */ - protected function _getModelConstructorArgs() + private function getModelConstructorArgs() { $categoryFactory = $this->getMockBuilder(CategoryFactory::class) ->disableOriginalConstructor() @@ -611,9 +607,10 @@ protected function _getModelConstructorArgs() 'productFactory' => $productFactory, 'cmsFactory' => $cmsFactory, 'storeManager' => $this->storeManagerMock, - 'sitemapData' => $this->_helperMockSitemap, - 'filesystem' => $this->_filesystemMock, + 'sitemapData' => $this->helperMockSitemap, + 'filesystem' => $this->filesystemMock, 'itemResolver' => $this->itemResolverMock, + 'configReader' => $this->configReaderMock, ] ); $constructArguments['resource'] = null; @@ -643,7 +640,7 @@ public function testGetSitemapUrl($storeBaseUrl, $documentRoot, $baseDir, $sitem '_construct', ] ) - ->setConstructorArgs($this->_getModelConstructorArgs()) + ->setConstructorArgs($this->getModelConstructorArgs()) ->getMock(); $model->expects($this->any()) diff --git a/app/code/Magento/Sitemap/etc/di.xml b/app/code/Magento/Sitemap/etc/di.xml index 217c65dc61973..e8200bbc9e50c 100644 --- a/app/code/Magento/Sitemap/etc/di.xml +++ b/app/code/Magento/Sitemap/etc/di.xml @@ -7,7 +7,9 @@ --> - + + + Magento\Sitemap\Model\ResourceModel\Sitemap @@ -20,13 +22,28 @@ - + - Magento\Sitemap\Model\CategorySitemapItemResolver - Magento\Sitemap\Model\CmsPageSitemapItemResolver - Magento\Sitemap\Model\ProductSitemapItemResolver + Magento\Sitemap\Model\ItemResolver\Category + Magento\Sitemap\Model\ItemResolver\CmsPage + Magento\Sitemap\Model\ItemResolver\Product + + + Magento\Sitemap\Model\ItemResolver\CategoryConfigReader + + + + + Magento\Sitemap\Model\ItemResolver\ProductConfigReader + + + + + Magento\Sitemap\Model\ItemResolver\CmsPageConfigReader + + diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php deleted file mode 100644 index 0acfe0bd1ef82..0000000000000 --- a/dev/tests/integration/testsuite/Magento/Sitemap/Helper/DataTest.php +++ /dev/null @@ -1,138 +0,0 @@ -_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Sitemap\Helper\Data::class - ); - } - - /** - * @magentoConfigFixture default_store sitemap/limit/max_lines 10 - */ - public function testGetMaximumLinesNumber() - { - $this->assertEquals( - 50000, - $this->_helper->getMaximumLinesNumber(\Magento\Store\Model\Store::DEFAULT_STORE_ID) - ); - $this->assertEquals(10, $this->_helper->getMaximumLinesNumber(\Magento\Store\Model\Store::DISTRO_STORE_ID)); - } - - /** - * @magentoConfigFixture default_store sitemap/limit/max_file_size 1024 - */ - public function testGetMaximumFileSize() - { - $this->assertEquals( - 10485760, - $this->_helper->getMaximumFileSize(\Magento\Store\Model\Store::DEFAULT_STORE_ID) - ); - $this->assertEquals(1024, $this->_helper->getMaximumFileSize(\Magento\Store\Model\Store::DISTRO_STORE_ID)); - } - - /** - * @magentoConfigFixture default_store sitemap/category/changefreq montly - */ - public function testGetCategoryChangefreq() - { - $this->assertEquals( - 'daily', - $this->_helper->getCategoryChangefreq(\Magento\Store\Model\Store::DEFAULT_STORE_ID) - ); - $this->assertEquals( - 'montly', - $this->_helper->getCategoryChangefreq(\Magento\Store\Model\Store::DISTRO_STORE_ID) - ); - } - - /** - * @magentoConfigFixture default_store sitemap/product/changefreq montly - */ - public function testGetProductChangefreq() - { - $this->assertEquals( - 'daily', - $this->_helper->getProductChangefreq(\Magento\Store\Model\Store::DEFAULT_STORE_ID) - ); - $this->assertEquals( - 'montly', - $this->_helper->getProductChangefreq(\Magento\Store\Model\Store::DISTRO_STORE_ID) - ); - } - - /** - * @magentoConfigFixture default_store sitemap/page/changefreq montly - */ - public function testGetPageChangefreq() - { - $this->assertEquals('daily', $this->_helper->getPageChangefreq(\Magento\Store\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals('montly', $this->_helper->getPageChangefreq(\Magento\Store\Model\Store::DISTRO_STORE_ID)); - } - - /** - * @magentoConfigFixture default_store sitemap/category/priority 100 - */ - public function testGetCategoryPriority() - { - $this->assertEquals(0.5, $this->_helper->getCategoryPriority(\Magento\Store\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals(100, $this->_helper->getCategoryPriority(\Magento\Store\Model\Store::DISTRO_STORE_ID)); - } - - /** - * @magentoConfigFixture default_store sitemap/product/priority 100 - */ - public function testGetProductPriority() - { - $this->assertEquals(1, $this->_helper->getProductPriority(\Magento\Store\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals(100, $this->_helper->getProductPriority(\Magento\Store\Model\Store::DISTRO_STORE_ID)); - } - - /** - * @magentoConfigFixture default_store sitemap/page/priority 100 - */ - public function testGetPagePriority() - { - $this->assertEquals(0.25, $this->_helper->getPagePriority(\Magento\Store\Model\Store::DEFAULT_STORE_ID)); - $this->assertEquals(100, $this->_helper->getPagePriority(\Magento\Store\Model\Store::DISTRO_STORE_ID)); - } - - /** - * @magentoConfigFixture default_store sitemap/search_engines/submission_robots 1 - */ - public function testGetEnableSubmissionRobots() - { - $this->assertEquals( - 0, - $this->_helper->getEnableSubmissionRobots(\Magento\Store\Model\Store::DEFAULT_STORE_ID) - ); - $this->assertEquals(1, $this->_helper->getEnableSubmissionRobots(\Magento\Store\Model\Store::DISTRO_STORE_ID)); - } - - /** - * @magentoConfigFixture default_store sitemap/product/image_include base - */ - public function testGetProductImageIncludePolicy() - { - $this->assertEquals( - 'all', - $this->_helper->getProductImageIncludePolicy(\Magento\Store\Model\Store::DEFAULT_STORE_ID) - ); - $this->assertEquals( - 'base', - $this->_helper->getProductImageIncludePolicy(\Magento\Store\Model\Store::DISTRO_STORE_ID) - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/CategoryConfigReaderTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/CategoryConfigReaderTest.php new file mode 100644 index 0000000000000..d4d24daf00429 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/CategoryConfigReaderTest.php @@ -0,0 +1,41 @@ +model = Bootstrap::getObjectManager()->get(CategoryConfigReader::class); + } + + /** + * @magentoConfigFixture default_store sitemap/category/changefreq monthly + */ + public function testGetChangeFrequency() + { + $this->assertEquals('daily', $this->model->getChangeFrequency(Store::DEFAULT_STORE_ID)); + $this->assertEquals('monthly', $this->model->getChangeFrequency(Store::DISTRO_STORE_ID)); + } + + /** + * @magentoConfigFixture default_store sitemap/category/priority 100 + */ + public function testGetCategoryPriority() + { + $this->assertEquals(0.5, $this->model->getPriority(Store::DEFAULT_STORE_ID)); + $this->assertEquals(100, $this->model->getPriority(Store::DISTRO_STORE_ID)); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/CmsPageConfigReaderTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/CmsPageConfigReaderTest.php new file mode 100644 index 0000000000000..89142d451aada --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/CmsPageConfigReaderTest.php @@ -0,0 +1,41 @@ +model = Bootstrap::getObjectManager()->get(CmsPageConfigReader::class); + } + + /** + * @magentoConfigFixture default_store sitemap/page/changefreq monthly + */ + public function testGetChangeFrequency() + { + $this->assertEquals('daily', $this->model->getChangeFrequency(Store::DEFAULT_STORE_ID)); + $this->assertEquals('monthly', $this->model->getChangeFrequency(Store::DISTRO_STORE_ID)); + } + + /** + * @magentoConfigFixture default_store sitemap/page/priority 100 + */ + public function testGetCategoryPriority() + { + $this->assertEquals(0.25, $this->model->getPriority(Store::DEFAULT_STORE_ID)); + $this->assertEquals(100, $this->model->getPriority(Store::DISTRO_STORE_ID)); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/ProductConfigReaderTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/ProductConfigReaderTest.php new file mode 100644 index 0000000000000..f130996e73a0a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sitemap/Model/ItemResolver/ProductConfigReaderTest.php @@ -0,0 +1,41 @@ +model = Bootstrap::getObjectManager()->get(ProductConfigReader::class); + } + + /** + * @magentoConfigFixture default_store sitemap/product/changefreq monthly + */ + public function testGetChangeFrequency() + { + $this->assertEquals('daily', $this->model->getChangeFrequency(Store::DEFAULT_STORE_ID)); + $this->assertEquals('monthly', $this->model->getChangeFrequency(Store::DISTRO_STORE_ID)); + } + + /** + * @magentoConfigFixture default_store sitemap/product/priority 100 + */ + public function testGetCategoryPriority() + { + $this->assertEquals(1, $this->model->getPriority(Store::DEFAULT_STORE_ID)); + $this->assertEquals(100, $this->model->getPriority(Store::DISTRO_STORE_ID)); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Model/SitemapConfigReaderTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Model/SitemapConfigReaderTest.php new file mode 100644 index 0000000000000..09be740d993ac --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Sitemap/Model/SitemapConfigReaderTest.php @@ -0,0 +1,67 @@ +model = Bootstrap::getObjectManager()->get(SitemapConfigReader::class); + } + + /** + * @magentoConfigFixture default_store sitemap/search_engines/submission_robots 1 + */ + public function testGetEnableSubmissionRobots() + { + $defaultSubmission = $this->model->getEnableSubmissionRobots(Store::DEFAULT_STORE_ID); + $this->assertEquals(0, $defaultSubmission); + $distroEnableSubmission = $this->model->getEnableSubmissionRobots(Store::DISTRO_STORE_ID); + $this->assertEquals(1, $distroEnableSubmission); + } + + /** + * @magentoConfigFixture default_store sitemap/limit/max_lines 10 + */ + public function testGetMaximumLinesNumber() + { + $defaultLinesNumber = $this->model->getMaximumLinesNumber(Store::DEFAULT_STORE_ID); + $this->assertEquals(50000, $defaultLinesNumber); + $distroLinesNumber = $this->model->getMaximumLinesNumber(Store::DISTRO_STORE_ID); + $this->assertEquals(10, $distroLinesNumber); + } + + /** + * @magentoConfigFixture default_store sitemap/limit/max_file_size 1024 + */ + public function testGetMaximumFileSize() + { + $defaultFileSize = $this->model->getMaximumFileSize(Store::DEFAULT_STORE_ID); + $this->assertEquals(10485760, $defaultFileSize); + $distroFileSize = $this->model->getMaximumFileSize(Store::DISTRO_STORE_ID); + $this->assertEquals(1024, $distroFileSize); + } + + /** + * @magentoConfigFixture default_store sitemap/product/image_include base + */ + public function testGetProductImageIncludePolicy() + { + $defaultPolicy = $this->model->getProductImageIncludePolicy(Store::DEFAULT_STORE_ID); + $this->assertEquals('all', $defaultPolicy); + $distroPolicy = $this->model->getProductImageIncludePolicy(Store::DISTRO_STORE_ID); + $this->assertEquals('base', $distroPolicy); + } +} From 9c65d501ec1a0160c39b85b1ec27db7cc1a7730f Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Mon, 24 Jul 2017 23:18:22 +0100 Subject: [PATCH 0346/1004] magento/magento2#10045 coding standars again --- .../Unit/Model/ItemResolver/ProductTest.php | 5 ++- .../Sitemap/Test/Unit/Model/SitemapTest.php | 31 ++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php index 9fd1620230182..525742c262a81 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php @@ -79,7 +79,10 @@ public function productProvider() ] ), new DataObject( - ['url' => $storeBaseMediaUrl . 'i/m/image_no_caption.png', 'caption' => null] + [ + 'url' => $storeBaseMediaUrl . 'i/m/image_no_caption.png', + 'caption' => null + ] ), ], 'thumbnail' => $storeBaseMediaUrl . 't/h/thumbnail.jpg', diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php index 8b137e6fc1546..3464436a087c8 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/SitemapTest.php @@ -105,17 +105,18 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); + $resourceMethods = [ + '_construct', + 'beginTransaction', + 'rollBack', + 'save', + 'addCommitCallback', + 'commit', + '__wakeup', + ]; + $this->resourceMock = $this->getMockBuilder(SitemapResource::class) - ->setMethods( - [ - '_construct', - 'beginTransaction', - 'rollBack', - 'save', - 'addCommitCallback', - 'commit', - '__wakeup', - ]) + ->setMethods($resourceMethods) ->disableOriginalConstructor() ->getMock(); @@ -145,7 +146,6 @@ protected function setUp() ->willReturn($this->directoryMock); $this->configReaderMock = $this->getMockForAbstractClass(SitemapConfigReaderInterface::class); - $this->itemResolverMock = $this->getMockForAbstractClass(ItemResolverInterface::class); } @@ -416,13 +416,14 @@ protected function prepareSitemapModelMock( ->method('write') ->willReturnCallback($streamWriteCallback); + $checkFileCallback = function ($file) use (&$currentFile) { + $currentFile = $file; + }; + // Check that all expected file descriptors were created $this->directoryMock->expects($this->exactly(count($expectedFile))) ->method('openFile') - ->willReturnCallback(function ($file) use (&$currentFile) { - $currentFile = $file; - } - ); + ->willReturnCallback($checkFileCallback); // Check that all file descriptors were closed $this->fileMock->expects($this->exactly(count($expectedFile))) From 474effb3e84d140aeab11aadd74a0839b2f0f986 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 25 Jul 2017 07:33:26 +0000 Subject: [PATCH 0347/1004] Remove the Zend_Json usage in the integration test suite and framework - replace with direct calls to json_decode and json_encode as these are test cases --- .../TestFramework/TestCase/AbstractController.php | 12 ++++-------- .../Magento/Test/TestCase/ControllerAbstractTest.php | 2 +- .../testsuite/Magento/Email/Model/TemplateTest.php | 2 +- .../Block/Adminhtml/Import/Edit/BeforeTest.php | 4 ++-- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php index 194036e723412..0031d4e593d17 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php @@ -268,14 +268,10 @@ protected function getCookieMessages($messageType = null) { /** @var $cookieManager CookieManagerInterface */ $cookieManager = $this->_objectManager->get(CookieManagerInterface::class); - try { - $messages = \Zend_Json::decode( - $cookieManager->getCookie(MessagePlugin::MESSAGES_COOKIES_NAME, \Zend_Json::encode([])) - ); - if (!is_array($messages)) { - $messages = []; - } - } catch (\Zend_Json_Exception $e) { + $messages = json_decode( + $cookieManager->getCookie(MessagePlugin::MESSAGES_COOKIES_NAME, json_encode([])) + ); + if (!is_array($messages)) { $messages = []; } diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php index 703f9b0e1a520..1242026fd4a36 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php @@ -244,6 +244,6 @@ private function addSessionMessages() $this->cookieManagerMock->expects($this->any()) ->method('getCookie') - ->willReturn(\Zend_Json::encode($cookieMessages)); + ->willReturn(json_encode($cookieMessages)); } } diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php index f81f3d16243d7..126b452dd93b6 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -108,7 +108,7 @@ public function testLoadDefault() $this->assertNotEmpty($this->model->getTemplateText()); $this->assertNotEmpty($this->model->getTemplateSubject()); $this->assertNotEmpty($this->model->getOrigTemplateVariables()); - $this->assertInternalType('array', \Zend_Json::decode($this->model->getOrigTemplateVariables())); + $this->assertInternalType('array', json_decode($this->model->getOrigTemplateVariables())); } /** diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/BeforeTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/BeforeTest.php index 223ca9f31919e..3334a211006e8 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/BeforeTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Import/Edit/BeforeTest.php @@ -93,7 +93,7 @@ protected function setUp() public function testGetEntityBehaviors() { $actualEntities = $this->_model->getEntityBehaviors(); - $expectedEntities = \Zend_Json::encode($this->_expectedEntities); + $expectedEntities = json_encode($this->_expectedEntities); $this->assertEquals($expectedEntities, $actualEntities); } @@ -105,7 +105,7 @@ public function testGetEntityBehaviors() public function testGetUniqueBehaviors() { $actualBehaviors = $this->_model->getUniqueBehaviors(); - $expectedBehaviors = \Zend_Json::encode($this->_expectedBehaviors); + $expectedBehaviors = json_encode($this->_expectedBehaviors); $this->assertEquals($expectedBehaviors, $actualBehaviors); } } From db624ff82c00653223b1f914f346f18a8ff7c11a Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 25 Jul 2017 11:13:07 +0000 Subject: [PATCH 0348/1004] Update the abstract controller to use the Serializer rather than direct json_ methods --- .../TestCase/AbstractController.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php index 0031d4e593d17..0cb293cde2fa3 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php @@ -268,10 +268,21 @@ protected function getCookieMessages($messageType = null) { /** @var $cookieManager CookieManagerInterface */ $cookieManager = $this->_objectManager->get(CookieManagerInterface::class); - $messages = json_decode( - $cookieManager->getCookie(MessagePlugin::MESSAGES_COOKIES_NAME, json_encode([])) - ); - if (!is_array($messages)) { + + /** @var $jsonSerializer \Magento\Framework\Serialize\Serializer\Json */ + $jsonSerializer = $this->_objectManager->get(\Magento\Framework\Serialize\Serializer\Json::class); + try { + $messages = $jsonSerializer->unserialize( + $cookieManager->getCookie( + MessagePlugin::MESSAGES_COOKIES_NAME, + $jsonSerializer->serialize([]) + ) + ); + + if (!is_array($messages)) { + $messages = []; + } + } catch (\InvalidArgumentException $e) { $messages = []; } From 1ad0251051e6457db22cecfd9daec38102d26bdb Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 25 Jul 2017 12:31:34 +0000 Subject: [PATCH 0349/1004] Fix-up some probelms with test suite - Mark AbstractController to ignore CouplingBetweenObjects - Set the same json_decode default that Zend_Json uses --- .../Magento/TestFramework/TestCase/AbstractController.php | 1 + .../integration/testsuite/Magento/Email/Model/TemplateTest.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php index 0cb293cde2fa3..6ab8d43af62a9 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php @@ -15,6 +15,7 @@ /** * @SuppressWarnings(PHPMD.NumberOfChildren) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ abstract class AbstractController extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php index 126b452dd93b6..fc58b1028c043 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -108,7 +108,7 @@ public function testLoadDefault() $this->assertNotEmpty($this->model->getTemplateText()); $this->assertNotEmpty($this->model->getTemplateSubject()); $this->assertNotEmpty($this->model->getOrigTemplateVariables()); - $this->assertInternalType('array', json_decode($this->model->getOrigTemplateVariables())); + $this->assertInternalType('array', json_decode($this->model->getOrigTemplateVariables(), true)); } /** From d2a37e4b6c062c01835ef5fd02c0aeddce4beefe Mon Sep 17 00:00:00 2001 From: alojua Date: Tue, 25 Jul 2017 14:42:39 +0200 Subject: [PATCH 0350/1004] Adding missing block names in checkout_cart_item_renderers.xml layout to be able to extend them using referenceBlock functionality --- .../view/frontend/layout/checkout_cart_item_renderers.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml index 69fc24be97757..1285da053edb7 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml @@ -9,13 +9,13 @@ - + - + From f95bf7a54ce6220bd7f5af67e3580d4349c9a82f Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Tue, 25 Jul 2017 14:10:57 +0100 Subject: [PATCH 0351/1004] magento/magento2#10045 make codacy happy --- .../Sitemap/Model/SitemapConfigReaderTest.php | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/Model/SitemapConfigReaderTest.php b/dev/tests/integration/testsuite/Magento/Sitemap/Model/SitemapConfigReaderTest.php index 09be740d993ac..f98c70c5b52cb 100644 --- a/dev/tests/integration/testsuite/Magento/Sitemap/Model/SitemapConfigReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Sitemap/Model/SitemapConfigReaderTest.php @@ -26,10 +26,8 @@ protected function setUp() */ public function testGetEnableSubmissionRobots() { - $defaultSubmission = $this->model->getEnableSubmissionRobots(Store::DEFAULT_STORE_ID); - $this->assertEquals(0, $defaultSubmission); - $distroEnableSubmission = $this->model->getEnableSubmissionRobots(Store::DISTRO_STORE_ID); - $this->assertEquals(1, $distroEnableSubmission); + $this->assertEquals(0, $this->model->getEnableSubmissionRobots(Store::DEFAULT_STORE_ID)); + $this->assertEquals(1, $this->model->getEnableSubmissionRobots(Store::DISTRO_STORE_ID)); } /** @@ -37,10 +35,8 @@ public function testGetEnableSubmissionRobots() */ public function testGetMaximumLinesNumber() { - $defaultLinesNumber = $this->model->getMaximumLinesNumber(Store::DEFAULT_STORE_ID); - $this->assertEquals(50000, $defaultLinesNumber); - $distroLinesNumber = $this->model->getMaximumLinesNumber(Store::DISTRO_STORE_ID); - $this->assertEquals(10, $distroLinesNumber); + $this->assertEquals(50000, $this->model->getMaximumLinesNumber(Store::DEFAULT_STORE_ID)); + $this->assertEquals(10, $this->model->getMaximumLinesNumber(Store::DISTRO_STORE_ID)); } /** @@ -48,10 +44,8 @@ public function testGetMaximumLinesNumber() */ public function testGetMaximumFileSize() { - $defaultFileSize = $this->model->getMaximumFileSize(Store::DEFAULT_STORE_ID); - $this->assertEquals(10485760, $defaultFileSize); - $distroFileSize = $this->model->getMaximumFileSize(Store::DISTRO_STORE_ID); - $this->assertEquals(1024, $distroFileSize); + $this->assertEquals(10485760, $this->model->getMaximumFileSize(Store::DEFAULT_STORE_ID)); + $this->assertEquals(1024, $this->model->getMaximumFileSize(Store::DISTRO_STORE_ID)); } /** @@ -59,9 +53,7 @@ public function testGetMaximumFileSize() */ public function testGetProductImageIncludePolicy() { - $defaultPolicy = $this->model->getProductImageIncludePolicy(Store::DEFAULT_STORE_ID); - $this->assertEquals('all', $defaultPolicy); - $distroPolicy = $this->model->getProductImageIncludePolicy(Store::DISTRO_STORE_ID); - $this->assertEquals('base', $distroPolicy); + $this->assertEquals('all', $this->model->getProductImageIncludePolicy(Store::DEFAULT_STORE_ID)); + $this->assertEquals('base', $this->model->getProductImageIncludePolicy(Store::DISTRO_STORE_ID)); } } From 2867a11c6e2290ccf11d5a54e54f088728d9e2a7 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 25 Jul 2017 17:50:02 +0300 Subject: [PATCH 0352/1004] magento/magento2#10320: Remove zend json from the test suite - Attempt to reduce coupling between objects --- .../TestFramework/TestCase/AbstractController.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php index 6ab8d43af62a9..c80c05c2521cc 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php @@ -15,7 +15,6 @@ /** * @SuppressWarnings(PHPMD.NumberOfChildren) - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ abstract class AbstractController extends \PHPUnit_Framework_TestCase { @@ -26,12 +25,12 @@ abstract class AbstractController extends \PHPUnit_Framework_TestCase protected $_runOptions = []; /** - * @var \Magento\TestFramework\Request + * @var \Magento\Framework\App\RequestInterface */ protected $_request; /** - * @var \Magento\TestFramework\Response + * @var \Magento\Framework\App\ResponseInterface */ protected $_response; @@ -103,7 +102,7 @@ public function dispatch($uri) /** * Request getter * - * @return \Magento\TestFramework\Request + * @return \Magento\Framework\App\RequestInterface */ public function getRequest() { @@ -116,7 +115,7 @@ public function getRequest() /** * Response getter * - * @return \Magento\TestFramework\Response + * @return \Magento\Framework\App\ResponseInterface */ public function getResponse() { From 8cd3d3a1e2e347f91f5a6f1955c5ab6f7f061511 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Tue, 25 Jul 2017 18:59:33 +0300 Subject: [PATCH 0353/1004] magento/magento2#10320: Remove zend json from the test suite - Fixed unit test for the integration tests framework --- .../Test/TestCase/ControllerAbstractTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php index 1242026fd4a36..d46b820443072 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/TestCase/ControllerAbstractTest.php @@ -25,12 +25,25 @@ class ControllerAbstractTest extends \Magento\TestFramework\TestCase\AbstractCon /** @var \PHPUnit_Framework_MockObject_MockObject | CookieManagerInterface */ private $cookieManagerMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Serialize\Serializer\Json + */ + private $serializerMock; + protected function setUp() { $testObjectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->messageManager = $this->getMock(\Magento\Framework\Message\Manager::class, [], [], '', false); $this->cookieManagerMock = $this->getMock(CookieManagerInterface::class, [], [], '', false); + $this->serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class) + ->disableOriginalConstructor() + ->getMock(); + $this->serializerMock->expects($this->any())->method('unserialize')->willReturnCallback( + function ($serializedData) { + return json_decode($serializedData, true); + } + ); $this->interpretationStrategyMock = $this->getMock(InterpretationStrategyInterface::class, [], [], '', false); $this->interpretationStrategyMock->expects($this->any()) ->method('interpret') @@ -58,6 +71,7 @@ function (MessageInterface $message) { [\Magento\Framework\App\ResponseInterface::class, $response], [\Magento\Framework\Message\Manager::class, $this->messageManager], [CookieManagerInterface::class, $this->cookieManagerMock], + [\Magento\Framework\Serialize\Serializer\Json::class, $this->serializerMock], [InterpretationStrategyInterface::class, $this->interpretationStrategyMock], ] ) From 1738b3a70722ff65acd8b6d60ab16df61cbadef0 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 26 Jul 2017 12:06:24 +0300 Subject: [PATCH 0354/1004] MSI - Msi stock ui aggregation #39 - refactoring --- .../Model/ResourceModel/StockSourceLink/SaveMultiple.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/SaveMultiple.php b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/SaveMultiple.php index 12d48557fa9fc..239560f9c34f7 100644 --- a/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/SaveMultiple.php +++ b/app/code/Magento/Inventory/Model/ResourceModel/StockSourceLink/SaveMultiple.php @@ -6,8 +6,8 @@ namespace Magento\Inventory\Model\ResourceModel\StockSourceLink; use Magento\Framework\App\ResourceConnection; +use Magento\Inventory\Model\ResourceModel\StockSourceLink as StockSourceLinkResourceModel; use Magento\Inventory\Model\StockSourceLink; -use Magento\Inventory\Setup\InstallSchema; /** * Implementation of StockSourceLink save multiple operation for specific db layer @@ -32,8 +32,6 @@ public function __construct( } /** - * AssignSourcesToStock TODO - * * @param int $stockId * @param array $sourceIds * @return void @@ -41,7 +39,7 @@ public function __construct( public function execute($stockId, array $sourceIds) { $connection = $this->connection->getConnection(); - $tableName = $connection->getTableName(InstallSchema::TABLE_NAME_STOCK_SOURCE_LINK); + $tableName = $connection->getTableName(StockSourceLinkResourceModel::TABLE_NAME_STOCK_SOURCE_LINK); $columns = [ StockSourceLink::SOURCE_ID, @@ -52,7 +50,6 @@ public function execute($stockId, array $sourceIds) foreach ($sourceIds as $sourceId) { $data[] = [$sourceId, $stockId]; } - $connection->insertArray($tableName, $columns, $data); } } From 1b93290cf5d59e03c9c4d28498decb80f1147831 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 26 Jul 2017 12:08:18 +0300 Subject: [PATCH 0355/1004] MSI - Msi stock ui aggregation #39 - refactoring --- app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php | 1 + app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php index 674e322926ef7..ac8bcd942646b 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php @@ -95,6 +95,7 @@ public function execute() $this->messageManager->addErrorMessage($e->getMessage()); $this->processRedirectAfterFailureSave($resultRedirect, $stockId); } catch (Exception $e) { + // TODO: id we can not load links $this->messageManager->addErrorMessage(__('Could not save stock.')); $this->processRedirectAfterFailureSave($resultRedirect, $stockId); } diff --git a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php index 5d7274f18d760..b8530d1e87c75 100644 --- a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php +++ b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php @@ -85,7 +85,6 @@ public function execute($stockId) return $searchResult->getItems(); } catch (\Exception $e) { $this->logger->error($e->getMessage()); - // TODO: throw new LocalizedException(__('Could not load Sources for Stock'), $e); } } From cb858f7b235f4e0e36812a33a9811df290579431 Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 09:41:11 +0000 Subject: [PATCH 0356/1004] Replace the usage of Zend_Json::encode in the setup marketplace controller tests --- .../Magento/Setup/Test/Unit/Controller/MarketplaceTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/src/Magento/Setup/Test/Unit/Controller/MarketplaceTest.php b/setup/src/Magento/Setup/Test/Unit/Controller/MarketplaceTest.php index 93fbc103852fc..02583a68b6e0e 100644 --- a/setup/src/Magento/Setup/Test/Unit/Controller/MarketplaceTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Controller/MarketplaceTest.php @@ -39,7 +39,7 @@ public function testSaveAuthJsonAction() $this->packagesAuth ->expects($this->once()) ->method('checkCredentials') - ->will($this->returnValue(\Zend_Json::encode(['success' => true]))); + ->will($this->returnValue(json_encode(['success' => true]))); $this->packagesAuth ->expects($this->once()) ->method('saveAuthJson') @@ -75,7 +75,7 @@ public function testCheckAuthAction() $this->packagesAuth ->expects($this->once()) ->method('checkCredentials') - ->will($this->returnValue(\Zend_Json::encode(['success' => true]))); + ->will($this->returnValue(json_encode(['success' => true]))); $jsonModel = $this->controller->checkAuthAction(); $this->assertInstanceOf(\Zend\View\Model\ViewModel::class, $jsonModel); $variables = $jsonModel->getVariables(); From 1fa737e83c4c55a63aa9f6ce960bd2339cc65587 Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 10:05:23 +0000 Subject: [PATCH 0357/1004] Remove Zend_Json from the Webapi - inject the new \Magento\Framework\Serialize\Serializer\Json - call unserialize, - Update the catch to \InvalidArgumentException --- .../Webapi/Rest/Request/Deserializer/Json.php | 22 ++++++-- .../Rest/Request/Deserializer/JsonTest.php | 54 +++++++++++-------- 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php b/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php index 994a3ec3c9263..1f634597f8c82 100644 --- a/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php +++ b/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php @@ -20,14 +20,26 @@ class Json implements \Magento\Framework\Webapi\Rest\Request\DeserializerInterfa */ protected $_appState; + /** + * @var \Magento\Framework\Serialize\Serializer\Json + */ + private $serializer; + /** * @param \Magento\Framework\Json\Decoder $decoder - * @param \Magento\Framework\App\State $appState + * @param State $appState + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer + * @throws \RuntimeException */ - public function __construct(\Magento\Framework\Json\Decoder $decoder, State $appState) - { + public function __construct( + \Magento\Framework\Json\Decoder $decoder, + State $appState, + \Magento\Framework\Serialize\Serializer\Json $serializer = null + ) { $this->decoder = $decoder; $this->_appState = $appState; + $this->serializer = $serializer?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\Serializer\Json::class); } /** @@ -46,8 +58,8 @@ public function deserialize($encodedBody) ); } try { - $decodedBody = $this->decoder->decode($encodedBody); - } catch (\Zend_Json_Exception $e) { + $decodedBody = $this->serializer->unserialize($encodedBody); + } catch (\InvalidArgumentException $e) { if ($this->_appState->getMode() !== State::MODE_DEVELOPER) { throw new \Magento\Framework\Webapi\Exception(new Phrase('Decoding error.')); } else { diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Request/Deserializer/JsonTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Request/Deserializer/JsonTest.php index 96eed9781f2ae..9066b2b5f7c00 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Request/Deserializer/JsonTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Request/Deserializer/JsonTest.php @@ -21,6 +21,9 @@ class JsonTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_appStateMock; + /** @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject */ + private $serializerMock; + protected function setUp() { /** Prepare mocks for SUT constructor. */ @@ -28,11 +31,20 @@ protected function setUp() ->disableOriginalConstructor() ->setMethods(['decode']) ->getMock(); - $this->_appStateMock = $this->getMock(\Magento\Framework\App\State::class, [], [], '', false); + $this->_appStateMock = $this->getMock( + \Magento\Framework\App\State::class, + [], + [], + '', + false + ); + $this->serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class) + ->getMock(); /** Initialize SUT. */ $this->_jsonDeserializer = new \Magento\Framework\Webapi\Rest\Request\Deserializer\Json( $this->decoderMock, - $this->_appStateMock + $this->_appStateMock, + $this->serializerMock ); parent::setUp(); } @@ -60,13 +72,13 @@ public function testDeserialize() 'key2' => 'test2', 'array' => ['test01' => 'some1', 'test02' => 'some2'], ]; - $this->decoderMock->expects( - $this->once() - )->method( - 'decode' - )->will( - $this->returnValue($expectedDecodedJson) - ); + $this->serializerMock->expects($this->any()) + ->method('unserialize') + ->willReturnCallback( + function ($serializedData) { + return json_decode($serializedData, true); + } + ); /** Initialize SUT. */ $this->assertEquals( $expectedDecodedJson, @@ -78,9 +90,10 @@ public function testDeserialize() public function testDeserializeInvalidEncodedBodyExceptionDeveloperModeOff() { /** Prepare mocks for SUT constructor. */ - $this->decoderMock->expects($this->once()) - ->method('decode') - ->will($this->throwException(new \Zend_Json_Exception)); + $this->serializerMock + ->expects($this->once()) + ->method('unserialize') + ->will($this->throwException(new \InvalidArgumentException)); $this->_appStateMock->expects($this->once()) ->method('getMode') ->will($this->returnValue('production')); @@ -103,15 +116,14 @@ public function testDeserializeInvalidEncodedBodyExceptionDeveloperModeOff() public function testDeserializeInvalidEncodedBodyExceptionDeveloperModeOn() { /** Prepare mocks for SUT constructor. */ - $this->decoderMock->expects( - $this->once() - )->method( - 'decode' - )->will( - $this->throwException( - new \Zend_Json_Exception('Decoding error:' . PHP_EOL . 'Decoding failed: Syntax error') - ) - ); + $this->serializerMock + ->expects($this->once()) + ->method('unserialize') + ->will( + $this->throwException( + new \InvalidArgumentException('Unable to unserialize value.') + ) + ); $this->_appStateMock->expects($this->once()) ->method('getMode') ->will($this->returnValue('developer')); From 73de6f402d110855172efb52d64f4a14601ad2fb Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 26 Jul 2017 13:52:37 +0300 Subject: [PATCH 0358/1004] MSI - Msi stock ui aggregation #39 - fix tests - split InstallSchema - update Magento\Framework\DB\Ddl\Table --- .../Model/GetAssignedSourcesForStock.php | 2 +- .../Inventory/Model/SourceItemRepository.php | 14 +- .../Magento/Inventory/Setup/InstallSchema.php | 553 ++---------------- .../CreateSourceCarrierLinkTable.php | 92 +++ .../InstallStep/CreateSourceItemTable.php | 126 ++++ .../Setup/InstallStep/CreateSourceTable.php | 239 ++++++++ .../CreateStockSourceLinkTable.php | 112 ++++ .../Setup/InstallStep/CreateStockTable.php | 59 ++ .../Unit/Model/SourceItemRepositoryTest.php | 14 +- .../Test/Unit/Model/SourceRepositoryTest.php | 14 +- .../Test/Unit/Model/StockRepositoryTest.php | 20 +- .../Magento/Framework/DB/Ddl/Table.php | 14 + 12 files changed, 716 insertions(+), 543 deletions(-) create mode 100644 app/code/Magento/Inventory/Setup/InstallStep/CreateSourceCarrierLinkTable.php create mode 100644 app/code/Magento/Inventory/Setup/InstallStep/CreateSourceItemTable.php create mode 100644 app/code/Magento/Inventory/Setup/InstallStep/CreateSourceTable.php create mode 100644 app/code/Magento/Inventory/Setup/InstallStep/CreateStockSourceLinkTable.php create mode 100644 app/code/Magento/Inventory/Setup/InstallStep/CreateStockTable.php diff --git a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php index b8530d1e87c75..5fa720dff5d22 100644 --- a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php +++ b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php @@ -90,7 +90,7 @@ public function execute($stockId) } /** - * @param $stockId + * @param int $stockId * @return \Magento\Framework\DataObject[] */ private function getSourceIds($stockId) diff --git a/app/code/Magento/Inventory/Model/SourceItemRepository.php b/app/code/Magento/Inventory/Model/SourceItemRepository.php index 965a7935ca32a..69f6dbfcac2c5 100644 --- a/app/code/Magento/Inventory/Model/SourceItemRepository.php +++ b/app/code/Magento/Inventory/Model/SourceItemRepository.php @@ -8,7 +8,7 @@ use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotDeleteException; -use Magento\Inventory\Model\ResourceModel\SourceItem as SourceResourceModel; +use Magento\Inventory\Model\ResourceModel\SourceItem as SourceItemResourceModel; use Magento\Inventory\Model\ResourceModel\SourceItem\Collection; use Magento\Inventory\Model\ResourceModel\SourceItem\CollectionFactory; use Magento\InventoryApi\Api\Data\SourceItemInterface; @@ -23,9 +23,9 @@ class SourceItemRepository implements SourceItemRepositoryInterface { /** - * @var SourceResourceModel + * @var SourceItemResourceModel */ - private $sourceResource; + private $sourceItemResource; /** * @var CollectionProcessorInterface @@ -50,20 +50,20 @@ class SourceItemRepository implements SourceItemRepositoryInterface /** * SourceRepository constructor * - * @param SourceResourceModel $sourceResource + * @param SourceItemResourceModel $sourceItemResource * @param CollectionProcessorInterface $collectionProcessor * @param CollectionFactory $sourceItemCollectionFactory * @param SourceItemSearchResultsInterfaceFactory $sourceItemSearchResultsFactory * @param LoggerInterface $logger */ public function __construct( - SourceResourceModel $sourceResource, + SourceItemResourceModel $sourceItemResource, CollectionProcessorInterface $collectionProcessor, CollectionFactory $sourceItemCollectionFactory, SourceItemSearchResultsInterfaceFactory $sourceItemSearchResultsFactory, LoggerInterface $logger ) { - $this->sourceResource = $sourceResource; + $this->sourceItemResource = $sourceItemResource; $this->collectionProcessor = $collectionProcessor; $this->sourceItemCollectionFactory = $sourceItemCollectionFactory; $this->sourceItemSearchResultsFactory = $sourceItemSearchResultsFactory; @@ -93,7 +93,7 @@ public function getList(SearchCriteriaInterface $searchCriteria) public function delete(SourceItemInterface $sourceItem) { try { - $this->sourceResource->delete($sourceItem); + $this->sourceItemResource->delete($sourceItem); } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotDeleteException(__('Could not delete Source Item'), $e); diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index 186bdd77235da..9c236d1b05fa5 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -5,547 +5,76 @@ */ namespace Magento\Inventory\Setup; -use Magento\Framework\DB\Adapter\AdapterInterface; -use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; -use Magento\Inventory\Model\ResourceModel\Source as SourceResourceModel; -use Magento\Inventory\Model\ResourceModel\SourceCarrierLink; -use Magento\Inventory\Model\ResourceModel\SourceItem as SourceItemResourceModel; -use Magento\Inventory\Model\ResourceModel\Stock as StockResourceModel; -use Magento\Inventory\Model\ResourceModel\StockSourceLink as StockSourceLinkResourceModel; -use Magento\Inventory\Model\StockSourceLink; -use Magento\InventoryApi\Api\Data\SourceInterface; -use Magento\InventoryApi\Api\Data\SourceItemInterface; -use Magento\InventoryApi\Api\Data\SourceCarrierLinkInterface; -use Magento\InventoryApi\Api\Data\StockInterface; +use Magento\Inventory\Setup\InstallStep\CreateSourceCarrierLinkTable; +use Magento\Inventory\Setup\InstallStep\CreateSourceItemTable; +use Magento\Inventory\Setup\InstallStep\CreateSourceTable; +use Magento\Inventory\Setup\InstallStep\CreateStockSourceLinkTable; +use Magento\Inventory\Setup\InstallStep\CreateStockTable; -/** - * @codeCoverageIgnore - */ class InstallSchema implements InstallSchemaInterface { /** - * Constant for decimal precision for latitude and longitude + * @var CreateSourceTable */ - const LATLON_PRECISION_LAT = 8; - const LATLON_PRECISION_LON = 9; - const LATLON_SCALE = 6; + private $createSourceTable; /** - * Option keys for column options + * @var CreateSourceCarrierLinkTable */ - const OPTION_IDENTITY = 'identity'; - const OPTION_UNSIGNED = 'unsigned'; - const OPTION_NULLABLE = 'nullable'; - const OPTION_PRIMARY = 'primary'; - const OPTION_DEFAULT = 'default'; - const OPTION_TYPE = 'type'; - const OPTION_LENGTH = 'length'; - const OPTION_SCALE = 'scale'; - const OPTION_PRECISION = 'precision'; + private $createSourceCarrierLinkTable; /** - * {@inheritdoc} + * @var CreateSourceItemTable */ - public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) - { - $setup->startSetup(); - - $sourceTable = $this->createSourceTable($setup); - $sourceTable = $this->addAddressFields($sourceTable); - $sourceTable = $this->addContactInfoFields($sourceTable); - $sourceTable = $this->addSourceCarrierFields($sourceTable); - $setup->getConnection()->createTable($sourceTable); - - $setup->getConnection()->createTable($this->createSourceCarrierLinkTable($setup)); - $setup->getConnection()->createTable($this->createSourceItemTable($setup)); - - $setup->getConnection()->createTable($this->createStockTable($setup)); - $setup->getConnection()->createTable($this->createStockSourceLinkTable($setup)); - - $setup->endSetup(); - } + private $createSourceItemTable; /** - * @param SchemaSetupInterface $setup - * @return Table + * @var CreateStockTable */ - private function createSourceTable(SchemaSetupInterface $setup) - { - $sourceTable = $setup->getTable(SourceResourceModel::TABLE_NAME_SOURCE); - - return $setup->getConnection()->newTable( - $sourceTable - )->setComment( - 'Inventory Source Table' - )->addColumn( - SourceInterface::SOURCE_ID, - Table::TYPE_INTEGER, - null, - [ - self::OPTION_IDENTITY => true, - self::OPTION_UNSIGNED => true, - self::OPTION_NULLABLE => false, - self::OPTION_PRIMARY => true, - ], - 'Source ID' - )->addColumn( - SourceInterface::NAME, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => false, - ], - 'Source Name' - )->addColumn( - SourceInterface::ENABLED, - Table::TYPE_SMALLINT, - null, - [ - self::OPTION_NULLABLE => false, - self::OPTION_UNSIGNED => true, - self::OPTION_DEFAULT => 1, - ], - 'Defines Is Source Enabled' - )->addColumn( - SourceInterface::DESCRIPTION, - Table::TYPE_TEXT, - 1000, - [ - self::OPTION_NULLABLE => true, - ], - 'Description' - )->addColumn( - SourceInterface::LATITUDE, - Table::TYPE_DECIMAL, - null, - [ - self::OPTION_PRECISION => self::LATLON_PRECISION_LAT, - self::OPTION_SCALE => self::LATLON_SCALE, - self::OPTION_UNSIGNED => false, - self::OPTION_NULLABLE => true, - ], - 'Latitude' - )->addColumn( - SourceInterface::LONGITUDE, - Table::TYPE_DECIMAL, - null, - [ - self::OPTION_PRECISION => self::LATLON_PRECISION_LON, - self::OPTION_SCALE => self::LATLON_SCALE, - self::OPTION_UNSIGNED => false, - self::OPTION_NULLABLE => true, - ], - 'Longitude' - )->addColumn( - SourceInterface::PRIORITY, - Table::TYPE_SMALLINT, - null, - [ - self::OPTION_NULLABLE => true, - self::OPTION_UNSIGNED => true, - ], - 'Priority' - ); - } + private $createStockTable; /** - * @param Table $sourceTable - * @return Table + * @var CreateStockSourceLinkTable */ - private function addAddressFields(Table $sourceTable) - { - $sourceTable->addColumn( - SourceInterface::COUNTRY_ID, - Table::TYPE_TEXT, - 2, - [ - self::OPTION_NULLABLE => false, - ], - 'Country Id' - )->addColumn( - SourceInterface::REGION_ID, - Table::TYPE_INTEGER, - null, - [ - self::OPTION_NULLABLE => true, - self::OPTION_UNSIGNED => true, - ], - 'Region Id' - )->addColumn( - SourceInterface::REGION, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => true, - ], - 'Region' - )->addColumn( - SourceInterface::CITY, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => true, - ], - 'City' - )->addColumn( - SourceInterface::STREET, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => true, - ], - 'Street' - )->addColumn( - SourceInterface::POSTCODE, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => false, - ], - 'Postcode' - ); - return $sourceTable; - } + private $createStockSourceLinkTable; /** - * @param Table $sourceTable - * @return Table + * @param CreateSourceTable $createSourceTable + * @param CreateSourceCarrierLinkTable $createSourceCarrierLinkTable + * @param CreateSourceItemTable $createSourceItemTable + * @param CreateStockTable $createStockTable + * @param CreateStockSourceLinkTable $createStockSourceLinkTable */ - private function addContactInfoFields(Table $sourceTable) - { - $sourceTable->addColumn( - SourceInterface::CONTACT_NAME, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => true, - ], - 'Contact Name' - )->addColumn( - SourceInterface::EMAIL, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => true, - ], - 'Email' - )->addColumn( - SourceInterface::PHONE, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => true, - ], - 'Phone' - )->addColumn( - SourceInterface::FAX, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => true, - ], - 'Fax' - ); - return $sourceTable; + public function __construct( + CreateSourceTable $createSourceTable, + CreateSourceCarrierLinkTable $createSourceCarrierLinkTable, + CreateSourceItemTable $createSourceItemTable, + CreateStockTable $createStockTable, + CreateStockSourceLinkTable $createStockSourceLinkTable + ) { + $this->createSourceTable = $createSourceTable; + $this->createSourceCarrierLinkTable = $createSourceCarrierLinkTable; + $this->createSourceItemTable = $createSourceItemTable; + $this->createStockTable = $createStockTable; + $this->createStockSourceLinkTable = $createStockSourceLinkTable; } /** - * @param Table $sourceTable - * @return Table - */ - private function addSourceCarrierFields(Table $sourceTable) - { - $sourceTable->addColumn( - 'use_default_carrier_config', - Table::TYPE_SMALLINT, - null, - [ - 'unsigned' => true, - 'nullable' => false, - 'default' => '1' - ], - 'Use default carrier configuration' - ); - return $sourceTable; - } - - /** - * @param SchemaSetupInterface $setup - * @return Table - */ - private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) - { - $sourceCarrierLinkTable = $setup->getTable(SourceCarrierLink::TABLE_NAME_SOURCE_CARRIER_LINK); - $sourceTable = $setup->getTable(SourceResourceModel::TABLE_NAME_SOURCE); - - return $setup->getConnection()->newTable( - $sourceCarrierLinkTable - )->setComment( - 'Inventory Source Carrier Link Table' - )->addColumn( - SourceCarrierLink::ID_FIELD_NAME, - Table::TYPE_INTEGER, - null, - [ - self::OPTION_IDENTITY => true, - self::OPTION_UNSIGNED => true, - self::OPTION_NULLABLE => false, - self::OPTION_PRIMARY => true, - ], - 'Source Carrier Link ID' - )->addColumn( - SourceInterface::SOURCE_ID, - Table::TYPE_INTEGER, - null, - [ - self::OPTION_NULLABLE => false, - self::OPTION_UNSIGNED => true, - ], - 'Source ID' - )->addColumn( - SourceCarrierLinkInterface::CARRIER_CODE, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => false, - ], - 'Carrier Code' - )->addColumn( - 'position', - Table::TYPE_SMALLINT, - null, - [ - self::OPTION_NULLABLE => true, - self::OPTION_UNSIGNED => true, - ], - 'Position' - )->addForeignKey( - $setup->getFkName( - $sourceCarrierLinkTable, - SourceInterface::SOURCE_ID, - $sourceTable, - SourceInterface::SOURCE_ID - ), - SourceInterface::SOURCE_ID, - $sourceTable, - SourceInterface::SOURCE_ID, - AdapterInterface::FK_ACTION_CASCADE - ); - } - - /** - * @param SchemaSetupInterface $setup - * @return Table - */ - private function createSourceItemTable(SchemaSetupInterface $setup) - { - $sourceItemTable = $setup->getTable(SourceItemResourceModel::TABLE_NAME_SOURCE_ITEM); - - return $setup->getConnection()->newTable( - $sourceItemTable - )->setComment( - 'Inventory Source item Table' - )->addColumn( - SourceItemResourceModel::ID_FIELD_NAME, - Table::TYPE_INTEGER, - null, - [ - self::OPTION_IDENTITY => true, - self::OPTION_UNSIGNED => true, - self::OPTION_NULLABLE => false, - self::OPTION_PRIMARY => true, - ], - 'Source Item ID' - )->addColumn( - SourceItemInterface::SOURCE_ID, - Table::TYPE_INTEGER, - null, - [ - self::OPTION_UNSIGNED => true, - self::OPTION_NULLABLE => false, - ], - 'Source ID' - )->addColumn( - SourceItemInterface::SKU, - Table::TYPE_TEXT, - 64, - [ - self::OPTION_NULLABLE => false, - ], - 'Sku' - )->addColumn( - SourceItemInterface::QUANTITY, - Table::TYPE_DECIMAL, - null, - [ - self::OPTION_UNSIGNED => false, - self::OPTION_NULLABLE => false, - self::OPTION_DEFAULT => 0, - ], - 'Quantity' - )->addColumn( - SourceItemInterface::STATUS, - Table::TYPE_SMALLINT, - null, - [ - self::OPTION_NULLABLE => true, - self::OPTION_UNSIGNED => true, - ], - 'Status' - )->addForeignKey( - $setup->getFkName( - $sourceItemTable, - SourceItemInterface::SOURCE_ID, - SourceResourceModel::TABLE_NAME_SOURCE, - SourceInterface::SOURCE_ID - ), - SourceItemInterface::SOURCE_ID, - SourceResourceModel::TABLE_NAME_SOURCE, - SourceInterface::SOURCE_ID, - AdapterInterface::FK_ACTION_CASCADE - )->addForeignKey( - $setup->getFkName( - $sourceItemTable, - SourceItemInterface::SKU, - 'catalog_product_entity', - 'sku' - ), - SourceItemInterface::SKU, - 'catalog_product_entity', - 'sku', - AdapterInterface::FK_ACTION_CASCADE - )->addIndex( - $setup->getIdxName( - $sourceItemTable, - [ - SourceItemInterface::SOURCE_ID, - SourceItemInterface::SKU, - ], - AdapterInterface::INDEX_TYPE_UNIQUE - ), - [ - SourceItemInterface::SOURCE_ID, - SourceItemInterface::SKU, - ], - ['type' => AdapterInterface::INDEX_TYPE_UNIQUE] - ); - } - - /** - * @param SchemaSetupInterface $setup - * @return Table + * {@inheritdoc} */ - private function createStockTable(SchemaSetupInterface $setup) + public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { - $stockTable = $setup->getTable(StockResourceModel::TABLE_NAME_STOCK); - - return $setup->getConnection()->newTable( - $stockTable - )->setComment( - 'Inventory Stock Table' - )->addColumn( - StockInterface::STOCK_ID, - Table::TYPE_INTEGER, - null, - [ - self::OPTION_IDENTITY => true, - self::OPTION_UNSIGNED => true, - self::OPTION_NULLABLE => false, - self::OPTION_PRIMARY => true, - ], - 'Stock ID' - )->addColumn( - StockInterface::NAME, - Table::TYPE_TEXT, - 255, - [ - self::OPTION_NULLABLE => false, - ], - 'Stock Name' - ); - } + $setup->startSetup(); - /** - * @param SchemaSetupInterface $setup - * @return Table - */ - private function createStockSourceLinkTable(SchemaSetupInterface $setup) { - $stockSourceLinkTable = $setup->getTable(StockSourceLinkResourceModel::TABLE_NAME_STOCK_SOURCE_LINK); - $stockTable = $setup->getTable(StockResourceModel::TABLE_NAME_STOCK); - $sourceTable = $setup->getTable(SourceResourceModel::TABLE_NAME_SOURCE); + $this->createSourceTable->execute($setup); + $this->createSourceCarrierLinkTable->execute($setup); + $this->createSourceItemTable->execute($setup); + $this->createStockTable->execute($setup); + $this->createStockSourceLinkTable->execute($setup); - return $setup->getConnection()->newTable( - $stockSourceLinkTable - )->setComment( - 'Inventory Source Stock Link Table' - )->addColumn( - 'link_id', - Table::TYPE_INTEGER, - null, - [ - self::OPTION_IDENTITY => true, - self::OPTION_UNSIGNED => true, - self::OPTION_NULLABLE => false, - self::OPTION_PRIMARY => true, - ], - 'Link ID' - )->addColumn( - StockSourceLink::STOCK_ID, - Table::TYPE_INTEGER, - null, - [ - self::OPTION_NULLABLE => false, - self::OPTION_UNSIGNED => true, - ], - 'Stock ID' - )->addColumn( - StockSourceLink::SOURCE_ID, - Table::TYPE_INTEGER, - null, - [ - self::OPTION_NULLABLE => false, - self::OPTION_UNSIGNED => true, - ], - 'Source ID' - )->addForeignKey( - $setup->getFkName( - $stockSourceLinkTable, - StockSourceLink::STOCK_ID, - $stockTable, - StockInterface::STOCK_ID - ), - StockSourceLink::STOCK_ID, - $stockTable, - StockInterface::STOCK_ID, - AdapterInterface::FK_ACTION_CASCADE - )->addForeignKey( - $setup->getFkName( - $stockSourceLinkTable, - StockSourceLink::SOURCE_ID, - $sourceTable, - SourceInterface::SOURCE_ID - ), - StockSourceLink::SOURCE_ID, - $sourceTable, - SourceInterface::SOURCE_ID, - AdapterInterface::FK_ACTION_CASCADE - )->addIndex( - $setup->getIdxName( - $stockSourceLinkTable, - [ - StockSourceLink::STOCK_ID, - StockSourceLink::SOURCE_ID, - ], - AdapterInterface::INDEX_TYPE_UNIQUE - ), - [ - StockSourceLink::STOCK_ID, - StockSourceLink::SOURCE_ID, - ], - ['type' => AdapterInterface::INDEX_TYPE_UNIQUE] - ); + $setup->endSetup(); } } diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceCarrierLinkTable.php b/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceCarrierLinkTable.php new file mode 100644 index 0000000000000..6dc88f05780e0 --- /dev/null +++ b/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceCarrierLinkTable.php @@ -0,0 +1,92 @@ +createSourceCarrierLinkTable($setup); + + $setup->getConnection()->createTable($sourceCarrierLinkTable); + } + + /** + * @param SchemaSetupInterface $setup + * @return Table + */ + private function createSourceCarrierLinkTable(SchemaSetupInterface $setup) + { + $sourceCarrierLinkTable = $setup->getTable(SourceCarrierLink::TABLE_NAME_SOURCE_CARRIER_LINK); + $sourceTable = $setup->getTable(SourceResourceModel::TABLE_NAME_SOURCE); + + return $setup->getConnection()->newTable( + $sourceCarrierLinkTable + )->setComment( + 'Inventory Source Carrier Link Table' + )->addColumn( + SourceCarrierLink::ID_FIELD_NAME, + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_IDENTITY => true, + Table::OPTION_UNSIGNED => true, + Table::OPTION_NULLABLE => false, + Table::OPTION_PRIMARY => true, + ], + 'Source Carrier Link ID' + )->addColumn( + SourceInterface::SOURCE_ID, + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_NULLABLE => false, + Table::OPTION_UNSIGNED => true, + ], + 'Source ID' + )->addColumn( + SourceCarrierLinkInterface::CARRIER_CODE, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => false, + ], + 'Carrier Code' + )->addColumn( + 'position', + Table::TYPE_SMALLINT, + null, + [ + Table::OPTION_NULLABLE => true, + Table::OPTION_UNSIGNED => true, + ], + 'Position' + )->addForeignKey( + $setup->getFkName( + $sourceCarrierLinkTable, + SourceInterface::SOURCE_ID, + $sourceTable, + SourceInterface::SOURCE_ID + ), + SourceInterface::SOURCE_ID, + $sourceTable, + SourceInterface::SOURCE_ID, + AdapterInterface::FK_ACTION_CASCADE + ); + } +} diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceItemTable.php b/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceItemTable.php new file mode 100644 index 0000000000000..2234deaa945fb --- /dev/null +++ b/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceItemTable.php @@ -0,0 +1,126 @@ +createSourceItemTable($setup); + + $setup->getConnection()->createTable($sourceItemTable); + } + + /** + * @param SchemaSetupInterface $setup + * @return Table + */ + private function createSourceItemTable(SchemaSetupInterface $setup) + { + $sourceItemTable = $setup->getTable(SourceItemResourceModel::TABLE_NAME_SOURCE_ITEM); + + return $setup->getConnection()->newTable( + $sourceItemTable + )->setComment( + 'Inventory Source item Table' + )->addColumn( + SourceItemResourceModel::ID_FIELD_NAME, + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_IDENTITY => true, + Table::OPTION_UNSIGNED => true, + Table::OPTION_NULLABLE => false, + Table::OPTION_PRIMARY => true, + ], + 'Source Item ID' + )->addColumn( + SourceItemInterface::SOURCE_ID, + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_UNSIGNED => true, + Table::OPTION_NULLABLE => false, + ], + 'Source ID' + )->addColumn( + SourceItemInterface::SKU, + Table::TYPE_TEXT, + 64, + [ + Table::OPTION_NULLABLE => false, + ], + 'Sku' + )->addColumn( + SourceItemInterface::QUANTITY, + Table::TYPE_DECIMAL, + null, + [ + Table::OPTION_UNSIGNED => false, + Table::OPTION_NULLABLE => false, + Table::OPTION_DEFAULT => 0, + ], + 'Quantity' + )->addColumn( + SourceItemInterface::STATUS, + Table::TYPE_SMALLINT, + null, + [ + Table::OPTION_NULLABLE => true, + Table::OPTION_UNSIGNED => true, + ], + 'Status' + )->addForeignKey( + $setup->getFkName( + $sourceItemTable, + SourceItemInterface::SOURCE_ID, + SourceResourceModel::TABLE_NAME_SOURCE, + SourceInterface::SOURCE_ID + ), + SourceItemInterface::SOURCE_ID, + SourceResourceModel::TABLE_NAME_SOURCE, + SourceInterface::SOURCE_ID, + AdapterInterface::FK_ACTION_CASCADE + )->addForeignKey( + $setup->getFkName( + $sourceItemTable, + SourceItemInterface::SKU, + 'catalog_product_entity', + 'sku' + ), + SourceItemInterface::SKU, + 'catalog_product_entity', + 'sku', + AdapterInterface::FK_ACTION_CASCADE + )->addIndex( + $setup->getIdxName( + $sourceItemTable, + [ + SourceItemInterface::SOURCE_ID, + SourceItemInterface::SKU, + ], + AdapterInterface::INDEX_TYPE_UNIQUE + ), + [ + SourceItemInterface::SOURCE_ID, + SourceItemInterface::SKU, + ], + ['type' => AdapterInterface::INDEX_TYPE_UNIQUE] + ); + } +} diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceTable.php b/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceTable.php new file mode 100644 index 0000000000000..28bd31b980072 --- /dev/null +++ b/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceTable.php @@ -0,0 +1,239 @@ +getConnection()->newTable( + $setup->getTable(SourceResourceModel::TABLE_NAME_SOURCE) + )->setComment( + 'Inventory Source Table' + ); + + $sourceTable = $this->addBaseFields($sourceTable); + $sourceTable = $this->addAddressFields($sourceTable); + $sourceTable = $this->addContactInfoFields($sourceTable); + $sourceTable = $this->addSourceCarrierFields($sourceTable); + + $setup->getConnection()->createTable($sourceTable); + } + + /** + * @param Table $sourceTable + * @return Table + */ + private function addBaseFields(Table $sourceTable) + { + return $sourceTable->addColumn( + SourceInterface::SOURCE_ID, + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_IDENTITY => true, + Table::OPTION_UNSIGNED => true, + Table::OPTION_NULLABLE => false, + Table::OPTION_PRIMARY => true, + ], + 'Source ID' + )->addColumn( + SourceInterface::NAME, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => false, + ], + 'Source Name' + )->addColumn( + SourceInterface::ENABLED, + Table::TYPE_SMALLINT, + null, + [ + Table::OPTION_NULLABLE => false, + Table::OPTION_UNSIGNED => true, + Table::OPTION_DEFAULT => 1, + ], + 'Defines Is Source Enabled' + )->addColumn( + SourceInterface::DESCRIPTION, + Table::TYPE_TEXT, + 1000, + [ + Table::OPTION_NULLABLE => true, + ], + 'Description' + )->addColumn( + SourceInterface::LATITUDE, + Table::TYPE_DECIMAL, + null, + [ + Table::OPTION_PRECISION => self::LATLON_PRECISION_LAT, + Table::OPTION_SCALE => self::LATLON_SCALE, + Table::OPTION_UNSIGNED => false, + Table::OPTION_NULLABLE => true, + ], + 'Latitude' + )->addColumn( + SourceInterface::LONGITUDE, + Table::TYPE_DECIMAL, + null, + [ + Table::OPTION_PRECISION => self::LATLON_PRECISION_LON, + Table::OPTION_SCALE => self::LATLON_SCALE, + Table::OPTION_UNSIGNED => false, + Table::OPTION_NULLABLE => true, + ], + 'Longitude' + )->addColumn( + SourceInterface::PRIORITY, + Table::TYPE_SMALLINT, + null, + [ + Table::OPTION_NULLABLE => true, + Table::OPTION_UNSIGNED => true, + ], + 'Priority' + ); + } + + /** + * @param Table $sourceTable + * @return Table + */ + private function addAddressFields(Table $sourceTable) + { + $sourceTable->addColumn( + SourceInterface::COUNTRY_ID, + Table::TYPE_TEXT, + 2, + [ + Table::OPTION_NULLABLE => false, + ], + 'Country Id' + )->addColumn( + SourceInterface::REGION_ID, + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_NULLABLE => true, + Table::OPTION_UNSIGNED => true, + ], + 'Region Id' + )->addColumn( + SourceInterface::REGION, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => true, + ], + 'Region' + )->addColumn( + SourceInterface::CITY, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => true, + ], + 'City' + )->addColumn( + SourceInterface::STREET, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => true, + ], + 'Street' + )->addColumn( + SourceInterface::POSTCODE, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => false, + ], + 'Postcode' + ); + return $sourceTable; + } + + /** + * @param Table $sourceTable + * @return Table + */ + private function addContactInfoFields(Table $sourceTable) + { + $sourceTable->addColumn( + SourceInterface::CONTACT_NAME, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => true, + ], + 'Contact Name' + )->addColumn( + SourceInterface::EMAIL, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => true, + ], + 'Email' + )->addColumn( + SourceInterface::PHONE, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => true, + ], + 'Phone' + )->addColumn( + SourceInterface::FAX, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => true, + ], + 'Fax' + ); + return $sourceTable; + } + + /** + * @param Table $sourceTable + * @return Table + */ + private function addSourceCarrierFields(Table $sourceTable) + { + $sourceTable->addColumn( + 'use_default_carrier_config', + Table::TYPE_SMALLINT, + null, + [ + 'unsigned' => true, + 'nullable' => false, + 'default' => '1' + ], + 'Use default carrier configuration' + ); + return $sourceTable; + } +} diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateStockSourceLinkTable.php b/app/code/Magento/Inventory/Setup/InstallStep/CreateStockSourceLinkTable.php new file mode 100644 index 0000000000000..2f5b25d7e7518 --- /dev/null +++ b/app/code/Magento/Inventory/Setup/InstallStep/CreateStockSourceLinkTable.php @@ -0,0 +1,112 @@ +createStockSourceLinkTable($setup); + + $setup->getConnection()->createTable($stockSourceLinkTable); + } + + /** + * @param SchemaSetupInterface $setup + * @return Table + */ + private function createStockSourceLinkTable(SchemaSetupInterface $setup) + { + $stockSourceLinkTable = $setup->getTable(StockSourceLinkResourceModel::TABLE_NAME_STOCK_SOURCE_LINK); + $stockTable = $setup->getTable(StockResourceModel::TABLE_NAME_STOCK); + $sourceTable = $setup->getTable(SourceResourceModel::TABLE_NAME_SOURCE); + + return $setup->getConnection()->newTable( + $stockSourceLinkTable + )->setComment( + 'Inventory Source Stock Link Table' + )->addColumn( + 'link_id', + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_IDENTITY => true, + Table::OPTION_UNSIGNED => true, + Table::OPTION_NULLABLE => false, + Table::OPTION_PRIMARY => true, + ], + 'Link ID' + )->addColumn( + StockSourceLink::STOCK_ID, + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_NULLABLE => false, + Table::OPTION_UNSIGNED => true, + ], + 'Stock ID' + )->addColumn( + StockSourceLink::SOURCE_ID, + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_NULLABLE => false, + Table::OPTION_UNSIGNED => true, + ], + 'Source ID' + )->addForeignKey( + $setup->getFkName( + $stockSourceLinkTable, + StockSourceLink::STOCK_ID, + $stockTable, + StockInterface::STOCK_ID + ), + StockSourceLink::STOCK_ID, + $stockTable, + StockInterface::STOCK_ID, + AdapterInterface::FK_ACTION_CASCADE + )->addForeignKey( + $setup->getFkName( + $stockSourceLinkTable, + StockSourceLink::SOURCE_ID, + $sourceTable, + SourceInterface::SOURCE_ID + ), + StockSourceLink::SOURCE_ID, + $sourceTable, + SourceInterface::SOURCE_ID, + AdapterInterface::FK_ACTION_CASCADE + )->addIndex( + $setup->getIdxName( + $stockSourceLinkTable, + [ + StockSourceLink::STOCK_ID, + StockSourceLink::SOURCE_ID, + ], + AdapterInterface::INDEX_TYPE_UNIQUE + ), + [ + StockSourceLink::STOCK_ID, + StockSourceLink::SOURCE_ID, + ], + ['type' => AdapterInterface::INDEX_TYPE_UNIQUE] + ); + } +} diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateStockTable.php b/app/code/Magento/Inventory/Setup/InstallStep/CreateStockTable.php new file mode 100644 index 0000000000000..a6760bbdb9c8c --- /dev/null +++ b/app/code/Magento/Inventory/Setup/InstallStep/CreateStockTable.php @@ -0,0 +1,59 @@ +createStockTable($setup); + + $setup->getConnection()->createTable($stockTable); + } + + /** + * @param SchemaSetupInterface $setup + * @return Table + */ + private function createStockTable(SchemaSetupInterface $setup) + { + $stockTable = $setup->getTable(StockResourceModel::TABLE_NAME_STOCK); + + return $setup->getConnection()->newTable( + $stockTable + )->setComment( + 'Inventory Stock Table' + )->addColumn( + StockInterface::STOCK_ID, + Table::TYPE_INTEGER, + null, + [ + Table::OPTION_IDENTITY => true, + Table::OPTION_UNSIGNED => true, + Table::OPTION_NULLABLE => false, + Table::OPTION_PRIMARY => true, + ], + 'Stock ID' + )->addColumn( + StockInterface::NAME, + Table::TYPE_TEXT, + 255, + [ + Table::OPTION_NULLABLE => false, + ], + 'Stock Name' + ); + } +} diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php index 056042dfcd133..6c2b658be129e 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php @@ -5,7 +5,7 @@ use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\Inventory\Model\ResourceModel\SourceItem as SourceResource; +use Magento\Inventory\Model\ResourceModel\SourceItem as SourceItemResource; use Magento\Inventory\Model\ResourceModel\SourceItem\Collection as SourceItemCollection; use Magento\Inventory\Model\ResourceModel\SourceItem\CollectionFactory as SourceItemCollectionFactory; use Magento\Inventory\Model\SourceItem; @@ -22,9 +22,9 @@ class SourceItemRepositoryTest extends \PHPUnit_Framework_TestCase { /** - * @var SourceResource|\PHPUnit_Framework_MockObject_MockObject + * @var SourceItemResource|\PHPUnit_Framework_MockObject_MockObject */ - private $resourceSource; + private $sourceItemResource; /** * @var SourceItemInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject @@ -68,7 +68,9 @@ class SourceItemRepositoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->resourceSource = $this->getMockBuilder(SourceResource::class)->disableOriginalConstructor()->getMock(); + $this->sourceItemResource = $this->getMockBuilder(SourceItemResource::class) + ->disableOriginalConstructor() + ->getMock(); $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) ->disableOriginalConstructor() ->getMock(); @@ -97,7 +99,7 @@ protected function setUp() $this->sourceItemRepository = $objectManager->getObject( SourceItemRepository::class, [ - 'resourceSource' => $this->resourceSource, + 'sourceItemResource' => $this->sourceItemResource, 'sourceItemFactory' => $this->sourceItemFactory, 'collectionProcessor' => $this->collectionProcessor, 'sourceItemCollectionFactory' => $this->sourceItemCollectionFactory, @@ -163,7 +165,7 @@ public function testGetListWithSearchCriteria() public function testDelete() { - $this->resourceSource + $this->sourceItemResource ->expects($this->once()) ->method('delete') ->with($this->sourceItem); diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 291b7ca2e6075..d2ade01397193 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -25,7 +25,7 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var SourceResource|\PHPUnit_Framework_MockObject_MockObject */ - private $resourceSource; + private $sourceResource; /** * @var SourceInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject @@ -69,7 +69,7 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->resourceSource = $this->getMockBuilder(SourceResource::class)->disableOriginalConstructor()->getMock(); + $this->sourceResource = $this->getMockBuilder(SourceResource::class)->disableOriginalConstructor()->getMock(); $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) ->disableOriginalConstructor() ->getMock(); @@ -100,7 +100,7 @@ protected function setUp() $this->model = $objectManager->getObject( \Magento\Inventory\Model\SourceRepository::class, [ - 'resourceSource' => $this->resourceSource, + 'sourceResource' => $this->sourceResource, 'sourceFactory' => $this->sourceFactory, 'collectionProcessor' => $this->collectionProcessor, 'sourceCollectionFactory' => $this->sourceCollectionFactory, @@ -119,7 +119,7 @@ public function testSave() ->expects($this->once()) ->method('getSourceId') ->willReturn($sourceId); - $this->resourceSource + $this->sourceResource ->expects($this->once()) ->method('save') ->with($this->source); @@ -134,7 +134,7 @@ public function testSaveErrorExpectsException() { $message = 'some message'; - $this->resourceSource + $this->sourceResource ->expects($this->once()) ->method('save') ->willThrowException(new \Exception($message)); @@ -159,7 +159,7 @@ public function testGet() ->expects($this->once()) ->method('create') ->willReturn($this->source); - $this->resourceSource + $this->sourceResource ->expects($this->once()) ->method('load') ->with($this->source, $sourceId, SourceInterface::SOURCE_ID); @@ -182,7 +182,7 @@ public function testGetErrorExpectsException() ->expects($this->once()) ->method('create') ->willReturn($this->source); - $this->resourceSource->expects($this->once()) + $this->sourceResource->expects($this->once()) ->method('load') ->with( $this->source, diff --git a/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php index f2a5e2dda826d..5f84ac7dfff64 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php @@ -25,7 +25,7 @@ class StockRepositoryTest extends \PHPUnit_Framework_TestCase /** * @var StockResource|\PHPUnit_Framework_MockObject_MockObject */ - private $resourceStock; + private $stockResource; /** * @var StockInterfaceFactory|\PHPUnit_Framework_MockObject_MockObject @@ -69,7 +69,7 @@ class StockRepositoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->resourceStock = $this->getMockBuilder(StockResource::class)->disableOriginalConstructor()->getMock(); + $this->stockResource = $this->getMockBuilder(StockResource::class)->disableOriginalConstructor()->getMock(); $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) ->disableOriginalConstructor() ->getMock(); @@ -100,7 +100,7 @@ protected function setUp() $this->model = $objectManager->getObject( \Magento\Inventory\Model\StockRepository::class, [ - 'resourceStock' => $this->resourceStock, + 'stockResource' => $this->stockResource, 'stockFactory' => $this->stockFactory, 'collectionProcessor' => $this->collectionProcessor, 'stockCollectionFactory' => $this->stockCollectionFactory, @@ -119,7 +119,7 @@ public function testSave() ->expects($this->once()) ->method('getStockId') ->willReturn($stockId); - $this->resourceStock + $this->stockResource ->expects($this->once()) ->method('save') ->with($this->stock); @@ -134,7 +134,7 @@ public function testSaveErrorExpectsException() { $message = 'some message'; - $this->resourceStock + $this->stockResource ->expects($this->once()) ->method('save') ->willThrowException(new \Exception($message)); @@ -159,7 +159,7 @@ public function testGet() ->expects($this->once()) ->method('create') ->willReturn($this->stock); - $this->resourceStock + $this->stockResource ->expects($this->once()) ->method('load') ->with($this->stock, $stockId, StockInterface::STOCK_ID); @@ -182,7 +182,7 @@ public function testGetErrorExpectsException() ->expects($this->once()) ->method('create') ->willReturn($this->stock); - $this->resourceStock->expects($this->once()) + $this->stockResource->expects($this->once()) ->method('load') ->with( $this->stock, @@ -318,12 +318,12 @@ public function testDeleteById() ->expects($this->once()) ->method('create') ->willReturn($this->stock); - $this->resourceStock + $this->stockResource ->expects($this->once()) ->method('load') ->with($this->stock, $stockId, StockInterface::STOCK_ID); - $this->resourceStock + $this->stockResource ->expects($this->once()) ->method('delete') ->with($this->stock); @@ -346,7 +346,7 @@ public function testDeleteErrorExpectsException() ->expects($this->once()) ->method('create') ->willReturn($this->stock); - $this->resourceStock->expects($this->once()) + $this->stockResource->expects($this->once()) ->method('load') ->with( $this->stock, diff --git a/lib/internal/Magento/Framework/DB/Ddl/Table.php b/lib/internal/Magento/Framework/DB/Ddl/Table.php index 44ce0f5d76c62..4f6ad7a758db7 100644 --- a/lib/internal/Magento/Framework/DB/Ddl/Table.php +++ b/lib/internal/Magento/Framework/DB/Ddl/Table.php @@ -78,6 +78,20 @@ class Table const ACTION_SET_DEFAULT = 'SET DEFAULT'; + /**#@+ + * Option keys for column options + */ + const OPTION_IDENTITY = 'identity'; + const OPTION_UNSIGNED = 'unsigned'; + const OPTION_NULLABLE = 'nullable'; + const OPTION_PRIMARY = 'primary'; + const OPTION_DEFAULT = 'default'; + const OPTION_TYPE = 'type'; + const OPTION_LENGTH = 'length'; + const OPTION_SCALE = 'scale'; + const OPTION_PRECISION = 'precision'; + /**#@-*/ + /** * Name of table * From e1ced8d88682e4d82961cab24079b773a9fa6f0b Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 26 Jul 2017 14:06:12 +0300 Subject: [PATCH 0359/1004] MSI - Msi stock ui aggregation #39 - fix static tests --- .../Inventory/Model/StockRepository.php | 57 ++----------- .../Model/StockRepository/GetList.php | 80 +++++++++++++++++++ 2 files changed, 87 insertions(+), 50 deletions(-) create mode 100644 app/code/Magento/Inventory/Model/StockRepository/GetList.php diff --git a/app/code/Magento/Inventory/Model/StockRepository.php b/app/code/Magento/Inventory/Model/StockRepository.php index 73adfb64a0828..28eb2348d9851 100644 --- a/app/code/Magento/Inventory/Model/StockRepository.php +++ b/app/code/Magento/Inventory/Model/StockRepository.php @@ -5,19 +5,14 @@ */ namespace Magento\Inventory\Model; -use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; -use Magento\Framework\Api\SearchCriteriaBuilder; use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Exception\CouldNotDeleteException; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Inventory\Model\ResourceModel\Stock as StockResourceModel; -use Magento\Inventory\Model\ResourceModel\Stock\Collection; -use Magento\Inventory\Model\ResourceModel\Stock\CollectionFactory; +use Magento\Inventory\Model\StockRepository\GetList; use Magento\InventoryApi\Api\Data\StockInterface; use Magento\InventoryApi\Api\Data\StockInterfaceFactory; -use Magento\InventoryApi\Api\Data\StockSearchResultsInterface; -use Magento\InventoryApi\Api\Data\StockSearchResultsInterfaceFactory; use Magento\InventoryApi\Api\StockRepositoryInterface; use Psr\Log\LoggerInterface; @@ -37,24 +32,9 @@ class StockRepository implements StockRepositoryInterface private $stockFactory; /** - * @var CollectionProcessorInterface + * @var GetList */ - private $collectionProcessor; - - /** - * @var CollectionFactory - */ - private $stockCollectionFactory; - - /** - * @var StockSearchResultsInterfaceFactory - */ - private $stockSearchResultsFactory; - - /** - * @var SearchCriteriaBuilder - */ - private $searchCriteriaBuilder; + private $getList; /** * @var LoggerInterface @@ -66,27 +46,18 @@ class StockRepository implements StockRepositoryInterface * * @param StockResourceModel $stockResource * @param StockInterfaceFactory $stockFactory - * @param CollectionProcessorInterface $collectionProcessor - * @param CollectionFactory $stockCollectionFactory - * @param StockSearchResultsInterfaceFactory $stockSearchResultsFactory - * @param SearchCriteriaBuilder $searchCriteriaBuilder + * @param GetList $getList * @param LoggerInterface $logger */ public function __construct( StockResourceModel $stockResource, StockInterfaceFactory $stockFactory, - CollectionProcessorInterface $collectionProcessor, - CollectionFactory $stockCollectionFactory, - StockSearchResultsInterfaceFactory $stockSearchResultsFactory, - SearchCriteriaBuilder $searchCriteriaBuilder, + GetList $getList, LoggerInterface $logger ) { $this->stockResource = $stockResource; $this->stockFactory = $stockFactory; - $this->collectionProcessor = $collectionProcessor; - $this->stockCollectionFactory = $stockCollectionFactory; - $this->stockSearchResultsFactory = $stockSearchResultsFactory; - $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->getList = $getList; $this->logger = $logger; } @@ -139,20 +110,6 @@ public function deleteById($stockId) */ public function getList(SearchCriteriaInterface $searchCriteria = null) { - /** @var Collection $collection */ - $collection = $this->stockCollectionFactory->create(); - - if (null === $searchCriteria) { - $searchCriteria = $this->searchCriteriaBuilder->create(); - } else { - $this->collectionProcessor->process($searchCriteria, $collection); - } - - /** @var StockSearchResultsInterface $searchResult */ - $searchResult = $this->stockSearchResultsFactory->create(); - $searchResult->setItems($collection->getItems()); - $searchResult->setTotalCount($collection->getSize()); - $searchResult->setSearchCriteria($searchCriteria); - return $searchResult; + return $this->getList->execute($searchCriteria); } } diff --git a/app/code/Magento/Inventory/Model/StockRepository/GetList.php b/app/code/Magento/Inventory/Model/StockRepository/GetList.php new file mode 100644 index 0000000000000..5c78cbcdfcf34 --- /dev/null +++ b/app/code/Magento/Inventory/Model/StockRepository/GetList.php @@ -0,0 +1,80 @@ +collectionProcessor = $collectionProcessor; + $this->stockCollectionFactory = $stockCollectionFactory; + $this->stockSearchResultsFactory = $stockSearchResultsFactory; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + } + + /** + * @param SearchCriteriaInterface|null $searchCriteria + * @return StockSearchResultsInterface + */ + public function execute(SearchCriteriaInterface $searchCriteria = null) + { + /** @var Collection $collection */ + $collection = $this->stockCollectionFactory->create(); + + if (null === $searchCriteria) { + $searchCriteria = $this->searchCriteriaBuilder->create(); + } else { + $this->collectionProcessor->process($searchCriteria, $collection); + } + + /** @var StockSearchResultsInterface $searchResult */ + $searchResult = $this->stockSearchResultsFactory->create(); + $searchResult->setItems($collection->getItems()); + $searchResult->setTotalCount($collection->getSize()); + $searchResult->setSearchCriteria($searchCriteria); + return $searchResult; + } +} From f2a93625996e8e1c2c622d64b783b7caa3066d93 Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 11:49:59 +0000 Subject: [PATCH 0360/1004] Update the $decoder property to be noted as deprecated --- .../Framework/Webapi/Rest/Request/Deserializer/Json.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php b/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php index 1f634597f8c82..597089d7bdbf0 100644 --- a/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php +++ b/lib/internal/Magento/Framework/Webapi/Rest/Request/Deserializer/Json.php @@ -12,7 +12,10 @@ class Json implements \Magento\Framework\Webapi\Rest\Request\DeserializerInterface { - /** @var \Magento\Framework\Json\Decoder */ + /** + * @var \Magento\Framework\Json\Decoder + * @deprecated + */ protected $decoder; /** From 268a2799ca76a0a7e0a84f7dce901f56293ff56a Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Wed, 26 Jul 2017 15:03:24 +0300 Subject: [PATCH 0361/1004] MSI - Msi stock ui aggregation #39 - fix static tests --- .../Unit/Model/SourceItemRepositoryTest.php | 4 + .../Test/Unit/Model/StockRepositoryTest.php | 148 ++---------------- 2 files changed, 20 insertions(+), 132 deletions(-) diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php index 6c2b658be129e..b51ac81c52907 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php @@ -1,4 +1,8 @@ stockResource = $this->getMockBuilder(StockResource::class)->disableOriginalConstructor()->getMock(); - $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) - ->disableOriginalConstructor() - ->getMock(); $this->stockFactory = $this->getMockBuilder(StockInterfaceFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); - $this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class) - ->disableOriginalConstructor() - ->setMethods(['process']) - ->getMock(); - $this->stockCollectionFactory = $this->getMockBuilder(StockCollectionFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->stockSearchResultsFactory = $this->getMockBuilder(StockSearchResultsInterfaceFactory::class) + $this->getList = $this->getMockBuilder(GetList::class) ->disableOriginalConstructor() - ->setMethods(['create']) ->getMock(); $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class) ->disableOriginalConstructor() @@ -102,10 +71,7 @@ protected function setUp() [ 'stockResource' => $this->stockResource, 'stockFactory' => $this->stockFactory, - 'collectionProcessor' => $this->collectionProcessor, - 'stockCollectionFactory' => $this->stockCollectionFactory, - 'stockSearchResultsFactory' => $this->stockSearchResultsFactory, - 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, + 'getList' => $this->getList, 'logger' => $this->loggerMock, ] ); @@ -195,116 +161,34 @@ public function testGetErrorExpectsException() public function testGetListWithSearchCriteria() { - $items = [ - $this->getMockBuilder(Stock::class)->disableOriginalConstructor()->getMock(), - $this->getMockBuilder(Stock::class)->disableOriginalConstructor()->getMock() - ]; - $totalCount = 2; $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) ->disableOriginalConstructor() ->getMock(); - - $stockCollection = $this->getMockBuilder(StockCollection::class) - ->disableOriginalConstructor() - ->getMock(); - $stockCollection - ->expects($this->once()) - ->method('getItems') - ->willReturn($items); - $stockCollection - ->expects($this->once()) - ->method('getSize') - ->willReturn($totalCount); - $this->stockCollectionFactory - ->expects($this->once()) - ->method('create') - ->willReturn($stockCollection); - - $searchResults = $this->getMockBuilder(StockSearchResultsInterface::class) + $searchResult = $this->getMockBuilder(StockSearchResultsInterface::class) ->disableOriginalConstructor() ->getMock(); - $searchResults - ->expects($this->once()) - ->method('setItems') - ->with($items); - $searchResults - ->expects($this->once()) - ->method('setTotalCount') - ->with($totalCount); - $searchResults - ->expects($this->once()) - ->method('setSearchCriteria') - ->with($searchCriteria); - $this->stockSearchResultsFactory - ->expects($this->once()) - ->method('create') - ->willReturn($searchResults); - $this->collectionProcessor + $this->getList ->expects($this->once()) - ->method('process') - ->with($searchCriteria, $stockCollection); + ->method('execute') + ->with($searchCriteria) + ->willReturn($searchResult); - self::assertSame($searchResults, $this->model->getList($searchCriteria)); + self::assertSame($searchResult, $this->model->getList($searchCriteria)); } public function testGetListWithoutSearchCriteria() { - $items = [ - $this->getMockBuilder(Stock::class)->disableOriginalConstructor()->getMock(), - $this->getMockBuilder(Stock::class)->disableOriginalConstructor()->getMock() - ]; - $totalCount = 2; - - $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->searchCriteriaBuilder - ->expects($this->once()) - ->method('create') - ->willReturn($searchCriteria); - - $stockCollection = $this->getMockBuilder(StockCollection::class) + $searchResult = $this->getMockBuilder(StockSearchResultsInterface::class) ->disableOriginalConstructor() ->getMock(); - $stockCollection - ->expects($this->once()) - ->method('getItems') - ->willReturn($items); - $stockCollection - ->expects($this->once()) - ->method('getSize') - ->willReturn($totalCount); - $this->stockCollectionFactory - ->expects($this->once()) - ->method('create') - ->willReturn($stockCollection); - $searchResults = $this->getMockBuilder(StockSearchResultsInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $searchResults - ->expects($this->once()) - ->method('setItems') - ->with($items); - $searchResults - ->expects($this->once()) - ->method('setTotalCount') - ->with($totalCount); - $searchResults + $this->getList ->expects($this->once()) - ->method('setSearchCriteria') - ->with($searchCriteria); - $this->stockSearchResultsFactory - ->expects($this->once()) - ->method('create') - ->willReturn($searchResults); - - $this->collectionProcessor - ->expects($this->never()) - ->method('process'); + ->method('execute') + ->willReturn($searchResult); - self::assertSame($searchResults, $this->model->getList()); + self::assertSame($searchResult, $this->model->getList()); } public function testDeleteById() From 66613e05ddcfc578bcf1d7893e390c0f97b64437 Mon Sep 17 00:00:00 2001 From: Dmytro Voskoboinikov Date: Wed, 26 Jul 2017 15:15:45 +0300 Subject: [PATCH 0362/1004] MAGETWO-57771: Log-in button does not appear after entering email then leaving checkout page --- .../Checkout/view/frontend/web/js/view/form/element/email.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js b/app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js index 545a12017fee6..4a25778e754c7 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js @@ -174,7 +174,7 @@ define([ */ resolveInitialPasswordVisibility: function () { if (checkoutData.getInputFieldEmailValue() !== '') { - return (checkoutData.getInputFieldEmailValue() === checkoutData.getCheckedEmailValue()) + return checkoutData.getInputFieldEmailValue() === checkoutData.getCheckedEmailValue(); } return false; From b251c7e9ef037f3a30d092732b2fd0caa6cd7003 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Wed, 26 Jul 2017 15:43:07 +0100 Subject: [PATCH 0363/1004] magento/magento2#10045 fix cms page unit test namespace --- .../Sitemap/Test/Unit/Model/ItemResolver/CmsPageTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CmsPageTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CmsPageTest.php index 9cefe19280b2c..6a29f4985fa29 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CmsPageTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/CmsPageTest.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Sitemap\Test\Unit\Model; +namespace Magento\Sitemap\Test\Unit\Model\ItemResolver; use Magento\Framework\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; From acc5353bd99fdec84a6552c77bbdd04c4536be86 Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 13:31:10 +0000 Subject: [PATCH 0364/1004] Replace Zend_Json in the setup PackagesAuth with the new Serializer\Json --- .../src/Magento/Setup/Model/PackagesAuth.php | 19 +++++++++++++++---- .../Test/Unit/Model/PackagesAuthTest.php | 19 ++++++++++++++++++- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/setup/src/Magento/Setup/Model/PackagesAuth.php b/setup/src/Magento/Setup/Model/PackagesAuth.php index 88a63b5e6f679..bfaf8423a5430 100644 --- a/setup/src/Magento/Setup/Model/PackagesAuth.php +++ b/setup/src/Magento/Setup/Model/PackagesAuth.php @@ -49,19 +49,29 @@ class PackagesAuth */ private $filesystem; + /** + * @var \Magento\Framework\Serialize\Serializer\Json + */ + private $serializer; + /** * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator * @param \Magento\Framework\HTTP\Client\Curl $curl * @param \Magento\Framework\Filesystem $filesystem + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer + * @throws \RuntimeException */ public function __construct( \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator, \Magento\Framework\HTTP\Client\Curl $curl, - \Magento\Framework\Filesystem $filesystem + \Magento\Framework\Filesystem $filesystem, + \Magento\Framework\Serialize\Serializer\Json $serializer = null ) { $this->serviceLocator = $serviceLocator; $this->curlClient = $curl; $this->filesystem = $filesystem; + $this->serializer = $serializer?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\Serializer\Json::class); } /** @@ -85,6 +95,7 @@ public function getCredentialBaseUrl() * @param string $token * @param string $secretKey * @return string + * @throws \InvalidArgumentException */ public function checkCredentials($token, $secretKey) { @@ -96,12 +107,12 @@ public function checkCredentials($token, $secretKey) $packagesInfo = $this->curlClient->getBody(); $directory = $this->filesystem->getDirectoryWrite(DirectoryList::COMPOSER_HOME); $directory->writeFile(self::PATH_TO_PACKAGES_FILE, $packagesInfo); - return \Zend_Json::encode(['success' => true]); + return $this->serializer->serialize(['success' => true]); } else { - return \Zend_Json::encode(['success' => false, 'message' => 'Bad credentials']); + return $this->serializer->serialize(['success' => false, 'message' => 'Bad credentials']); } } catch (\Exception $e) { - return \Zend_Json::encode(['success' => false, 'message' => $e->getMessage()]); + return $this->serializer->serialize(['success' => false, 'message' => $e->getMessage()]); } } diff --git a/setup/src/Magento/Setup/Test/Unit/Model/PackagesAuthTest.php b/setup/src/Magento/Setup/Test/Unit/Model/PackagesAuthTest.php index 67307e3adfcef..2c7d6d715d770 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/PackagesAuthTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/PackagesAuthTest.php @@ -28,6 +28,9 @@ class PackagesAuthTest extends \PHPUnit_Framework_TestCase */ private $packagesAuth; + /** @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject */ + private $serializerMock; + public function setUp() { $zendServiceLocator = $this->getMock(\Zend\ServiceManager\ServiceLocatorInterface::class, [], [], '', false); @@ -42,7 +45,21 @@ public function setUp() ]); $this->curl = $this->getMock(\Magento\Framework\HTTP\Client\Curl::class, [], [], '', false); $this->filesystem = $this->getMock(\Magento\Framework\Filesystem::class, [], [], '', false); - $this->packagesAuth = new PackagesAuth($zendServiceLocator, $this->curl, $this->filesystem); + $this->serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class) + ->getMock(); + $this->serializerMock->expects($this->any()) + ->method('serialize') + ->willReturnCallback( + function ($serializedData) { + return json_encode($serializedData); + } + ); + $this->packagesAuth = new PackagesAuth( + $zendServiceLocator, + $this->curl, + $this->filesystem, + $this->serializerMock + ); } public function testCheckCredentialsActionBadCredentials() From 097fe0822e811a29f4050cd7c33b5d2ad00b3b59 Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 14:23:56 +0000 Subject: [PATCH 0365/1004] Reformat the method checkCredentials method for a single return --- setup/src/Magento/Setup/Model/PackagesAuth.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup/src/Magento/Setup/Model/PackagesAuth.php b/setup/src/Magento/Setup/Model/PackagesAuth.php index bfaf8423a5430..5a29f9953d51b 100644 --- a/setup/src/Magento/Setup/Model/PackagesAuth.php +++ b/setup/src/Magento/Setup/Model/PackagesAuth.php @@ -99,6 +99,7 @@ public function getCredentialBaseUrl() */ public function checkCredentials($token, $secretKey) { + $response = ['success' => true]; $serviceUrl = $this->getPackagesJsonUrl(); $this->curlClient->setCredentials($token, $secretKey); try { @@ -107,13 +108,13 @@ public function checkCredentials($token, $secretKey) $packagesInfo = $this->curlClient->getBody(); $directory = $this->filesystem->getDirectoryWrite(DirectoryList::COMPOSER_HOME); $directory->writeFile(self::PATH_TO_PACKAGES_FILE, $packagesInfo); - return $this->serializer->serialize(['success' => true]); } else { - return $this->serializer->serialize(['success' => false, 'message' => 'Bad credentials']); + $response = ['success' => false, 'message' => 'Bad credentials']; } } catch (\Exception $e) { - return $this->serializer->serialize(['success' => false, 'message' => $e->getMessage()]); + $response = ['success' => false, 'message' => $e->getMessage()]; } + return $this->serializer->serialize($response); } /** From f706fdd738274822302b9916a9b8e1e231f2ab2c Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 15:09:00 +0000 Subject: [PATCH 0366/1004] Replace Zend_Json usage in Framework/Module/PackageInfo.php - inject the new \Magento\Framework\Serialize\Serializer\Json class, - update the load method to use the Serializer, - update the load method to catch the InvalidArgumentException exception --- .../Magento/Framework/Module/PackageInfo.php | 22 ++++++++++++++----- .../Module/Test/Unit/PackageInfoTest.php | 16 +++++++++++++- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/PackageInfo.php b/lib/internal/Magento/Framework/Module/PackageInfo.php index 1fa4c6b824f15..04cb029b02542 100644 --- a/lib/internal/Magento/Framework/Module/PackageInfo.php +++ b/lib/internal/Magento/Framework/Module/PackageInfo.php @@ -58,23 +58,33 @@ class PackageInfo */ protected $nonExistingDependencies = []; + /** + * @var \Magento\Framework\Serialize\Serializer\Json + */ + private $serializer; + /** * Constructor * * @param Dir\Reader $reader * @param ComponentRegistrar $componentRegistrar */ - public function __construct(Dir\Reader $reader, ComponentRegistrar $componentRegistrar) - { + public function __construct( + Dir\Reader $reader, + ComponentRegistrar $componentRegistrar, + \Magento\Framework\Serialize\Serializer\Json $serializer = null + ) { $this->reader = $reader; $this->componentRegistrar = $componentRegistrar; + $this->serializer = $serializer?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\Serializer\Json::class); } /** * Load the packages information * * @return void - * @throws \Zend_Json_Exception + * @throws \InvalidArgumentException * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ private function load() @@ -85,9 +95,9 @@ private function load() $key = $moduleDir . '/composer.json'; if (isset($jsonData[$key]) && $jsonData[$key]) { try { - $packageData = \Zend_Json::decode($jsonData[$key]); - } catch (\Zend_Json_Exception $e) { - throw new \Zend_Json_Exception( + $packageData = $this->serializer->unserialize($jsonData[$key]); + } catch (\InvalidArgumentException $e) { + throw new \InvalidArgumentException( sprintf( "%s composer.json error: %s", $moduleName, diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/PackageInfoTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/PackageInfoTest.php index e2e95f0d1d149..6c1f172b5c31c 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/PackageInfoTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/PackageInfoTest.php @@ -54,7 +54,21 @@ protected function setUp() ->method('getComposerJsonFiles') ->will($this->returnValue($fileIteratorMock)); - $this->packageInfo = new PackageInfo($this->reader, $this->componentRegistrar); + $this->serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class) + ->getMock(); + + $this->serializerMock->expects($this->any()) + ->method('unserialize') + ->willReturnCallback( + function ($serializedData) { + return json_decode($serializedData, true); + } + ); + $this->packageInfo = new PackageInfo( + $this->reader, + $this->componentRegistrar, + $this->serializerMock + ); } public function testGetModuleName() From fd155b3019f59cfb236e07797e98e03a7f6106da Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 17:49:56 +0000 Subject: [PATCH 0367/1004] Update constructor docblock --- lib/internal/Magento/Framework/Module/PackageInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/PackageInfo.php b/lib/internal/Magento/Framework/Module/PackageInfo.php index 04cb029b02542..7edb0c04ebf98 100644 --- a/lib/internal/Magento/Framework/Module/PackageInfo.php +++ b/lib/internal/Magento/Framework/Module/PackageInfo.php @@ -64,10 +64,10 @@ class PackageInfo private $serializer; /** - * Constructor - * * @param Dir\Reader $reader * @param ComponentRegistrar $componentRegistrar + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer + * @throws \RuntimeException */ public function __construct( Dir\Reader $reader, From fcd7d5f182a1d410a32ddd75519e67efade9442d Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 15:01:45 +0000 Subject: [PATCH 0368/1004] Remove the Zend_Json call from the Setup/Migration.php - inject the new \Magento\Framework\Serialize\Serializer\Json class, - update _jsonDecode method parameter default from Zend_Json constant, - update _jsonDecode to call the new Serializer method version --- .../Framework/Module/Setup/Migration.php | 18 ++++++++++--- .../Module/Test/Unit/Setup/MigrationTest.php | 26 +++++++++++++++++-- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Setup/Migration.php b/lib/internal/Magento/Framework/Module/Setup/Migration.php index 13e8d208f70b3..b757c3a3ff36b 100644 --- a/lib/internal/Magento/Framework/Module/Setup/Migration.php +++ b/lib/internal/Magento/Framework/Module/Setup/Migration.php @@ -132,6 +132,11 @@ class Migration */ private $setup; + /** + * @var \Magento\Framework\Serialize\Serializer\Json + */ + private $serializer; + /** * @param ModuleDataSetupInterface $setup * @param Filesystem $filesystem @@ -144,7 +149,8 @@ public function __construct( Filesystem $filesystem, MigrationData $migrationData, $confPathToMapFile, - $compositeModules = [] + $compositeModules = [], + \Magento\Framework\Serialize\Serializer\Json $serializer = null ) { $this->_directory = $filesystem->getDirectoryRead(DirectoryList::ROOT); $this->_pathToMapFile = $confPathToMapFile; @@ -155,6 +161,8 @@ public function __construct( ]; $this->_compositeModules = $compositeModules; $this->setup = $setup; + $this->serializer = $serializer?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\Serializer\Json::class); } /** @@ -694,10 +702,12 @@ public function getCompositeModules() * * @param string $encodedValue * @param int $objectDecodeType - * @return mixed + * @return array|bool|float|int|mixed|null|string + * @throws \InvalidArgumentException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _jsonDecode($encodedValue, $objectDecodeType = \Zend_Json::TYPE_ARRAY) + protected function _jsonDecode($encodedValue, $objectDecodeType = 1) { - return \Zend_Json::decode($encodedValue, $objectDecodeType); + return $this->serializer->unserialize($encodedValue); } } diff --git a/lib/internal/Magento/Framework/Module/Test/Unit/Setup/MigrationTest.php b/lib/internal/Magento/Framework/Module/Test/Unit/Setup/MigrationTest.php index a4c23eb5a6220..99b56b0cdcbd0 100644 --- a/lib/internal/Magento/Framework/Module/Test/Unit/Setup/MigrationTest.php +++ b/lib/internal/Magento/Framework/Module/Test/Unit/Setup/MigrationTest.php @@ -147,7 +147,9 @@ public function testAppendClassAliasReplace() $setupMock, $filesystemMock, $migrationData, - 'app/etc/aliases_to_classes_map.json' + 'app/etc/aliases_to_classes_map.json', + [], + $this->getSerializerMock() ); $setupModel->appendClassAliasReplace( @@ -203,7 +205,8 @@ public function testDoUpdateClassAliases($replaceRules, $tableData, $expected, $ $filesystemMock, $migrationData, 'app/etc/aliases_to_classes_map.json', - $this->_getModelDependencies($tableRowsCount, $tableData, $aliasesMap) + $this->_getModelDependencies($tableRowsCount, $tableData, $aliasesMap), + $this->getSerializerMock() ); foreach ($replaceRules as $replaceRule) { @@ -248,4 +251,23 @@ protected function _getFilesystemMock() $mock = $this->getMockBuilder(\Magento\Framework\Filesystem::class)->disableOriginalConstructor()->getMock(); return $mock; } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Serialize\Serializer\Json + * @throws \PHPUnit_Framework_Exception + */ + private function getSerializerMock() + { + $serializerMock = $this->getMockBuilder(\Magento\Framework\Serialize\Serializer\Json::class) + ->getMock(); + + $serializerMock->expects($this->any()) + ->method('unserialize') + ->willReturnCallback( + function ($serializedData) { + return json_decode($serializedData, true); + } + ); + return $serializerMock; + } } From 056f554b4bacebbeadd77142b35bf57e6783405d Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 17:51:26 +0000 Subject: [PATCH 0369/1004] Update constructor docblock --- lib/internal/Magento/Framework/Module/Setup/Migration.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/Module/Setup/Migration.php b/lib/internal/Magento/Framework/Module/Setup/Migration.php index b757c3a3ff36b..683f1260cc12a 100644 --- a/lib/internal/Magento/Framework/Module/Setup/Migration.php +++ b/lib/internal/Magento/Framework/Module/Setup/Migration.php @@ -143,6 +143,8 @@ class Migration * @param MigrationData $migrationData * @param string $confPathToMapFile * @param array $compositeModules + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer + * @throws \RuntimeException */ public function __construct( ModuleDataSetupInterface $setup, From baeb58c483205f1c35071b95acbf544e65dfeace Mon Sep 17 00:00:00 2001 From: dmanners Date: Mon, 17 Jul 2017 11:52:43 +0000 Subject: [PATCH 0370/1004] Remove the usage of Zend_Json from the controller results json file. - use the \Magento\Framework\Serialize\Serializer\Json instead of Zend_Json --- .../Framework/Controller/Result/Json.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Controller/Result/Json.php b/lib/internal/Magento/Framework/Controller/Result/Json.php index 3349d4507577b..1cbcd17a05f18 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Json.php +++ b/lib/internal/Magento/Framework/Controller/Result/Json.php @@ -29,11 +29,22 @@ class Json extends AbstractResult protected $json; /** - * @param \Magento\Framework\Translate\InlineInterface $translateInline + * @var \Magento\Framework\Serialize\Serializer\Json */ - public function __construct(InlineInterface $translateInline) - { + private $serializer; + + /** + * @param InlineInterface $translateInline + * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer + * @throws \RuntimeException + */ + public function __construct( + InlineInterface $translateInline, + \Magento\Framework\Serialize\Serializer\Json $serializer = null + ) { $this->translateInline = $translateInline; + $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Serialize\Serializer\Json::class); } /** @@ -43,10 +54,11 @@ public function __construct(InlineInterface $translateInline) * @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default * @param array $options Additional options used during encoding * @return $this + * @throws \InvalidArgumentException */ public function setData($data, $cycleCheck = false, $options = []) { - $this->json = \Zend_Json::encode($data, $cycleCheck, $options); + $this->json = $this->serializer->serialize($data); return $this; } From db6f353b2f863a5ee27fc6d14652e083bd64fcce Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 19 Jul 2017 12:08:28 +0000 Subject: [PATCH 0371/1004] Update the return type for the Adminhtml tax rate controllers --- app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php | 3 ++- app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php index fb6aca4396542..c182fb53b3880 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php @@ -14,7 +14,8 @@ class AjaxLoad extends \Magento\Tax\Controller\Adminhtml\Rate /** * Json needed for the Ajax Edit Form * - * @return void + * @return \Magento\Framework\Controller\Result\Json + * @throws \InvalidArgumentException */ public function execute() { diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php index 354865e5828ef..f6cd0fff9c9b0 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php @@ -14,6 +14,7 @@ class AjaxSave extends \Magento\Tax\Controller\Adminhtml\Rate * Save Tax Rate via AJAX * * @return \Magento\Framework\Controller\Result\Json + * @throws \InvalidArgumentException */ public function execute() { From 4f783881d7005012b6c23bf625d542ef88eae3b2 Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 25 Jul 2017 08:10:24 +0000 Subject: [PATCH 0372/1004] Add ignore for unused parameters on the setData method --- lib/internal/Magento/Framework/Controller/Result/Json.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/internal/Magento/Framework/Controller/Result/Json.php b/lib/internal/Magento/Framework/Controller/Result/Json.php index 1cbcd17a05f18..c84dc3a42c8af 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Json.php +++ b/lib/internal/Magento/Framework/Controller/Result/Json.php @@ -55,6 +55,7 @@ public function __construct( * @param array $options Additional options used during encoding * @return $this * @throws \InvalidArgumentException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function setData($data, $cycleCheck = false, $options = []) { From 7e46cea61dbbcecf04ecd93daf3ee8beb5a24ffd Mon Sep 17 00:00:00 2001 From: dmanners Date: Tue, 25 Jul 2017 14:20:42 +0000 Subject: [PATCH 0373/1004] Check to see if we are dealing with an object with a toJson method - if we are dealing with something like new \Magento\Framework\DataObject() being used as a response object --- lib/internal/Magento/Framework/Controller/Result/Json.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Controller/Result/Json.php b/lib/internal/Magento/Framework/Controller/Result/Json.php index c84dc3a42c8af..61aa937e792d3 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Json.php +++ b/lib/internal/Magento/Framework/Controller/Result/Json.php @@ -59,7 +59,11 @@ public function __construct( */ public function setData($data, $cycleCheck = false, $options = []) { - $this->json = $this->serializer->serialize($data); + if (is_object($data) && method_exists($data, 'toJson')) { + $this->json = $data->toJson(); + } else { + $this->json = $this->serializer->serialize($data); + } return $this; } From ff0581b1e9bc4e7b33cb1a3b5294226362642d31 Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 09:01:28 +0000 Subject: [PATCH 0374/1004] Update Controller/Result/Json setData - deprecate this method to encourage usage of other methods in this class, - be stricter on types passed into this method, --- .../Framework/Controller/Result/Json.php | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/internal/Magento/Framework/Controller/Result/Json.php b/lib/internal/Magento/Framework/Controller/Result/Json.php index 61aa937e792d3..820ca4bbb313b 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Json.php +++ b/lib/internal/Magento/Framework/Controller/Result/Json.php @@ -50,20 +50,45 @@ public function __construct( /** * Set json data * - * @param mixed $data - * @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default - * @param array $options Additional options used during encoding - * @return $this + * @param array|string|\Magento\Framework\DataObject $data + * @param bool $cycleCheck + * @param array $options + * @return Json * @throws \InvalidArgumentException + * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @deprecated */ public function setData($data, $cycleCheck = false, $options = []) { - if (is_object($data) && method_exists($data, 'toJson')) { - $this->json = $data->toJson(); - } else { - $this->json = $this->serializer->serialize($data); + if ($data instanceof \Magento\Framework\DataObject) { + return $this->setArrayData($data->toArray()); + } + + if (is_array($data)) { + return $this->setArrayData($data); } + + //Should we validate the json here? + if (is_string($data)) { + return $this->setJsonData($data); + } + + throw new \Magento\Framework\Exception\LocalizedException( + new \Magento\Framework\Phrase('Invalid argument type') + ); + } + + /** + * Should cover this with a test or 2 + * + * @param array $data + * @return $this + * @throws \InvalidArgumentException + */ + public function setArrayData(array $data) + { + $this->setJsonData($this->serializer->serialize($data)); return $this; } From 41e118bb9555235c60a2714afb6188e936aa1927 Mon Sep 17 00:00:00 2001 From: dmanners Date: Wed, 26 Jul 2017 09:46:42 +0000 Subject: [PATCH 0375/1004] Remove comments in prepration for PR --- lib/internal/Magento/Framework/Controller/Result/Json.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/internal/Magento/Framework/Controller/Result/Json.php b/lib/internal/Magento/Framework/Controller/Result/Json.php index 820ca4bbb313b..2615aa5b94bb2 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Json.php +++ b/lib/internal/Magento/Framework/Controller/Result/Json.php @@ -69,7 +69,6 @@ public function setData($data, $cycleCheck = false, $options = []) return $this->setArrayData($data); } - //Should we validate the json here? if (is_string($data)) { return $this->setJsonData($data); } @@ -80,8 +79,6 @@ public function setData($data, $cycleCheck = false, $options = []) } /** - * Should cover this with a test or 2 - * * @param array $data * @return $this * @throws \InvalidArgumentException From cd2c97075a5dd039824237b0f1058d5857aaa0a8 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 26 Jul 2017 16:54:24 -0500 Subject: [PATCH 0376/1004] MAGETWO-71061: Remove zend json from migration #10341 --- .../Magento/Framework/Module/Setup/Migration.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/internal/Magento/Framework/Module/Setup/Migration.php b/lib/internal/Magento/Framework/Module/Setup/Migration.php index 683f1260cc12a..d1b47d036a20d 100644 --- a/lib/internal/Magento/Framework/Module/Setup/Migration.php +++ b/lib/internal/Magento/Framework/Module/Setup/Migration.php @@ -707,8 +707,23 @@ public function getCompositeModules() * @return array|bool|float|int|mixed|null|string * @throws \InvalidArgumentException * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @deprecated + * @see \Magento\Framework\Module\Setup\Migration::jsonDecode */ protected function _jsonDecode($encodedValue, $objectDecodeType = 1) + { + return $this->jsonDecode($encodedValue); + } + + /** + * Decodes the given $encodedValue string which is + * encoded in the JSON format + * + * @param string $encodedValue + * @return array|bool|float|int|mixed|null|string + * @throws \InvalidArgumentException + */ + private function jsonDecode($encodedValue) { return $this->serializer->unserialize($encodedValue); } From c4885c9f47c12ff86a672088b1dbb5a56b5f458a Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Wed, 26 Jul 2017 23:05:44 +0100 Subject: [PATCH 0377/1004] magento/magento2#10045 backwards compatibility --- app/code/Magento/Sitemap/Model/Sitemap.php | 77 ++++++++++++++++++++-- 1 file changed, 71 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index a3f1e85400246..470531d974c1b 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -10,6 +10,7 @@ use Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot; use Magento\Framework\App\ObjectManager; +use Magento\Framework\DataObject; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\UrlInterface; use Magento\Robots\Model\Config\Value; @@ -174,6 +175,13 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento */ private $configReader; + /** + * Sitemap Item Factory + * + * @var SitemapItemInterfaceFactory|null + */ + private $sitemapItemFactory; + /** * Initialize dependencies. * @@ -195,6 +203,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento * @param DocumentRoot|null $documentRoot * @param ItemResolverInterface|null $itemResolver * @param SitemapConfigReaderInterface|null $configReader + * @param SitemapItemInterfaceFactory|null $sitemapItemFactory * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -215,11 +224,13 @@ public function __construct( array $data = [], \Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot $documentRoot = null, ItemResolverInterface $itemResolver = null, - SitemapConfigReaderInterface $configReader = null + SitemapConfigReaderInterface $configReader = null, + SitemapItemInterfaceFactory $sitemapItemFactory = null ) { + $objectManager = ObjectManager::getInstance(); $this->_escaper = $escaper; $this->_sitemapData = $sitemapData; - $documentRoot = $documentRoot ?: ObjectManager::getInstance()->get(DocumentRoot::class); + $documentRoot = $documentRoot ?: $objectManager->get(DocumentRoot::class); $this->_directory = $filesystem->getDirectoryWrite($documentRoot->getPath()); $this->_categoryFactory = $categoryFactory; $this->_productFactory = $productFactory; @@ -228,10 +239,11 @@ public function __construct( $this->_storeManager = $storeManager; $this->_request = $request; $this->dateTime = $dateTime; - $this->itemResolver = $itemResolver ?: ObjectManager::getInstance()->get(ItemResolverInterface::class); - $this->configReader = $configReader ?: ObjectManager::getInstance()->get(SitemapConfigReaderInterface::class); - + $this->itemResolver = $itemResolver ?: $objectManager->get(ItemResolverInterface::class); + $this->configReader = $configReader ?: $objectManager->get(SitemapConfigReaderInterface::class); + $this->sitemapItemFactory = $sitemapItemFactory ?: $objectManager->get(SitemapItemInterfaceFactory::class); parent::__construct($context, $registry, $resource, $resourceCollection, $data); + } /** @@ -259,6 +271,31 @@ protected function _getStream() } } + /** + * Add a sitemap item to the array of sitemap items + * + * @param DataObject $sitemapItem + * @return $this + * @deprecated + */ + public function addSitemapItem(DataObject $sitemapItem) + { + $this->_sitemapItems[] = $sitemapItem; + + return $this; + } + + /** + * Collect all sitemap items + * + * @return void + * @deprecated + */ + public function collectSitemapItems() + { + + } + /** * Initialize sitemap * @@ -266,7 +303,11 @@ protected function _getStream() */ protected function _initSitemapItems() { - $this->_sitemapItems = $this->itemResolver->getItems($this->getStoreId()); + $sitemapItems = $this->itemResolver->getItems($this->getStoreId()); + $this->collectSitemapItems(); + $mappedItems = $this->mapToSitemapItem(); + $this->_sitemapItems = array_merge($sitemapItems, $mappedItems); + $this->_tags = [ self::TYPE_INDEX => [ @@ -740,6 +781,30 @@ private function _findNewLinesDelimiter($text) return PHP_EOL; } + /** + * Sitemap item mapper for backwards compatibility + * + * @return array + */ + private function mapToSitemapItem() + { + $items = []; + + foreach ($this->_sitemapItems as $data) { + foreach($data->getCollection() as $item) { + $items[] = $this->sitemapItemFactory->create([ + 'url' => $item->getUrl(), + 'updatedAt' => $item->getUpdatedAt(), + 'images' => $item->getImages(), + 'priority' => $data->getPriority(), + 'changeFrequency' => $data->getChangeFrequency(), + ]); + } + } + + return $items; + } + /** * Get unique page cache identities * From 458d45bbc05f725fcf1693142cfb907e6dad52c4 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Wed, 26 Jul 2017 23:37:05 +0100 Subject: [PATCH 0378/1004] magento/magento2#10045 backwards compatibility round 2 --- app/code/Magento/Sitemap/Model/Sitemap.php | 31 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index 470531d974c1b..538b7f571dfea 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -277,6 +277,7 @@ protected function _getStream() * @param DataObject $sitemapItem * @return $this * @deprecated + * @see ItemResolverInterface */ public function addSitemapItem(DataObject $sitemapItem) { @@ -290,10 +291,37 @@ public function addSitemapItem(DataObject $sitemapItem) * * @return void * @deprecated + * @see ItemResolverInterface */ public function collectSitemapItems() { + /** @var $helper \Magento\Sitemap\Helper\Data */ + $helper = $this->_sitemapData; + $storeId = $this->getStoreId(); + $this->addSitemapItem(new DataObject( + [ + 'changefreq' => $helper->getCategoryChangefreq($storeId), + 'priority' => $helper->getCategoryPriority($storeId), + 'collection' => $this->_categoryFactory->create()->getCollection($storeId), + ] + )); + + $this->addSitemapItem(new DataObject( + [ + 'changefreq' => $helper->getProductChangefreq($storeId), + 'priority' => $helper->getProductPriority($storeId), + 'collection' => $this->_productFactory->create()->getCollection($storeId), + ] + )); + + $this->addSitemapItem(new DataObject( + [ + 'changefreq' => $helper->getPageChangefreq($storeId), + 'priority' => $helper->getPagePriority($storeId), + 'collection' => $this->_cmsFactory->create()->getCollection($storeId), + ] + )); } /** @@ -304,7 +332,6 @@ public function collectSitemapItems() protected function _initSitemapItems() { $sitemapItems = $this->itemResolver->getItems($this->getStoreId()); - $this->collectSitemapItems(); $mappedItems = $this->mapToSitemapItem(); $this->_sitemapItems = array_merge($sitemapItems, $mappedItems); @@ -791,7 +818,7 @@ private function mapToSitemapItem() $items = []; foreach ($this->_sitemapItems as $data) { - foreach($data->getCollection() as $item) { + foreach ($data->getCollection() as $item) { $items[] = $this->sitemapItemFactory->create([ 'url' => $item->getUrl(), 'updatedAt' => $item->getUpdatedAt(), From dc80f447a1c7633da63505ff971371b168fb9eab Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Wed, 26 Jul 2017 17:45:00 -0500 Subject: [PATCH 0379/1004] MAGETWO-71062: Remove zend json from json controller #10342 --- lib/internal/Magento/Framework/Controller/Result/Json.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/Controller/Result/Json.php b/lib/internal/Magento/Framework/Controller/Result/Json.php index 2615aa5b94bb2..188dcd6029f56 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Json.php +++ b/lib/internal/Magento/Framework/Controller/Result/Json.php @@ -58,6 +58,8 @@ public function __construct( * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @deprecated + * @see Json::setArrayData + * @see Json::setJsonData */ public function setData($data, $cycleCheck = false, $options = []) { From 009a2b149249e6e0d5ba2a6f12eb756fe58cb721 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 27 Jul 2017 12:13:15 +0300 Subject: [PATCH 0380/1004] MSI - Msi stock ui aggregation #39 - fixes after CR --- .../Source/CarrierRequestDataHydrator.php | 2 +- .../Controller/Adminhtml/Source/InlineEdit.php | 16 ++++++++-------- .../Controller/Adminhtml/Stock/InlineEdit.php | 16 ++++++++-------- .../Controller/Adminhtml/Stock/Save.php | 12 +++++------- .../Adminhtml/Stock/StockSourceLinkProcessor.php | 2 +- .../Model/GetAssignedSourcesForStock.php | 6 +++--- .../Ui/DataProvider/StockDataProvider.php | 2 +- 7 files changed, 27 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php index b19bd147425d3..ceeba26ca6820 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php @@ -13,7 +13,7 @@ use Magento\Shipping\Model\Config; /** - * Populate Source by carrier codes links + * Populate Source by carrier code links */ class CarrierRequestDataHydrator { diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php index 83b906de28e56..3f4f8fb0991d1 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/InlineEdit.php @@ -7,9 +7,9 @@ use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; +use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\ResultFactory; -use Magento\Framework\EntityManager\HydratorInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\InventoryApi\Api\SourceRepositoryInterface; @@ -26,9 +26,9 @@ class InlineEdit extends Action const ADMIN_RESOURCE = 'Magento_Inventory::source'; /** - * @var HydratorInterface + * @var DataObjectHelper */ - private $hydrator; + private $dataObjectHelper; /** * @var SourceRepositoryInterface @@ -37,16 +37,16 @@ class InlineEdit extends Action /** * @param Context $context - * @param HydratorInterface $hydrator + * @param DataObjectHelper $dataObjectHelper * @param SourceRepositoryInterface $sourceRepository */ public function __construct( Context $context, - HydratorInterface $hydrator, + DataObjectHelper $dataObjectHelper, SourceRepositoryInterface $sourceRepository ) { parent::__construct($context); - $this->hydrator = $hydrator; + $this->dataObjectHelper = $dataObjectHelper; $this->sourceRepository = $sourceRepository; } @@ -65,7 +65,7 @@ public function execute() $source = $this->sourceRepository->get( $itemData[SourceInterface::SOURCE_ID] ); - $source = $this->hydrator->hydrate($source, $itemData); + $this->dataObjectHelper->populateWithArray($source, $itemData, SourceInterface::class); $this->sourceRepository->save($source); } catch (NoSuchEntityException $e) { $errorMessages[] = __( @@ -79,7 +79,7 @@ public function execute() } } } else { - $errorMessages[] = __('Please correct the data sent.'); + $errorMessages[] = __('Please correct the sent data.'); } /** @var Json $resultJson */ diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/InlineEdit.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/InlineEdit.php index 4d1da7127ea8e..5aaa404a34374 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/InlineEdit.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/InlineEdit.php @@ -7,9 +7,9 @@ use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; +use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\Controller\Result\Json; use Magento\Framework\Controller\ResultFactory; -use Magento\Framework\EntityManager\HydratorInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\InventoryApi\Api\StockRepositoryInterface; @@ -26,9 +26,9 @@ class InlineEdit extends Action const ADMIN_RESOURCE = 'Magento_Inventory::stock'; /** - * @var HydratorInterface + * @var DataObjectHelper */ - private $hydrator; + private $dataObjectHelper; /** * @var StockRepositoryInterface @@ -37,16 +37,16 @@ class InlineEdit extends Action /** * @param Context $context - * @param HydratorInterface $hydrator + * @param DataObjectHelper $dataObjectHelper * @param StockRepositoryInterface $stockRepository */ public function __construct( Context $context, - HydratorInterface $hydrator, + DataObjectHelper $dataObjectHelper, StockRepositoryInterface $stockRepository ) { parent::__construct($context); - $this->hydrator = $hydrator; + $this->dataObjectHelper = $dataObjectHelper; $this->stockRepository = $stockRepository; } @@ -65,7 +65,7 @@ public function execute() $stock = $this->stockRepository->get( $itemData[StockInterface::STOCK_ID] ); - $stock = $this->hydrator->hydrate($stock, $itemData); + $this->dataObjectHelper->populateWithArray($stock, $itemData, StockInterface::class); $this->stockRepository->save($stock); } catch (NoSuchEntityException $e) { $errorMessages[] = __( @@ -79,7 +79,7 @@ public function execute() } } } else { - $errorMessages[] = __('Please correct the data sent.'); + $errorMessages[] = __('Please correct the sent data.'); } /** @var Json $resultJson */ diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php index ac8bcd942646b..7c33eb90d199c 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/Save.php @@ -51,20 +51,20 @@ class Save extends Action * @param Context $context * @param StockInterfaceFactory $stockFactory * @param StockRepositoryInterface $stockRepository - * @param DataObjectHelper $dataObjectHelper + * @param DataObjectHelper $sourceHydrator * @param StockSourceLinkProcessor $stockSourceLinkProcessor */ public function __construct( Context $context, StockInterfaceFactory $stockFactory, StockRepositoryInterface $stockRepository, - DataObjectHelper $dataObjectHelper, + DataObjectHelper $sourceHydrator, StockSourceLinkProcessor $stockSourceLinkProcessor ) { parent::__construct($context); $this->stockFactory = $stockFactory; $this->stockRepository = $stockRepository; - $this->dataObjectHelper = $dataObjectHelper; + $this->dataObjectHelper = $sourceHydrator; $this->stockSourceLinkProcessor = $stockSourceLinkProcessor; } @@ -77,9 +77,7 @@ public function execute() $requestData = $this->getRequest()->getParams(); if ($this->getRequest()->isPost() && !empty($requestData['general'])) { try { - $stockId = !empty($requestData['general'][StockInterface::STOCK_ID]) - ? $requestData['general'][StockInterface::STOCK_ID] : null; - + $stockId = $requestData['general'][StockInterface::STOCK_ID] ?? null; $stockId = $this->processSave($stockId, $requestData); $this->messageManager->addSuccessMessage(__('The Stock has been saved.')); @@ -95,7 +93,7 @@ public function execute() $this->messageManager->addErrorMessage($e->getMessage()); $this->processRedirectAfterFailureSave($resultRedirect, $stockId); } catch (Exception $e) { - // TODO: id we can not load links + // TODO: wrong message if links has not loaded $this->messageManager->addErrorMessage(__('Could not save stock.')); $this->processRedirectAfterFailureSave($resultRedirect, $stockId); } diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php index 7f871e8d83941..a6a23630fb031 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php @@ -15,7 +15,7 @@ /** * At the time of processing Stock save form this class used to save links correctly - * Perform replace strategy of sources for the stock + * Performs replace strategy of sources for the stock */ class StockSourceLinkProcessor { diff --git a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php index 5fa720dff5d22..1b8dc0e443619 100644 --- a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php +++ b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php @@ -76,7 +76,7 @@ public function execute($stockId) throw new InputException(__('Input data is empty')); } try { - $sourceIds = $this->getSourceIds($stockId); + $sourceIds = $this->getAssignedSourceIds($stockId); $searchCriteria = $this->searchCriteriaBuilder ->addFilter(SourceInterface::SOURCE_ID, $sourceIds, 'in') @@ -91,9 +91,9 @@ public function execute($stockId) /** * @param int $stockId - * @return \Magento\Framework\DataObject[] + * @return array */ - private function getSourceIds($stockId) + private function getAssignedSourceIds($stockId) { $searchCriteria = $this->searchCriteriaBuilder ->addFilter(StockSourceLink::STOCK_ID, (int)$stockId) diff --git a/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php index 065cf10515ba2..f0912f01d8f70 100644 --- a/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php +++ b/app/code/Magento/Inventory/Ui/DataProvider/StockDataProvider.php @@ -90,7 +90,7 @@ public function getData() $data = parent::getData(); if ('inventory_stock_form_data_source' === $this->name) { // It is need for support of several fieldsets. - // For details see \Magento\Ui\Component\Form::getDatastockData + // For details see \Magento\Ui\Component\Form::getDataSourceData if ($data['totalRecords'] > 0) { $stockId = $data['items'][0][StockInterface::STOCK_ID]; $stockGeneralData = $data['items'][0]; From 50105b415984d471565ddc2f187f891c76ee009e Mon Sep 17 00:00:00 2001 From: alojua Date: Thu, 27 Jul 2017 14:32:32 +0200 Subject: [PATCH 0381/1004] Add missing block name to allow block customisation --- .../Sales/view/frontend/layout/sales_email_order_renderers.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_renderers.xml index 9eaf7370eaa8b..845d03e119280 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_renderers.xml @@ -8,7 +8,7 @@ - + From 630b2ac8b632860233d63d50fddd62bcd09779bf Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Thu, 27 Jul 2017 09:38:53 -0500 Subject: [PATCH 0382/1004] MAGETWO-71061: Remove zend json from migration #10341 - fixed docBlock --- lib/internal/Magento/Framework/Module/Setup/Migration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Setup/Migration.php b/lib/internal/Magento/Framework/Module/Setup/Migration.php index d1b47d036a20d..b417fcb56291a 100644 --- a/lib/internal/Magento/Framework/Module/Setup/Migration.php +++ b/lib/internal/Magento/Framework/Module/Setup/Migration.php @@ -704,7 +704,7 @@ public function getCompositeModules() * * @param string $encodedValue * @param int $objectDecodeType - * @return array|bool|float|int|mixed|null|string + * @return string|int|float|bool|array|null * @throws \InvalidArgumentException * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @deprecated @@ -720,7 +720,7 @@ protected function _jsonDecode($encodedValue, $objectDecodeType = 1) * encoded in the JSON format * * @param string $encodedValue - * @return array|bool|float|int|mixed|null|string + * @return string|int|float|bool|array|null * @throws \InvalidArgumentException */ private function jsonDecode($encodedValue) From 9175a9941540973af54190938a550032aa016166 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Thu, 27 Jul 2017 17:52:58 +0300 Subject: [PATCH 0383/1004] MSI - Msi stock ui aggregation #39 - fixes after CR --- .../Magento/Inventory/Model/AssignSourcesToStock.php | 2 +- .../Inventory/Model/GetAssignedSourcesForStock.php | 4 ++-- app/code/Magento/Inventory/Model/StockRepository.php | 8 ++++++-- .../Inventory/Model/UnassignSourceFromStock.php | 8 +------- app/code/Magento/Inventory/Setup/InstallSchema.php | 10 +++++----- .../CreateSourceCarrierLinkTable.php | 2 +- .../CreateSourceItemTable.php | 2 +- .../{InstallStep => Operation}/CreateSourceTable.php | 2 +- .../CreateStockSourceLinkTable.php | 2 +- .../{InstallStep => Operation}/CreateStockTable.php | 2 +- .../InventoryApi/Api/SourceItemRepositoryInterface.php | 1 - 11 files changed, 20 insertions(+), 23 deletions(-) rename app/code/Magento/Inventory/Setup/{InstallStep => Operation}/CreateSourceCarrierLinkTable.php (98%) rename app/code/Magento/Inventory/Setup/{InstallStep => Operation}/CreateSourceItemTable.php (98%) rename app/code/Magento/Inventory/Setup/{InstallStep => Operation}/CreateSourceTable.php (99%) rename app/code/Magento/Inventory/Setup/{InstallStep => Operation}/CreateStockSourceLinkTable.php (98%) rename app/code/Magento/Inventory/Setup/{InstallStep => Operation}/CreateStockTable.php (97%) diff --git a/app/code/Magento/Inventory/Model/AssignSourcesToStock.php b/app/code/Magento/Inventory/Model/AssignSourcesToStock.php index ff8a331171eff..beb3185bd8152 100644 --- a/app/code/Magento/Inventory/Model/AssignSourcesToStock.php +++ b/app/code/Magento/Inventory/Model/AssignSourcesToStock.php @@ -43,7 +43,7 @@ public function __construct( */ public function execute($stockId, array $sourceIds) { - if (0 === (int)$stockId || empty($sourceIds)) { + if (!is_numeric($stockId) || empty($sourceIds)) { throw new InputException(__('Input data is invalid')); } try { diff --git a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php index 1b8dc0e443619..69d55e7975a17 100644 --- a/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php +++ b/app/code/Magento/Inventory/Model/GetAssignedSourcesForStock.php @@ -72,8 +72,8 @@ public function __construct( */ public function execute($stockId) { - if (0 === (int)$stockId) { - throw new InputException(__('Input data is empty')); + if (!is_numeric($stockId)) { + throw new InputException(__('Input data is invalid')); } try { $sourceIds = $this->getAssignedSourceIds($stockId); diff --git a/app/code/Magento/Inventory/Model/StockRepository.php b/app/code/Magento/Inventory/Model/StockRepository.php index 28eb2348d9851..56352023be14f 100644 --- a/app/code/Magento/Inventory/Model/StockRepository.php +++ b/app/code/Magento/Inventory/Model/StockRepository.php @@ -94,10 +94,14 @@ public function get($stockId) */ public function deleteById($stockId) { - $stockItem = $this->get($stockId); + try { + $stock = $this->get($stockId); + } catch (NoSuchEntityException $e) { + return; + } try { - $this->stockResource->delete($stockItem); + $this->stockResource->delete($stock); } catch (\Exception $e) { $this->logger->error($e->getMessage()); throw new CouldNotDeleteException(__('Could not delete Stock'), $e); diff --git a/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php b/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php index 8f8f41df5ff5f..573df3c0edd05 100644 --- a/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php +++ b/app/code/Magento/Inventory/Model/UnassignSourceFromStock.php @@ -71,7 +71,7 @@ public function __construct( */ public function execute($stockId, $sourceId) { - if (0 === (int)$stockId || 0 === (int)$sourceId) { + if (!is_numeric($stockId) || !is_numeric($sourceId)) { throw new InputException(__('Input data is invalid')); } @@ -85,12 +85,6 @@ public function execute($stockId, $sourceId) $this->collectionProcessor->process($searchCriteria, $collection); $items = $collection->getItems(); - if (empty($items)) { - throw new CouldNotDeleteException( - __('Source Stock Link is missed (Stock id: %1, Source id: %2 )', $stockId, $sourceId) - ); - } - try { $stockSourceLink = reset($items); $this->stockSourceLinkResource->delete($stockSourceLink); diff --git a/app/code/Magento/Inventory/Setup/InstallSchema.php b/app/code/Magento/Inventory/Setup/InstallSchema.php index 9c236d1b05fa5..93794119e1fb5 100644 --- a/app/code/Magento/Inventory/Setup/InstallSchema.php +++ b/app/code/Magento/Inventory/Setup/InstallSchema.php @@ -8,11 +8,11 @@ use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; -use Magento\Inventory\Setup\InstallStep\CreateSourceCarrierLinkTable; -use Magento\Inventory\Setup\InstallStep\CreateSourceItemTable; -use Magento\Inventory\Setup\InstallStep\CreateSourceTable; -use Magento\Inventory\Setup\InstallStep\CreateStockSourceLinkTable; -use Magento\Inventory\Setup\InstallStep\CreateStockTable; +use Magento\Inventory\Setup\Operation\CreateSourceCarrierLinkTable; +use Magento\Inventory\Setup\Operation\CreateSourceItemTable; +use Magento\Inventory\Setup\Operation\CreateSourceTable; +use Magento\Inventory\Setup\Operation\CreateStockSourceLinkTable; +use Magento\Inventory\Setup\Operation\CreateStockTable; class InstallSchema implements InstallSchemaInterface { diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceCarrierLinkTable.php b/app/code/Magento/Inventory/Setup/Operation/CreateSourceCarrierLinkTable.php similarity index 98% rename from app/code/Magento/Inventory/Setup/InstallStep/CreateSourceCarrierLinkTable.php rename to app/code/Magento/Inventory/Setup/Operation/CreateSourceCarrierLinkTable.php index 6dc88f05780e0..283c3857af256 100644 --- a/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceCarrierLinkTable.php +++ b/app/code/Magento/Inventory/Setup/Operation/CreateSourceCarrierLinkTable.php @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Inventory\Setup\InstallStep; +namespace Magento\Inventory\Setup\Operation; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Ddl\Table; diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceItemTable.php b/app/code/Magento/Inventory/Setup/Operation/CreateSourceItemTable.php similarity index 98% rename from app/code/Magento/Inventory/Setup/InstallStep/CreateSourceItemTable.php rename to app/code/Magento/Inventory/Setup/Operation/CreateSourceItemTable.php index 2234deaa945fb..2ec318058e363 100644 --- a/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceItemTable.php +++ b/app/code/Magento/Inventory/Setup/Operation/CreateSourceItemTable.php @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Inventory\Setup\InstallStep; +namespace Magento\Inventory\Setup\Operation; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Ddl\Table; diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceTable.php b/app/code/Magento/Inventory/Setup/Operation/CreateSourceTable.php similarity index 99% rename from app/code/Magento/Inventory/Setup/InstallStep/CreateSourceTable.php rename to app/code/Magento/Inventory/Setup/Operation/CreateSourceTable.php index 28bd31b980072..c454e76832eb2 100644 --- a/app/code/Magento/Inventory/Setup/InstallStep/CreateSourceTable.php +++ b/app/code/Magento/Inventory/Setup/Operation/CreateSourceTable.php @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Inventory\Setup\InstallStep; +namespace Magento\Inventory\Setup\Operation; use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Setup\SchemaSetupInterface; diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateStockSourceLinkTable.php b/app/code/Magento/Inventory/Setup/Operation/CreateStockSourceLinkTable.php similarity index 98% rename from app/code/Magento/Inventory/Setup/InstallStep/CreateStockSourceLinkTable.php rename to app/code/Magento/Inventory/Setup/Operation/CreateStockSourceLinkTable.php index 2f5b25d7e7518..0d5a36014d6b2 100644 --- a/app/code/Magento/Inventory/Setup/InstallStep/CreateStockSourceLinkTable.php +++ b/app/code/Magento/Inventory/Setup/Operation/CreateStockSourceLinkTable.php @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Inventory\Setup\InstallStep; +namespace Magento\Inventory\Setup\Operation; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Ddl\Table; diff --git a/app/code/Magento/Inventory/Setup/InstallStep/CreateStockTable.php b/app/code/Magento/Inventory/Setup/Operation/CreateStockTable.php similarity index 97% rename from app/code/Magento/Inventory/Setup/InstallStep/CreateStockTable.php rename to app/code/Magento/Inventory/Setup/Operation/CreateStockTable.php index a6760bbdb9c8c..5cae5005900d6 100644 --- a/app/code/Magento/Inventory/Setup/InstallStep/CreateStockTable.php +++ b/app/code/Magento/Inventory/Setup/Operation/CreateStockTable.php @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Inventory\Setup\InstallStep; +namespace Magento\Inventory\Setup\Operation; use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Setup\SchemaSetupInterface; diff --git a/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php index 3f997963d366a..79665d672f3f7 100644 --- a/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php @@ -39,7 +39,6 @@ public function getList(SearchCriteriaInterface $searchCriteria); * * @param SourceItemInterface $sourceItem * @return void - * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotDeleteException */ public function delete(SourceItemInterface $sourceItem); From 2e70f00a1bf4757f70ea9e07d4a33dcb7a95f8fe Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Thu, 27 Jul 2017 18:07:06 +0300 Subject: [PATCH 0384/1004] Add missing block name to allow block customisation --- .../frontend/layout/checkout_onepage_review_item_renderers.xml | 2 +- .../frontend/layout/sales_email_order_creditmemo_renderers.xml | 2 +- .../frontend/layout/sales_email_order_invoice_renderers.xml | 2 +- .../Bundle/view/frontend/layout/sales_email_order_renderers.xml | 2 +- .../frontend/layout/sales_email_order_shipment_renderers.xml | 2 +- .../view/frontend/layout/sales_order_creditmemo_renderers.xml | 2 +- .../view/frontend/layout/sales_order_invoice_renderers.xml | 2 +- .../Bundle/view/frontend/layout/sales_order_item_renderers.xml | 2 +- .../frontend/layout/sales_order_print_creditmemo_renderers.xml | 2 +- .../frontend/layout/sales_order_print_invoice_renderers.xml | 2 +- .../Bundle/view/frontend/layout/sales_order_print_renderers.xml | 2 +- .../frontend/layout/sales_order_print_shipment_renderers.xml | 2 +- .../view/frontend/layout/sales_order_shipment_renderers.xml | 2 +- .../frontend/layout/checkout_onepage_review_item_renderers.xml | 2 +- .../frontend/layout/sales_email_order_creditmemo_renderers.xml | 2 +- .../frontend/layout/sales_email_order_invoice_renderers.xml | 2 +- .../view/frontend/layout/sales_email_order_renderers.xml | 2 +- .../view/frontend/layout/sales_order_creditmemo_renderers.xml | 2 +- .../view/frontend/layout/sales_order_invoice_renderers.xml | 2 +- .../view/frontend/layout/sales_order_item_renderers.xml | 2 +- .../frontend/layout/sales_order_print_creditmemo_renderers.xml | 2 +- .../frontend/layout/sales_order_print_invoice_renderers.xml | 2 +- .../view/frontend/layout/sales_order_print_renderers.xml | 2 +- .../view/frontend/layout/checkout_cart_item_renderers.xml | 2 +- .../frontend/layout/checkout_onepage_review_item_renderers.xml | 2 +- .../frontend/layout/sales_email_order_creditmemo_renderers.xml | 2 +- .../frontend/layout/sales_email_order_invoice_renderers.xml | 2 +- .../view/frontend/layout/sales_email_order_renderers.xml | 2 +- .../view/frontend/layout/sales_order_creditmemo_renderers.xml | 2 +- .../view/frontend/layout/sales_order_invoice_renderers.xml | 2 +- .../view/frontend/layout/sales_order_item_renderers.xml | 2 +- .../frontend/layout/sales_order_print_creditmemo_renderers.xml | 2 +- .../frontend/layout/sales_order_print_invoice_renderers.xml | 2 +- .../view/frontend/layout/sales_order_print_renderers.xml | 2 +- .../frontend/layout/sales_email_order_creditmemo_renderers.xml | 2 +- .../frontend/layout/sales_email_order_invoice_renderers.xml | 2 +- .../frontend/layout/sales_email_order_shipment_renderers.xml | 2 +- .../view/frontend/layout/sales_order_creditmemo_renderers.xml | 2 +- .../view/frontend/layout/sales_order_invoice_renderers.xml | 2 +- .../Sales/view/frontend/layout/sales_order_item_renderers.xml | 2 +- .../frontend/layout/sales_order_print_creditmemo_renderers.xml | 2 +- .../frontend/layout/sales_order_print_invoice_renderers.xml | 2 +- .../Sales/view/frontend/layout/sales_order_print_renderers.xml | 2 +- .../frontend/layout/sales_order_print_shipment_renderers.xml | 2 +- .../view/frontend/layout/sales_order_shipment_renderers.xml | 2 +- 45 files changed, 45 insertions(+), 45 deletions(-) diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml index dce5945e3221d..686e12da7de21 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/checkout_onepage_review_item_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml index 97f07511d2fda..f92a04de2b57c 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml index 1041965f2c77b..051365f99021f 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml index f46300afd518c..b48e196c52866 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml index d6e8812b02165..c2c80e0ba6763 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_email_order_shipment_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml index da9b7fa494ed4..deb7334b726b3 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml index a1c1d23ad4788..c4865e22ad9be 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml index c02075bee5e59..86cfb1c0f7ade 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_item_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml index 2f16633a2bcca..bd1310acbcdee 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml index f143da9b57dfe..5bea1dd1c672e 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml index 384a0665a80f7..27c7aabfeb195 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml index bfa85a0a9c9d8..481d72ae10bdb 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_print_shipment_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml b/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml index e1b6ba0e86130..99124dfeeef93 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/sales_order_shipment_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_review_item_renderers.xml index a067c9b77d1e8..9929efe85c924 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_review_item_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/checkout_onepage_review_item_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_creditmemo_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_creditmemo_renderers.xml index 5772a322c1c80..34e61b3c59ae4 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_creditmemo_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_invoice_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_invoice_renderers.xml index 8d6e3b364c55a..ab9adf10cc59c 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_invoice_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_renderers.xml index 3aeec25a27a66..8e1866c5028a1 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_email_order_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_creditmemo_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_creditmemo_renderers.xml index e52604bae38bd..fd9acd0268cf6 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_creditmemo_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_invoice_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_invoice_renderers.xml index 6d233cb56be47..75aa46b38c419 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_invoice_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_item_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_item_renderers.xml index 53d2e6c2875bb..89274506eadee 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_item_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_item_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_creditmemo_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_creditmemo_renderers.xml index 8720ebe1ce6a4..9bb75ff838549 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_creditmemo_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_invoice_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_invoice_renderers.xml index 2b37982706919..4a3ebd34d5be1 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_invoice_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_renderers.xml b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_renderers.xml index 1077e7db05fb6..1efd0adfc28d6 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_renderers.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/sales_order_print_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_cart_item_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_cart_item_renderers.xml index 958f73c6c1576..03a1d3745220d 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_cart_item_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_cart_item_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml index dabddb4f4d851..f3bf47e5b17af 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/checkout_onepage_review_item_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_creditmemo_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_creditmemo_renderers.xml index 1cd91018be9e7..77875ac70427c 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_creditmemo_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_invoice_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_invoice_renderers.xml index 21cd7dd0173a1..06afa045f574b 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_invoice_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_renderers.xml index e8f56212470a0..afcd902420d15 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_email_order_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_creditmemo_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_creditmemo_renderers.xml index 72da33456f1ec..379f8faafa942 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_creditmemo_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_invoice_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_invoice_renderers.xml index c451fe6baca30..57eeb4c360666 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_invoice_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_item_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_item_renderers.xml index 339ba3629b955..fee947e013c4a 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_item_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_item_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_creditmemo_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_creditmemo_renderers.xml index 2d0a482c02d10..5f8ed4a319492 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_creditmemo_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_invoice_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_invoice_renderers.xml index ffa26e8d1ecca..bac5c6a6fef3a 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_invoice_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_renderers.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_renderers.xml index 0d48958e4784c..d20043ee5c9f4 100644 --- a/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_renderers.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/sales_order_print_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_creditmemo_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_creditmemo_renderers.xml index bbbc606a58cd5..e2d859cb66f63 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_creditmemo_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_invoice_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_invoice_renderers.xml index 37d3e468329d7..06520d80e27a3 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_invoice_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_shipment_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_shipment_renderers.xml index 6e1eb26986cc7..48a7c68b538b5 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_email_order_shipment_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_email_order_shipment_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo_renderers.xml index ff82bcdff2111..1e6b510c8f822 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice_renderers.xml index d1c9d765b5101..4cdff0e304f70 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_item_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_item_renderers.xml index c8c94cef5bc4c..d10f957151a12 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_item_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_item_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_print_creditmemo_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_print_creditmemo_renderers.xml index a010534052bf5..87a826fbfa448 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_print_creditmemo_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_print_creditmemo_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_print_invoice_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_print_invoice_renderers.xml index 3ed5b275666d5..34593a20f1188 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_print_invoice_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_print_invoice_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_print_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_print_renderers.xml index 1c1d3bf1504ba..095283c89c2ee 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_print_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_print_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_print_shipment_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_print_shipment_renderers.xml index 231b283a12643..57f812e180aa1 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_print_shipment_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_print_shipment_renderers.xml @@ -8,7 +8,7 @@ - + diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment_renderers.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment_renderers.xml index a666ef5d6c5bd..61870813b8659 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment_renderers.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment_renderers.xml @@ -8,7 +8,7 @@ - + From fe36cf24a5f1ac8bb584048a59d6ac84a3d86e45 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Thu, 27 Jul 2017 10:19:37 -0500 Subject: [PATCH 0385/1004] MAGETWO-70872: [WIP]Google Sitemap refactoring - introduce item resolver #10288 - fixed static tests --- app/code/Magento/Sitemap/Model/Sitemap.php | 17 +++++++++-------- .../Unit/Model/ItemResolver/ProductTest.php | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index 538b7f571dfea..6009f43d84545 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -178,7 +178,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento /** * Sitemap Item Factory * - * @var SitemapItemInterfaceFactory|null + * @var \Magento\Sitemap\Model\SitemapItemInterfaceFactory */ private $sitemapItemFactory; @@ -203,7 +203,7 @@ class Sitemap extends \Magento\Framework\Model\AbstractModel implements \Magento * @param DocumentRoot|null $documentRoot * @param ItemResolverInterface|null $itemResolver * @param SitemapConfigReaderInterface|null $configReader - * @param SitemapItemInterfaceFactory|null $sitemapItemFactory + * @param \Magento\Sitemap\Model\SitemapItemInterfaceFactory|null $sitemapItemFactory * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -225,12 +225,11 @@ public function __construct( \Magento\Config\Model\Config\Reader\Source\Deployed\DocumentRoot $documentRoot = null, ItemResolverInterface $itemResolver = null, SitemapConfigReaderInterface $configReader = null, - SitemapItemInterfaceFactory $sitemapItemFactory = null + \Magento\Sitemap\Model\SitemapItemInterfaceFactory $sitemapItemFactory = null ) { - $objectManager = ObjectManager::getInstance(); $this->_escaper = $escaper; $this->_sitemapData = $sitemapData; - $documentRoot = $documentRoot ?: $objectManager->get(DocumentRoot::class); + $documentRoot = $documentRoot ?: ObjectManager::getInstance()->get(DocumentRoot::class); $this->_directory = $filesystem->getDirectoryWrite($documentRoot->getPath()); $this->_categoryFactory = $categoryFactory; $this->_productFactory = $productFactory; @@ -239,9 +238,11 @@ public function __construct( $this->_storeManager = $storeManager; $this->_request = $request; $this->dateTime = $dateTime; - $this->itemResolver = $itemResolver ?: $objectManager->get(ItemResolverInterface::class); - $this->configReader = $configReader ?: $objectManager->get(SitemapConfigReaderInterface::class); - $this->sitemapItemFactory = $sitemapItemFactory ?: $objectManager->get(SitemapItemInterfaceFactory::class); + $this->itemResolver = $itemResolver ?: ObjectManager::getInstance()->get(ItemResolverInterface::class); + $this->configReader = $configReader ?: ObjectManager::getInstance()->get(SitemapConfigReaderInterface::class); + $this->sitemapItemFactory = $sitemapItemFactory ?: ObjectManager::getInstance()->get( + \Magento\Sitemap\Model\SitemapItemInterfaceFactory::class + ); parent::__construct($context, $registry, $resource, $resourceCollection, $data); } diff --git a/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php index 525742c262a81..0f60849378e4e 100644 --- a/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php +++ b/app/code/Magento/Sitemap/Test/Unit/Model/ItemResolver/ProductTest.php @@ -4,7 +4,7 @@ * See COPYING.txt for license details. */ -namespace Magento\Sitemap\Test\Unit\Model; +namespace Magento\Sitemap\Test\Unit\Model\ItemResolver; use Magento\Framework\DataObject; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; From 770bc262997ac1b4cba1efc00a59fa5f78ef9567 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 28 Jul 2017 11:20:52 +0300 Subject: [PATCH 0386/1004] MSI - Msi stock ui aggregation #39 - fixes after CR --- .../Controller/Adminhtml/Source/Save.php | 27 ++---- ...Hydrator.php => SourceCarrierHydrator.php} | 2 +- .../Adminhtml/Source/SourceHydrator.php | 51 +++++++++++ .../Model/Stock/Command/DeleteById.php | 69 +++++++++++++++ .../Stock/Command/DeleteByIdInterface.php | 30 +++++++ .../Inventory/Model/Stock/Command/Get.php | 54 ++++++++++++ .../Model/Stock/Command/GetInterface.php | 31 +++++++ .../Command}/GetList.php | 12 +-- .../Model/Stock/Command/GetListInterface.php | 30 +++++++ .../Inventory/Model/Stock/Command/Save.php | 53 ++++++++++++ .../Model/Stock/Command/SaveInterface.php | 31 +++++++ .../Inventory/Model/StockRepository.php | 85 ++++++------------- app/code/Magento/Inventory/etc/di.xml | 10 ++- .../Api/StockRepositoryInterface.php | 16 +++- .../Api/UnassignSourceFromStockInterface.php | 3 +- 15 files changed, 412 insertions(+), 92 deletions(-) rename app/code/Magento/Inventory/Controller/Adminhtml/Source/{CarrierRequestDataHydrator.php => SourceCarrierHydrator.php} (99%) create mode 100644 app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceHydrator.php create mode 100644 app/code/Magento/Inventory/Model/Stock/Command/DeleteById.php create mode 100644 app/code/Magento/Inventory/Model/Stock/Command/DeleteByIdInterface.php create mode 100644 app/code/Magento/Inventory/Model/Stock/Command/Get.php create mode 100644 app/code/Magento/Inventory/Model/Stock/Command/GetInterface.php rename app/code/Magento/Inventory/Model/{StockRepository => Stock/Command}/GetList.php (92%) create mode 100644 app/code/Magento/Inventory/Model/Stock/Command/GetListInterface.php create mode 100644 app/code/Magento/Inventory/Model/Stock/Command/Save.php create mode 100644 app/code/Magento/Inventory/Model/Stock/Command/SaveInterface.php diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index 5b1dc50fbd6e9..47b9d0dccda54 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -8,11 +8,9 @@ use Exception; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; -use Magento\Framework\Api\DataObjectHelper; use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Framework\Registry; use Magento\InventoryApi\Api\Data\SourceInterface; use Magento\InventoryApi\Api\Data\SourceInterfaceFactory; use Magento\InventoryApi\Api\SourceRepositoryInterface; @@ -38,34 +36,26 @@ class Save extends Action private $sourceRepository; /** - * @var DataObjectHelper + * @var SourceHydrator */ - private $dataObjectHelper; - - /** - * @var CarrierRequestDataHydrator - */ - private $carrierRequestDataHydrator; + private $sourceHydrator; /** * @param Context $context * @param SourceInterfaceFactory $sourceFactory * @param SourceRepositoryInterface $sourceRepository - * @param DataObjectHelper $dataObjectHelper - * @param CarrierRequestDataHydrator $carrierRequestDataHydrator + * @param SourceHydrator $sourceHydrator */ public function __construct( Context $context, SourceInterfaceFactory $sourceFactory, SourceRepositoryInterface $sourceRepository, - DataObjectHelper $dataObjectHelper, - CarrierRequestDataHydrator $carrierRequestDataHydrator + SourceHydrator $sourceHydrator ) { parent::__construct($context); $this->sourceFactory = $sourceFactory; $this->sourceRepository = $sourceRepository; - $this->dataObjectHelper = $dataObjectHelper; - $this->carrierRequestDataHydrator = $carrierRequestDataHydrator; + $this->sourceHydrator = $sourceHydrator; } /** @@ -77,9 +67,7 @@ public function execute() $requestData = $this->getRequest()->getParams(); if ($this->getRequest()->isPost() && !empty($requestData['general'])) { try { - $sourceId = !empty($requestData['general'][SourceInterface::SOURCE_ID]) - ? $requestData['general'][SourceInterface::SOURCE_ID] : null; - + $sourceId = $requestData['general'][SourceInterface::SOURCE_ID] ?? null; $sourceId = $this->processSave($sourceId, $requestData); $this->messageManager->addSuccessMessage(__('The Source has been saved.')); @@ -115,8 +103,7 @@ private function processSave($sourceId, array $requestData) /** @var SourceInterface $source */ $source = $this->sourceFactory->create(); } - $this->dataObjectHelper->populateWithArray($source, $requestData['general'], SourceInterface::class); - $source = $this->carrierRequestDataHydrator->hydrate($source, $requestData['general']); + $source = $this->sourceHydrator->hydrate($source, $requestData['general']); $sourceId = $this->sourceRepository->save($source); return $sourceId; diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceCarrierHydrator.php similarity index 99% rename from app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php rename to app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceCarrierHydrator.php index ceeba26ca6820..c38682cf1dc10 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/CarrierRequestDataHydrator.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceCarrierHydrator.php @@ -15,7 +15,7 @@ /** * Populate Source by carrier code links */ -class CarrierRequestDataHydrator +class SourceCarrierHydrator { /** * @var SourceCarrierLinkInterface diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceHydrator.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceHydrator.php new file mode 100644 index 0000000000000..98c57f036e47b --- /dev/null +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceHydrator.php @@ -0,0 +1,51 @@ +dataObjectHelper = $dataObjectHelper; + $this->sourceCarrierHydrator = $sourceCarrierHydrator; + } + + /** + * @param SourceInterface $source + * @param array $data + * @return SourceInterface + */ + public function hydrate(SourceInterface $source, array $data) + { + $this->dataObjectHelper->populateWithArray($source, $data['general'], SourceInterface::class); + $source = $this->sourceCarrierHydrator->hydrate($source, $data['general']); + return $source; + } +} diff --git a/app/code/Magento/Inventory/Model/Stock/Command/DeleteById.php b/app/code/Magento/Inventory/Model/Stock/Command/DeleteById.php new file mode 100644 index 0000000000000..16f590fe32a8c --- /dev/null +++ b/app/code/Magento/Inventory/Model/Stock/Command/DeleteById.php @@ -0,0 +1,69 @@ +stockResource = $stockResource; + $this->stockFactory = $stockFactory; + $this->logger = $logger; + } + + /** + * @inheritdoc + */ + public function execute($stockId) + { + /** @var StockInterface $stock */ + $stock = $this->stockFactory->create(); + $this->stockResource->load($stock, $stockId, StockInterface::STOCK_ID); + + if (null === $stock->getStockId()) { + return; + } + + try { + $this->stockResource->delete($stock); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + throw new CouldNotDeleteException(__('Could not delete Stock'), $e); + } + } +} diff --git a/app/code/Magento/Inventory/Model/Stock/Command/DeleteByIdInterface.php b/app/code/Magento/Inventory/Model/Stock/Command/DeleteByIdInterface.php new file mode 100644 index 0000000000000..4047316283dad --- /dev/null +++ b/app/code/Magento/Inventory/Model/Stock/Command/DeleteByIdInterface.php @@ -0,0 +1,30 @@ +stockResource = $stockResource; + $this->stockFactory = $stockFactory; + } + + /** + * @inheritdoc + */ + public function execute($stockId) + { + /** @var StockInterface $stock */ + $stock = $this->stockFactory->create(); + $this->stockResource->load($stock, $stockId, StockInterface::STOCK_ID); + + if (null === $stock->getStockId()) { + throw NoSuchEntityException::singleField(StockInterface::STOCK_ID, $stockId); + } + return $stock; + } +} diff --git a/app/code/Magento/Inventory/Model/Stock/Command/GetInterface.php b/app/code/Magento/Inventory/Model/Stock/Command/GetInterface.php new file mode 100644 index 0000000000000..863355b71c9a9 --- /dev/null +++ b/app/code/Magento/Inventory/Model/Stock/Command/GetInterface.php @@ -0,0 +1,31 @@ +stockResource = $stockResource; + $this->logger = $logger; + } + + /** + * @inheritdoc + */ + public function execute(StockInterface $stock) + { + try { + $this->stockResource->save($stock); + return $stock->getStockId(); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + throw new CouldNotSaveException(__('Could not save Stock'), $e); + } + } +} diff --git a/app/code/Magento/Inventory/Model/Stock/Command/SaveInterface.php b/app/code/Magento/Inventory/Model/Stock/Command/SaveInterface.php new file mode 100644 index 0000000000000..ff0784a32e789 --- /dev/null +++ b/app/code/Magento/Inventory/Model/Stock/Command/SaveInterface.php @@ -0,0 +1,31 @@ +stockResource = $stockResource; - $this->stockFactory = $stockFactory; - $this->getList = $getList; - $this->logger = $logger; + $this->commandSave = $commandSave; + $this->commandGet = $commandGet; + $this->commandDeleteById = $commandDeleteById; + $this->commandGetList = $commandGetList; } /** @@ -66,13 +61,7 @@ public function __construct( */ public function save(StockInterface $stock) { - try { - $this->stockResource->save($stock); - return $stock->getStockId(); - } catch (\Exception $e) { - $this->logger->error($e->getMessage()); - throw new CouldNotSaveException(__('Could not save Stock'), $e); - } + $this->commandSave->execute($stock); } /** @@ -80,13 +69,7 @@ public function save(StockInterface $stock) */ public function get($stockId) { - $stock = $this->stockFactory->create(); - $this->stockResource->load($stock, $stockId, StockInterface::STOCK_ID); - - if (null === $stock->getStockId()) { - throw NoSuchEntityException::singleField(StockInterface::STOCK_ID, $stockId); - } - return $stock; + return $this->commandGet->execute($stockId); } /** @@ -94,19 +77,7 @@ public function get($stockId) */ public function deleteById($stockId) { - try { - $stock = $this->get($stockId); - } catch (NoSuchEntityException $e) { - return; - } - - try { - $this->stockResource->delete($stock); - } catch (\Exception $e) { - $this->logger->error($e->getMessage()); - throw new CouldNotDeleteException(__('Could not delete Stock'), $e); - } - + $this->commandDeleteById->execute($stockId); } /** @@ -114,6 +85,6 @@ public function deleteById($stockId) */ public function getList(SearchCriteriaInterface $searchCriteria = null) { - return $this->getList->execute($searchCriteria); + return $this->commandGetList->execute($searchCriteria); } } diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index afbf0f91b9f62..04a6b3e0b3452 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -19,9 +19,13 @@ - - - + + + + + + + diff --git a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php index bebfe3624020d..d4a9798262803 100644 --- a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php @@ -9,7 +9,16 @@ use Magento\InventoryApi\Api\Data\StockInterface; /** - * This is Facade for basic operations with Stock + * In Magento 2 Repository considered as an implementation of Facade pattern which provides a simplified interface + * to a larger body of code responsible for Domain Entity management + * + * The main intention is to make API more readable and reduce dependencies of business logic code on the inner workings + * of a module, since most code uses the facade, thus allowing more flexibility in developing the system + * + * Along with this such approach helps to segregate two responsibilities: + * 1. Repository now could be considered as an API - Interface for usage (calling) in the business logic + * 2. Separate class-commands to which Repository proxies initial call (like, Get Save GetList Delete) could be + * considered as SPI - Interfaces that you should extend and implement to customize current behaviour * * Used fully qualified namespaces in annotations for proper work of WebApi request parser * @@ -37,7 +46,7 @@ public function save(StockInterface $stock); public function get($stockId); /** - * Load Stock data collection by given search criteria + * Find Stocks by given SearchCriteria * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\InventoryApi\Api\Data\StockSearchResultsInterface @@ -45,11 +54,10 @@ public function get($stockId); public function getList(SearchCriteriaInterface $searchCriteria = null); /** - * Delete the Stock data by given stockId + * Delete the Stock data by stockId. If stock is not found do nothing * * @param int $stockId * @return void - * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotDeleteException */ public function deleteById($stockId); diff --git a/app/code/Magento/InventoryApi/Api/UnassignSourceFromStockInterface.php b/app/code/Magento/InventoryApi/Api/UnassignSourceFromStockInterface.php index c8bcb0309daad..eff97616849f6 100644 --- a/app/code/Magento/InventoryApi/Api/UnassignSourceFromStockInterface.php +++ b/app/code/Magento/InventoryApi/Api/UnassignSourceFromStockInterface.php @@ -8,6 +8,8 @@ /** * Unassign source from stock command * + * Used fully qualified namespaces in annotations for proper work of WebApi request parser + * * @api */ interface UnassignSourceFromStockInterface @@ -19,7 +21,6 @@ interface UnassignSourceFromStockInterface * @param int $sourceId * @return void * @throws \Magento\Framework\Exception\InputException - * @throws \Magento\Framework\Exception\CouldNotDeleteException */ public function execute($stockId, $sourceId); } From 90d01942a09fabdeea21a7a803dabf53e60353c0 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 28 Jul 2017 11:45:05 +0300 Subject: [PATCH 0387/1004] MSI - Msi stock ui aggregation #39 - fixes after CR --- .../Inventory/Model/Source/Command/Get.php | 54 +++++++++ .../Model/Source/Command/GetInterface.php | 31 +++++ .../Model/Source/Command/GetList.php | 80 +++++++++++++ .../Model/Source/Command/GetListInterface.php | 30 +++++ .../Inventory/Model/Source/Command/Save.php | 53 +++++++++ .../Model/Source/Command/SaveInterface.php | 31 +++++ .../SourceCarrierLinkManagementInterface.php | 3 +- .../Inventory/Model/SourceRepository.php | 110 ++++-------------- app/code/Magento/Inventory/etc/di.xml | 4 +- .../Api/SourceRepositoryInterface.php | 14 ++- 10 files changed, 317 insertions(+), 93 deletions(-) create mode 100644 app/code/Magento/Inventory/Model/Source/Command/Get.php create mode 100644 app/code/Magento/Inventory/Model/Source/Command/GetInterface.php create mode 100644 app/code/Magento/Inventory/Model/Source/Command/GetList.php create mode 100644 app/code/Magento/Inventory/Model/Source/Command/GetListInterface.php create mode 100644 app/code/Magento/Inventory/Model/Source/Command/Save.php create mode 100644 app/code/Magento/Inventory/Model/Source/Command/SaveInterface.php diff --git a/app/code/Magento/Inventory/Model/Source/Command/Get.php b/app/code/Magento/Inventory/Model/Source/Command/Get.php new file mode 100644 index 0000000000000..f50a670ae7925 --- /dev/null +++ b/app/code/Magento/Inventory/Model/Source/Command/Get.php @@ -0,0 +1,54 @@ +sourceResource = $sourceResource; + $this->sourceFactory = $sourceFactory; + } + + /** + * @inheritdoc + */ + public function execute($sourceId) + { + /** @var SourceInterface $source */ + $source = $this->sourceFactory->create(); + $this->sourceResource->load($source, $sourceId, SourceInterface::SOURCE_ID); + + if (null === $source->getSourceId()) { + throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); + } + return $source; + } +} diff --git a/app/code/Magento/Inventory/Model/Source/Command/GetInterface.php b/app/code/Magento/Inventory/Model/Source/Command/GetInterface.php new file mode 100644 index 0000000000000..cd14c5d45769e --- /dev/null +++ b/app/code/Magento/Inventory/Model/Source/Command/GetInterface.php @@ -0,0 +1,31 @@ +collectionProcessor = $collectionProcessor; + $this->sourceCollectionFactory = $sourceCollectionFactory; + $this->sourceSearchResultsFactory = $sourceSearchResultsFactory; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + } + + /** + * @inheritdoc + */ + public function execute(SearchCriteriaInterface $searchCriteria = null) + { + /** @var Collection $collection */ + $collection = $this->sourceCollectionFactory->create(); + + if (null === $searchCriteria) { + $searchCriteria = $this->searchCriteriaBuilder->create(); + } else { + $this->collectionProcessor->process($searchCriteria, $collection); + } + + /** @var SourceSearchResultsInterface $searchResult */ + $searchResult = $this->sourceSearchResultsFactory->create(); + $searchResult->setItems($collection->getItems()); + $searchResult->setTotalCount($collection->getSize()); + $searchResult->setSearchCriteria($searchCriteria); + return $searchResult; + } +} diff --git a/app/code/Magento/Inventory/Model/Source/Command/GetListInterface.php b/app/code/Magento/Inventory/Model/Source/Command/GetListInterface.php new file mode 100644 index 0000000000000..1b2e6c5d3a55d --- /dev/null +++ b/app/code/Magento/Inventory/Model/Source/Command/GetListInterface.php @@ -0,0 +1,30 @@ +sourceResource = $sourceResource; + $this->logger = $logger; + } + + /** + * @inheritdoc + */ + public function execute(SourceInterface $source) + { + try { + $this->sourceResource->save($source); + return $source->getSourceId(); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + throw new CouldNotSaveException(__('Could not save Source'), $e); + } + } +} diff --git a/app/code/Magento/Inventory/Model/Source/Command/SaveInterface.php b/app/code/Magento/Inventory/Model/Source/Command/SaveInterface.php new file mode 100644 index 0000000000000..0f46cea5b4887 --- /dev/null +++ b/app/code/Magento/Inventory/Model/Source/Command/SaveInterface.php @@ -0,0 +1,31 @@ +sourceResource = $sourceResource; - $this->sourceFactory = $sourceFactory; - $this->collectionProcessor = $collectionProcessor; - $this->sourceCollectionFactory = $sourceCollectionFactory; - $this->sourceSearchResultsFactory = $sourceSearchResultsFactory; - $this->searchCriteriaBuilder = $searchCriteriaBuilder; - $this->logger = $logger; + $this->commandSave = $commandSave; + $this->commandGet = $commandGet; + $this->commandGetList = $commandGetList; } /** @@ -94,13 +52,7 @@ public function __construct( */ public function save(SourceInterface $source) { - try { - $this->sourceResource->save($source); - return $source->getSourceId(); - } catch (\Exception $e) { - $this->logger->error($e->getMessage()); - throw new CouldNotSaveException(__('Could not save Source'), $e); - } + $this->commandSave->execute($source); } /** @@ -108,13 +60,7 @@ public function save(SourceInterface $source) */ public function get($sourceId) { - $source = $this->sourceFactory->create(); - $this->sourceResource->load($source, $sourceId, SourceInterface::SOURCE_ID); - - if (null === $source->getSourceId()) { - throw NoSuchEntityException::singleField(SourceInterface::SOURCE_ID, $sourceId); - } - return $source; + return $this->commandGet->execute($sourceId); } /** @@ -122,20 +68,6 @@ public function get($sourceId) */ public function getList(SearchCriteriaInterface $searchCriteria = null) { - /** @var Collection $collection */ - $collection = $this->sourceCollectionFactory->create(); - - if (null === $searchCriteria) { - $searchCriteria = $this->searchCriteriaBuilder->create(); - } else { - $this->collectionProcessor->process($searchCriteria, $collection); - } - - /** @var SourceSearchResultsInterface $searchResult */ - $searchResult = $this->sourceSearchResultsFactory->create(); - $searchResult->setItems($collection->getItems()); - $searchResult->setTotalCount($collection->getSize()); - $searchResult->setSearchCriteria($searchCriteria); - return $searchResult; + return $this->commandGetList->execute($searchCriteria); } } diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index 04a6b3e0b3452..341eb1bcdb9ea 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -11,8 +11,10 @@ - + + + diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index 5fa75833b7730..2d98c385f0af4 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -9,7 +9,17 @@ use Magento\InventoryApi\Api\Data\SourceInterface; /** - * This is Facade for basic operations with Source + * In Magento 2 Repository considered as an implementation of Facade pattern which provides a simplified interface + * to a larger body of code responsible for Domain Entity management + * + * The main intention is to make API more readable and reduce dependencies of business logic code on the inner workings + * of a module, since most code uses the facade, thus allowing more flexibility in developing the system + * + * Along with this such approach helps to segregate two responsibilities: + * 1. Repository now could be considered as an API - Interface for usage (calling) in the business logic + * 2. Separate class-commands to which Repository proxies initial call (like, Get Save GetList Delete) could be + * considered as SPI - Interfaces that you should extend and implement to customize current behaviour + * * There is no delete method. It is related to that Source can't be deleted due to we don't want miss data * related to Sources (like as order information). But Source can be disabled * @@ -39,7 +49,7 @@ public function save(SourceInterface $source); public function get($sourceId); /** - * Load Source data collection by given search criteria + * Find Sources by SearchCriteria * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria * @return \Magento\InventoryApi\Api\Data\SourceSearchResultsInterface From e1ea6e578e452ef1b7ac1b24c960cde6d55807c8 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 28 Jul 2017 12:12:35 +0300 Subject: [PATCH 0388/1004] MSI - Msi stock ui aggregation #39 - fixes after CR --- .../Model/Source/Command/GetListInterface.php | 4 +- .../Inventory/Model/SourceItemRepository.php | 73 +---- .../Model/Stock/Command/GetListInterface.php | 4 +- .../Model/StockItem/Command/Delete.php | 52 +++ .../StockItem/Command/DeleteInterface.php | 31 ++ .../Model/StockItem/Command/GetList.php | 66 ++++ .../StockItem/Command/GetListInterface.php | 33 ++ .../Unit/Model/SourceItemRepositoryTest.php | 179 ---------- .../Test/Unit/Model/SourceRepositoryTest.php | 309 ------------------ .../Test/Unit/Model/StockRepositoryTest.php | 243 -------------- app/code/Magento/Inventory/etc/di.xml | 2 + .../Api/SourceItemRepositoryInterface.php | 19 +- .../Api/SourceRepositoryInterface.php | 2 +- .../Api/StockRepositoryInterface.php | 2 +- 14 files changed, 218 insertions(+), 801 deletions(-) create mode 100644 app/code/Magento/Inventory/Model/StockItem/Command/Delete.php create mode 100644 app/code/Magento/Inventory/Model/StockItem/Command/DeleteInterface.php create mode 100644 app/code/Magento/Inventory/Model/StockItem/Command/GetList.php create mode 100644 app/code/Magento/Inventory/Model/StockItem/Command/GetListInterface.php delete mode 100644 app/code/Magento/Inventory/Test/Unit/Model/SourceItemRepositoryTest.php delete mode 100644 app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php delete mode 100644 app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php diff --git a/app/code/Magento/Inventory/Model/Source/Command/GetListInterface.php b/app/code/Magento/Inventory/Model/Source/Command/GetListInterface.php index 1b2e6c5d3a55d..1e11107b6eedc 100644 --- a/app/code/Magento/Inventory/Model/Source/Command/GetListInterface.php +++ b/app/code/Magento/Inventory/Model/Source/Command/GetListInterface.php @@ -23,8 +23,8 @@ interface GetListInterface /** * Find Sources by given SearchCriteria * - * @param SearchCriteriaInterface $searchCriteria + * @param SearchCriteriaInterface|null $searchCriteria * @return SourceSearchResultsInterface */ - public function execute(SearchCriteriaInterface $searchCriteria); + public function execute(SearchCriteriaInterface $searchCriteria = null); } diff --git a/app/code/Magento/Inventory/Model/SourceItemRepository.php b/app/code/Magento/Inventory/Model/SourceItemRepository.php index 69f6dbfcac2c5..5df456064f3c6 100644 --- a/app/code/Magento/Inventory/Model/SourceItemRepository.php +++ b/app/code/Magento/Inventory/Model/SourceItemRepository.php @@ -5,17 +5,12 @@ */ namespace Magento\Inventory\Model; -use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface; use Magento\Framework\Api\SearchCriteriaInterface; -use Magento\Framework\Exception\CouldNotDeleteException; use Magento\Inventory\Model\ResourceModel\SourceItem as SourceItemResourceModel; -use Magento\Inventory\Model\ResourceModel\SourceItem\Collection; -use Magento\Inventory\Model\ResourceModel\SourceItem\CollectionFactory; +use Magento\Inventory\Model\SourceItem\Command\DeleteInterface; +use Magento\Inventory\Model\SourceItem\Command\GetListInterface; use Magento\InventoryApi\Api\Data\SourceItemInterface; -use Magento\InventoryApi\Api\Data\SourceItemSearchResultsInterface; -use Magento\InventoryApi\Api\Data\SourceItemSearchResultsInterfaceFactory; use Magento\InventoryApi\Api\SourceItemRepositoryInterface; -use Psr\Log\LoggerInterface; /** * @inheritdoc @@ -23,51 +18,25 @@ class SourceItemRepository implements SourceItemRepositoryInterface { /** - * @var SourceItemResourceModel + * @var DeleteInterface */ - private $sourceItemResource; + private $commandDelete; /** - * @var CollectionProcessorInterface + * @var GetListInterface */ - private $collectionProcessor; + private $commandGetList; /** - * @var CollectionFactory - */ - private $sourceItemCollectionFactory; - - /** - * @var SourceItemSearchResultsInterfaceFactory - */ - private $sourceItemSearchResultsFactory; - - /** - * @var LoggerInterface - */ - private $logger; - - /** - * SourceRepository constructor - * - * @param SourceItemResourceModel $sourceItemResource - * @param CollectionProcessorInterface $collectionProcessor - * @param CollectionFactory $sourceItemCollectionFactory - * @param SourceItemSearchResultsInterfaceFactory $sourceItemSearchResultsFactory - * @param LoggerInterface $logger + * @param DeleteInterface $commandDelete + * @param GetListInterface $commandGetList */ public function __construct( - SourceItemResourceModel $sourceItemResource, - CollectionProcessorInterface $collectionProcessor, - CollectionFactory $sourceItemCollectionFactory, - SourceItemSearchResultsInterfaceFactory $sourceItemSearchResultsFactory, - LoggerInterface $logger + DeleteInterface $commandDelete, + GetListInterface $commandGetList ) { - $this->sourceItemResource = $sourceItemResource; - $this->collectionProcessor = $collectionProcessor; - $this->sourceItemCollectionFactory = $sourceItemCollectionFactory; - $this->sourceItemSearchResultsFactory = $sourceItemSearchResultsFactory; - $this->logger = $logger; + $this->commandDelete = $commandDelete; + $this->commandGetList = $commandGetList; } /** @@ -75,16 +44,7 @@ public function __construct( */ public function getList(SearchCriteriaInterface $searchCriteria) { - /** @var Collection $collection */ - $collection = $this->sourceItemCollectionFactory->create(); - $this->collectionProcessor->process($searchCriteria, $collection); - - /** @var SourceItemSearchResultsInterface $searchResult */ - $searchResult = $this->sourceItemSearchResultsFactory->create(); - $searchResult->setItems($collection->getItems()); - $searchResult->setTotalCount($collection->getSize()); - $searchResult->setSearchCriteria($searchCriteria); - return $searchResult; + return $this->commandGetList->execute($searchCriteria); } /** @@ -92,11 +52,6 @@ public function getList(SearchCriteriaInterface $searchCriteria) */ public function delete(SourceItemInterface $sourceItem) { - try { - $this->sourceItemResource->delete($sourceItem); - } catch (\Exception $e) { - $this->logger->error($e->getMessage()); - throw new CouldNotDeleteException(__('Could not delete Source Item'), $e); - } + $this->commandDelete->execute($sourceItem); } } diff --git a/app/code/Magento/Inventory/Model/Stock/Command/GetListInterface.php b/app/code/Magento/Inventory/Model/Stock/Command/GetListInterface.php index 01cdf1ab4acb9..20e334b3018b7 100644 --- a/app/code/Magento/Inventory/Model/Stock/Command/GetListInterface.php +++ b/app/code/Magento/Inventory/Model/Stock/Command/GetListInterface.php @@ -23,8 +23,8 @@ interface GetListInterface /** * Find Stocks by given SearchCriteria * - * @param SearchCriteriaInterface $searchCriteria + * @param SearchCriteriaInterface|null $searchCriteria * @return StockSearchResultsInterface */ - public function execute(SearchCriteriaInterface $searchCriteria); + public function execute(SearchCriteriaInterface $searchCriteria = null); } diff --git a/app/code/Magento/Inventory/Model/StockItem/Command/Delete.php b/app/code/Magento/Inventory/Model/StockItem/Command/Delete.php new file mode 100644 index 0000000000000..cd5badce68156 --- /dev/null +++ b/app/code/Magento/Inventory/Model/StockItem/Command/Delete.php @@ -0,0 +1,52 @@ +sourceItemResource = $sourceItemResource; + $this->logger = $logger; + } + + /** + * @inheritdoc + */ + public function execute(SourceItemInterface $sourceItem) + { + try { + $this->sourceItemResource->delete($sourceItem); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); + throw new CouldNotDeleteException(__('Could not delete SourceItem'), $e); + } + } +} diff --git a/app/code/Magento/Inventory/Model/StockItem/Command/DeleteInterface.php b/app/code/Magento/Inventory/Model/StockItem/Command/DeleteInterface.php new file mode 100644 index 0000000000000..fa547af164251 --- /dev/null +++ b/app/code/Magento/Inventory/Model/StockItem/Command/DeleteInterface.php @@ -0,0 +1,31 @@ +collectionProcessor = $collectionProcessor; + $this->sourceItemCollectionFactory = $sourceItemCollectionFactory; + $this->sourceItemSearchResultsFactory = $sourceItemSearchResultsFactory; + } + + /** + * @inheritdoc + */ + public function execute(SearchCriteriaInterface $searchCriteria) + { + /** @var Collection $collection */ + $collection = $this->sourceItemCollectionFactory->create(); + $this->collectionProcessor->process($searchCriteria, $collection); + + /** @var SourceItemSearchResultsInterface $searchResult */ + $searchResult = $this->sourceItemSearchResultsFactory->create(); + $searchResult->setItems($collection->getItems()); + $searchResult->setTotalCount($collection->getSize()); + $searchResult->setSearchCriteria($searchCriteria); + return $searchResult; + } +} diff --git a/app/code/Magento/Inventory/Model/StockItem/Command/GetListInterface.php b/app/code/Magento/Inventory/Model/StockItem/Command/GetListInterface.php new file mode 100644 index 0000000000000..6873a8aa0a399 --- /dev/null +++ b/app/code/Magento/Inventory/Model/StockItem/Command/GetListInterface.php @@ -0,0 +1,33 @@ +sourceItemResource = $this->getMockBuilder(SourceItemResource::class) - ->disableOriginalConstructor() - ->getMock(); - $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) - ->disableOriginalConstructor() - ->getMock(); - $this->sourceItemFactory = $this->getMockBuilder(SourceItemInterfaceFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class) - ->setMethods(['process']) - ->getMock(); - $this->sourceItemCollectionFactory = $this->getMockBuilder(SourceItemCollectionFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->sourceItemSearchResultsFactory = $this->getMockBuilder(SourceItemSearchResultsInterfaceFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->logger = $this->getMockBuilder(LoggerInterface::class) - ->getMock(); - $this->sourceItem = $this->getMockBuilder(SourceItem::class) - ->disableOriginalConstructor() - ->getMock(); - - $objectManager = new ObjectManager($this); - $this->sourceItemRepository = $objectManager->getObject( - SourceItemRepository::class, - [ - 'sourceItemResource' => $this->sourceItemResource, - 'sourceItemFactory' => $this->sourceItemFactory, - 'collectionProcessor' => $this->collectionProcessor, - 'sourceItemCollectionFactory' => $this->sourceItemCollectionFactory, - 'sourceItemSearchResultsFactory' => $this->sourceItemSearchResultsFactory, - 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, - 'logger' => $this->logger, - ] - ); - } - - public function testGetListWithSearchCriteria() - { - $items = [ - $this->getMockBuilder(SourceItemInterface::class)->getMock(), - $this->getMockBuilder(SourceItemInterface::class)->getMock() - ]; - $totalCount = 2; - $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) - ->getMock(); - - $sourceItemCollection = $this->getMockBuilder(SourceItemCollection::class) - ->disableOriginalConstructor() - ->getMock(); - $sourceItemCollection - ->expects($this->once()) - ->method('getItems') - ->willReturn($items); - $sourceItemCollection - ->expects($this->once()) - ->method('getSize') - ->willReturn($totalCount); - $this->sourceItemCollectionFactory - ->expects($this->once()) - ->method('create') - ->willReturn($sourceItemCollection); - - $searchResults = $this->getMockBuilder(SourceItemSearchResultsInterface::class) - ->getMock(); - $searchResults - ->expects($this->once()) - ->method('setItems') - ->with($items); - $searchResults - ->expects($this->once()) - ->method('setTotalCount') - ->with($totalCount); - $searchResults - ->expects($this->once()) - ->method('setSearchCriteria') - ->with($searchCriteria); - $this->sourceItemSearchResultsFactory - ->expects($this->once()) - ->method('create') - ->willReturn($searchResults); - - $this->collectionProcessor - ->expects($this->once()) - ->method('process') - ->with($searchCriteria, $sourceItemCollection); - - self::assertSame($searchResults, $this->sourceItemRepository->getList($searchCriteria)); - } - - public function testDelete() - { - $this->sourceItemResource - ->expects($this->once()) - ->method('delete') - ->with($this->sourceItem); - - $this->sourceItemRepository->delete($this->sourceItem); - } -} diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php deleted file mode 100644 index d2ade01397193..0000000000000 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ /dev/null @@ -1,309 +0,0 @@ -sourceResource = $this->getMockBuilder(SourceResource::class)->disableOriginalConstructor()->getMock(); - $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class) - ->disableOriginalConstructor() - ->getMock(); - $this->sourceFactory = $this->getMockBuilder(SourceInterfaceFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->collectionProcessor = $this->getMockBuilder(CollectionProcessorInterface::class) - ->disableOriginalConstructor() - ->setMethods(['process']) - ->getMock(); - $this->sourceCollectionFactory = $this->getMockBuilder(SourceCollectionFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->sourceSearchResultsFactory = $this->getMockBuilder(SourceSearchResultsInterfaceFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->source = $this->getMockBuilder(Source::class) - ->disableOriginalConstructor() - ->getMock(); - - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->model = $objectManager->getObject( - \Magento\Inventory\Model\SourceRepository::class, - [ - 'sourceResource' => $this->sourceResource, - 'sourceFactory' => $this->sourceFactory, - 'collectionProcessor' => $this->collectionProcessor, - 'sourceCollectionFactory' => $this->sourceCollectionFactory, - 'sourceSearchResultsFactory' => $this->sourceSearchResultsFactory, - 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, - 'logger' => $this->loggerMock, - ] - ); - } - - public function testSave() - { - $sourceId = 42; - - $this->source - ->expects($this->once()) - ->method('getSourceId') - ->willReturn($sourceId); - $this->sourceResource - ->expects($this->once()) - ->method('save') - ->with($this->source); - - self::assertEquals($sourceId, $this->model->save($this->source)); - } - - /** - * @expectedException \Magento\Framework\Exception\CouldNotSaveException - */ - public function testSaveErrorExpectsException() - { - $message = 'some message'; - - $this->sourceResource - ->expects($this->once()) - ->method('save') - ->willThrowException(new \Exception($message)); - - $this->loggerMock - ->expects($this->once()) - ->method('error') - ->with($message); - - $this->model->save($this->source); - } - - public function testGet() - { - $sourceId = 345; - - $this->source - ->expects($this->once()) - ->method('getSourceId') - ->willReturn($sourceId); - $this->sourceFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->source); - $this->sourceResource - ->expects($this->once()) - ->method('load') - ->with($this->source, $sourceId, SourceInterface::SOURCE_ID); - - self::assertSame($this->source, $this->model->get($sourceId)); - } - - /** - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - */ - public function testGetErrorExpectsException() - { - $sourceId = 345; - - $this->source - ->expects($this->once()) - ->method('getSourceId') - ->willReturn(null); - $this->sourceFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->source); - $this->sourceResource->expects($this->once()) - ->method('load') - ->with( - $this->source, - $sourceId, - SourceInterface::SOURCE_ID - ); - - $this->model->get($sourceId); - } - - public function testGetListWithSearchCriteria() - { - $items = [ - $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(), - $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock() - ]; - $totalCount = 2; - $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) - ->disableOriginalConstructor() - ->getMock(); - - $sourceCollection = $this->getMockBuilder(SourceCollection::class) - ->disableOriginalConstructor() - ->getMock(); - $sourceCollection - ->expects($this->once()) - ->method('getItems') - ->willReturn($items); - $sourceCollection - ->expects($this->once()) - ->method('getSize') - ->willReturn($totalCount); - $this->sourceCollectionFactory - ->expects($this->once()) - ->method('create') - ->willReturn($sourceCollection); - - $searchResults = $this->getMockBuilder(SourceSearchResultsInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $searchResults - ->expects($this->once()) - ->method('setItems') - ->with($items); - $searchResults - ->expects($this->once()) - ->method('setTotalCount') - ->with($totalCount); - $searchResults - ->expects($this->once()) - ->method('setSearchCriteria') - ->with($searchCriteria); - $this->sourceSearchResultsFactory - ->expects($this->once()) - ->method('create') - ->willReturn($searchResults); - - $this->collectionProcessor - ->expects($this->once()) - ->method('process') - ->with($searchCriteria, $sourceCollection); - - self::assertSame($searchResults, $this->model->getList($searchCriteria)); - } - - public function testGetListWithoutSearchCriteria() - { - $items = [ - $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock(), - $this->getMockBuilder(Source::class)->disableOriginalConstructor()->getMock() - ]; - $totalCount = 2; - - $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->searchCriteriaBuilder - ->expects($this->once()) - ->method('create') - ->willReturn($searchCriteria); - - $sourceCollection = $this->getMockBuilder(SourceCollection::class) - ->disableOriginalConstructor() - ->getMock(); - $sourceCollection - ->expects($this->once()) - ->method('getItems') - ->willReturn($items); - $sourceCollection - ->expects($this->once()) - ->method('getSize') - ->willReturn($totalCount); - $this->sourceCollectionFactory - ->expects($this->once()) - ->method('create') - ->willReturn($sourceCollection); - - $searchResults = $this->getMockBuilder(SourceSearchResultsInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $searchResults - ->expects($this->once()) - ->method('setItems') - ->with($items); - $searchResults - ->expects($this->once()) - ->method('setTotalCount') - ->with($totalCount); - $searchResults - ->expects($this->once()) - ->method('setSearchCriteria') - ->with($searchCriteria); - $this->sourceSearchResultsFactory - ->expects($this->once()) - ->method('create') - ->willReturn($searchResults); - - $this->collectionProcessor - ->expects($this->never()) - ->method('process'); - - self::assertSame($searchResults, $this->model->getList()); - } -} diff --git a/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php deleted file mode 100644 index 89c61fb90c202..0000000000000 --- a/app/code/Magento/Inventory/Test/Unit/Model/StockRepositoryTest.php +++ /dev/null @@ -1,243 +0,0 @@ -stockResource = $this->getMockBuilder(StockResource::class)->disableOriginalConstructor()->getMock(); - $this->stockFactory = $this->getMockBuilder(StockInterfaceFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->getList = $this->getMockBuilder(GetList::class) - ->disableOriginalConstructor() - ->getMock(); - $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->stock = $this->getMockBuilder(Stock::class) - ->disableOriginalConstructor() - ->getMock(); - - $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->model = $objectManager->getObject( - \Magento\Inventory\Model\StockRepository::class, - [ - 'stockResource' => $this->stockResource, - 'stockFactory' => $this->stockFactory, - 'getList' => $this->getList, - 'logger' => $this->loggerMock, - ] - ); - } - - public function testSave() - { - $stockId = 42; - - $this->stock - ->expects($this->once()) - ->method('getStockId') - ->willReturn($stockId); - $this->stockResource - ->expects($this->once()) - ->method('save') - ->with($this->stock); - - self::assertEquals($stockId, $this->model->save($this->stock)); - } - - /** - * @expectedException \Magento\Framework\Exception\CouldNotSaveException - */ - public function testSaveErrorExpectsException() - { - $message = 'some message'; - - $this->stockResource - ->expects($this->once()) - ->method('save') - ->willThrowException(new \Exception($message)); - - $this->loggerMock - ->expects($this->once()) - ->method('error') - ->with($message); - - $this->model->save($this->stock); - } - - public function testGet() - { - $stockId = 345; - - $this->stock - ->expects($this->once()) - ->method('getStockId') - ->willReturn($stockId); - $this->stockFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->stock); - $this->stockResource - ->expects($this->once()) - ->method('load') - ->with($this->stock, $stockId, StockInterface::STOCK_ID); - - self::assertSame($this->stock, $this->model->get($stockId)); - } - - /** - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - */ - public function testGetErrorExpectsException() - { - $stockId = 345; - - $this->stock - ->expects($this->once()) - ->method('getStockId') - ->willReturn(null); - $this->stockFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->stock); - $this->stockResource->expects($this->once()) - ->method('load') - ->with( - $this->stock, - $stockId, - StockInterface::STOCK_ID - ); - - $this->model->get($stockId); - } - - public function testGetListWithSearchCriteria() - { - $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $searchResult = $this->getMockBuilder(StockSearchResultsInterface::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->getList - ->expects($this->once()) - ->method('execute') - ->with($searchCriteria) - ->willReturn($searchResult); - - self::assertSame($searchResult, $this->model->getList($searchCriteria)); - } - - public function testGetListWithoutSearchCriteria() - { - $searchResult = $this->getMockBuilder(StockSearchResultsInterface::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->getList - ->expects($this->once()) - ->method('execute') - ->willReturn($searchResult); - - self::assertSame($searchResult, $this->model->getList()); - } - - public function testDeleteById() - { - $stockId = 345; - $this->stock - ->expects($this->once()) - ->method('getStockId') - ->willReturn($stockId); - $this->stockFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->stock); - $this->stockResource - ->expects($this->once()) - ->method('load') - ->with($this->stock, $stockId, StockInterface::STOCK_ID); - - $this->stockResource - ->expects($this->once()) - ->method('delete') - ->with($this->stock); - - $this->model->deleteById($stockId); - } - - /** - * @expectedException \Magento\Framework\Exception\NoSuchEntityException - */ - public function testDeleteErrorExpectsException() - { - $stockId = 0; - - $this->stock - ->expects($this->once()) - ->method('getStockId') - ->willReturn(null); - $this->stockFactory - ->expects($this->once()) - ->method('create') - ->willReturn($this->stock); - $this->stockResource->expects($this->once()) - ->method('load') - ->with( - $this->stock, - $stockId, - StockInterface::STOCK_ID - ); - - $this->model->deleteById($stockId); - } -} diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index 341eb1bcdb9ea..47605ad911584 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -20,6 +20,8 @@ + + diff --git a/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php index 79665d672f3f7..ab68d271c1602 100644 --- a/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceItemRepositoryInterface.php @@ -9,7 +9,16 @@ use Magento\InventoryApi\Api\Data\SourceItemInterface; /** - * This is Facade for basic operations with SourceItem + * In Magento 2 Repository considered as an implementation of Facade pattern which provides a simplified interface + * to a larger body of code responsible for Domain Entity management + * + * The main intention is to make API more readable and reduce dependencies of business logic code on the inner workings + * of a module, since most code uses the facade, thus allowing more flexibility in developing the system + * + * Along with this such approach helps to segregate two responsibilities: + * 1. Repository now could be considered as an API - Interface for usage (calling) in the business logic + * 2. Separate class-commands to which Repository proxies initial call (like, Get Save GetList Delete) could be + * considered as SPI - Interfaces that you should extend and implement to customize current behaviour * * The method save is absent, due to different semantic (save multiple) * @see SourceItemSaveInterface @@ -24,9 +33,9 @@ interface SourceItemRepositoryInterface { /** - * Load Source Item data collection by given search criteria + * Find SourceItems by SearchCriteria * - * We need to have this method for direct work with Source Items because this object contains + * We need to have this method for direct work with SourceItems because this object contains * additional data like as qty, status (for example can de searchable by additional field) * * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria @@ -35,9 +44,9 @@ interface SourceItemRepositoryInterface public function getList(SearchCriteriaInterface $searchCriteria); /** - * Delete Source Item data + * Delete SourceItem data * - * @param SourceItemInterface $sourceItem + * @param \Magento\InventoryApi\Api\Data\SourceItemInterface $sourceItem * @return void * @throws \Magento\Framework\Exception\CouldNotDeleteException */ diff --git a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php index 2d98c385f0af4..cc8154f9a4c0e 100644 --- a/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/SourceRepositoryInterface.php @@ -51,7 +51,7 @@ public function get($sourceId); /** * Find Sources by SearchCriteria * - * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria + * @param \Magento\Framework\Api\SearchCriteriaInterface|null $searchCriteria * @return \Magento\InventoryApi\Api\Data\SourceSearchResultsInterface */ public function getList(SearchCriteriaInterface $searchCriteria = null); diff --git a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php index d4a9798262803..7412865c0a838 100644 --- a/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php +++ b/app/code/Magento/InventoryApi/Api/StockRepositoryInterface.php @@ -48,7 +48,7 @@ public function get($stockId); /** * Find Stocks by given SearchCriteria * - * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria + * @param \Magento\Framework\Api\SearchCriteriaInterface|null $searchCriteria * @return \Magento\InventoryApi\Api\Data\StockSearchResultsInterface */ public function getList(SearchCriteriaInterface $searchCriteria = null); From bd53786fc3488e3768ea1a9e03c1f90d22350e33 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Fri, 28 Jul 2017 15:59:46 +0200 Subject: [PATCH 0389/1004] Add missing type preference for sample data command --- app/code/Magento/SampleData/etc/di.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/SampleData/etc/di.xml b/app/code/Magento/SampleData/etc/di.xml index 2084664dee641..93cf98a41150c 100644 --- a/app/code/Magento/SampleData/etc/di.xml +++ b/app/code/Magento/SampleData/etc/di.xml @@ -15,5 +15,10 @@ - + + + Magento\Framework\Filesystem\Driver\File + + + From 956747bf6a8200864c061602ff2f230d19c4d56a Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 28 Jul 2017 17:20:34 +0300 Subject: [PATCH 0390/1004] MSI - Msi stock ui aggregation #39 - fixes --- .../Inventory/Controller/Adminhtml/Source/Save.php | 2 +- .../Controller/Adminhtml/Source/SourceCarrierHydrator.php | 2 -- .../Adminhtml/Stock/StockSourceLinkProcessor.php | 8 +++++--- .../Model/{StockItem => SourceItem}/Command/Delete.php | 0 .../{StockItem => SourceItem}/Command/DeleteInterface.php | 0 .../Model/{StockItem => SourceItem}/Command/GetList.php | 0 .../Command/GetListInterface.php | 0 app/code/Magento/Inventory/Model/SourceRepository.php | 2 +- app/code/Magento/Inventory/Model/StockRepository.php | 2 +- .../Magento/Inventory/Observer/SourceItemsProcessor.php | 8 ++++++-- app/code/Magento/Inventory/etc/di.xml | 2 +- 11 files changed, 15 insertions(+), 11 deletions(-) rename app/code/Magento/Inventory/Model/{StockItem => SourceItem}/Command/Delete.php (100%) rename app/code/Magento/Inventory/Model/{StockItem => SourceItem}/Command/DeleteInterface.php (100%) rename app/code/Magento/Inventory/Model/{StockItem => SourceItem}/Command/GetList.php (100%) rename app/code/Magento/Inventory/Model/{StockItem => SourceItem}/Command/GetListInterface.php (100%) diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php index 47b9d0dccda54..d4cff67b9134e 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/Save.php @@ -103,7 +103,7 @@ private function processSave($sourceId, array $requestData) /** @var SourceInterface $source */ $source = $this->sourceFactory->create(); } - $source = $this->sourceHydrator->hydrate($source, $requestData['general']); + $source = $this->sourceHydrator->hydrate($source, $requestData); $sourceId = $this->sourceRepository->save($source); return $sourceId; diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceCarrierHydrator.php b/app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceCarrierHydrator.php index c38682cf1dc10..e3eaa24df4874 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceCarrierHydrator.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Source/SourceCarrierHydrator.php @@ -35,8 +35,6 @@ class SourceCarrierHydrator private $shippingConfig; /** - * CarrierRequestDataHydrator constructor - * * @param SourceCarrierLinkInterfaceFactory $carrierLinkFactory * @param DataObjectHelper $dataObjectHelper * @param Config $shippingConfig diff --git a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php index a6a23630fb031..d7f189f9ee93c 100644 --- a/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php +++ b/app/code/Magento/Inventory/Controller/Adminhtml/Stock/StockSourceLinkProcessor.php @@ -87,11 +87,13 @@ public function process($stockId, array $stockSourceLinksData) } } - if (!empty($sourceIdsForSave)) { + if ($sourceIdsForSave) { $this->assignSourcesToStock->execute($stockId, array_keys($sourceIdsForSave)); } - foreach ($sourceIdsForDelete as $sourceIdForDelete) { - $this->unassignSourceFromStock->execute($stockId, $sourceIdForDelete); + if ($sourceIdsForDelete) { + foreach ($sourceIdsForDelete as $sourceIdForDelete) { + $this->unassignSourceFromStock->execute($stockId, $sourceIdForDelete); + } } } diff --git a/app/code/Magento/Inventory/Model/StockItem/Command/Delete.php b/app/code/Magento/Inventory/Model/SourceItem/Command/Delete.php similarity index 100% rename from app/code/Magento/Inventory/Model/StockItem/Command/Delete.php rename to app/code/Magento/Inventory/Model/SourceItem/Command/Delete.php diff --git a/app/code/Magento/Inventory/Model/StockItem/Command/DeleteInterface.php b/app/code/Magento/Inventory/Model/SourceItem/Command/DeleteInterface.php similarity index 100% rename from app/code/Magento/Inventory/Model/StockItem/Command/DeleteInterface.php rename to app/code/Magento/Inventory/Model/SourceItem/Command/DeleteInterface.php diff --git a/app/code/Magento/Inventory/Model/StockItem/Command/GetList.php b/app/code/Magento/Inventory/Model/SourceItem/Command/GetList.php similarity index 100% rename from app/code/Magento/Inventory/Model/StockItem/Command/GetList.php rename to app/code/Magento/Inventory/Model/SourceItem/Command/GetList.php diff --git a/app/code/Magento/Inventory/Model/StockItem/Command/GetListInterface.php b/app/code/Magento/Inventory/Model/SourceItem/Command/GetListInterface.php similarity index 100% rename from app/code/Magento/Inventory/Model/StockItem/Command/GetListInterface.php rename to app/code/Magento/Inventory/Model/SourceItem/Command/GetListInterface.php diff --git a/app/code/Magento/Inventory/Model/SourceRepository.php b/app/code/Magento/Inventory/Model/SourceRepository.php index f461baf91f12f..8341f9ce9e5a9 100644 --- a/app/code/Magento/Inventory/Model/SourceRepository.php +++ b/app/code/Magento/Inventory/Model/SourceRepository.php @@ -52,7 +52,7 @@ public function __construct( */ public function save(SourceInterface $source) { - $this->commandSave->execute($source); + return $this->commandSave->execute($source); } /** diff --git a/app/code/Magento/Inventory/Model/StockRepository.php b/app/code/Magento/Inventory/Model/StockRepository.php index 39565f51a614a..69d2c58a50685 100644 --- a/app/code/Magento/Inventory/Model/StockRepository.php +++ b/app/code/Magento/Inventory/Model/StockRepository.php @@ -61,7 +61,7 @@ public function __construct( */ public function save(StockInterface $stock) { - $this->commandSave->execute($stock); + return $this->commandSave->execute($stock); } /** diff --git a/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php b/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php index 585ead882799b..077fdc9419e83 100644 --- a/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php +++ b/app/code/Magento/Inventory/Observer/SourceItemsProcessor.php @@ -97,8 +97,12 @@ public function process($sku, array $sourceItemsData) $sourceItemsForSave[] = $sourceItem; unset($sourceItemsForDelete[$sourceId]); } - $this->sourceItemSave->execute($sourceItemsForSave); - $this->deleteSourceItems($sourceItemsForDelete); + if ($sourceItemsForSave) { + $this->sourceItemSave->execute($sourceItemsForSave); + } + if ($sourceItemsForDelete) { + $this->deleteSourceItems($sourceItemsForDelete); + } } /** diff --git a/app/code/Magento/Inventory/etc/di.xml b/app/code/Magento/Inventory/etc/di.xml index 47605ad911584..652c13c930f1a 100644 --- a/app/code/Magento/Inventory/etc/di.xml +++ b/app/code/Magento/Inventory/etc/di.xml @@ -20,7 +20,7 @@ - + From c053bcc8173c7aab0274368b271d98912bc87bfd Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Fri, 28 Jul 2017 17:28:18 +0200 Subject: [PATCH 0391/1004] Rearrange @codingStandardsIgnoreStart --- app/code/Magento/SampleData/Model/Dependency.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index 380f90d2a9360..1fe48d573a27f 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -43,6 +43,7 @@ class Dependency */ private $directoryReadFactory; + //@codingStandardsIgnoreStart /** * @param ComposerInformation $composerInformation * @param Filesystem $filesystem @@ -51,7 +52,6 @@ class Dependency * @param Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory * @throws \RuntimeException */ - // @codingStandardsIgnoreStart public function __construct( ComposerInformation $composerInformation, // $filesystem kept for BC @@ -61,7 +61,6 @@ public function __construct( // $directoryReadFactory optional for BC Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory = null ) { - // @codingStandardsIgnoreEnd $this->composerInformation = $composerInformation; $this->packageFactory = $packageFactory; $this->componentRegistrar = $componentRegistrar; @@ -70,6 +69,7 @@ public function __construct( } $this->directoryReadFactory = $directoryReadFactory; } + //@codingStandardsIgnoreEnd /** * Retrieve list of sample data packages from suggests From 81a184e547d1cd57ff6aa1262b8eb1c7e2e65630 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Fri, 28 Jul 2017 14:36:11 -0500 Subject: [PATCH 0392/1004] MAGETWO-71052: 2.3 version bump --- .../Magento/AdminNotification/composer.json | 12 +- .../AdvancedPricingImportExport/composer.json | 18 +- app/code/Magento/Analytics/composer.json | 12 +- app/code/Magento/Authorization/composer.json | 6 +- app/code/Magento/Authorizenet/composer.json | 20 +- app/code/Magento/Backend/composer.json | 36 +-- app/code/Magento/Backup/composer.json | 10 +- app/code/Magento/Braintree/composer.json | 32 +-- app/code/Magento/Bundle/composer.json | 38 +-- .../Magento/BundleImportExport/composer.json | 14 +- .../Magento/CacheInvalidate/composer.json | 6 +- app/code/Magento/Captcha/composer.json | 12 +- app/code/Magento/Catalog/composer.json | 56 ++-- .../Magento/CatalogAnalytics/composer.json | 6 +- .../Magento/CatalogImportExport/composer.json | 22 +- .../Magento/CatalogInventory/composer.json | 18 +- app/code/Magento/CatalogRule/composer.json | 22 +- .../CatalogRuleConfigurable/composer.json | 12 +- app/code/Magento/CatalogSearch/composer.json | 24 +- .../Magento/CatalogUrlRewrite/composer.json | 20 +- app/code/Magento/CatalogWidget/composer.json | 20 +- app/code/Magento/Checkout/composer.json | 42 +-- .../Magento/CheckoutAgreements/composer.json | 12 +- app/code/Magento/Cms/composer.json | 24 +- app/code/Magento/CmsUrlRewrite/composer.json | 10 +- app/code/Magento/Config/composer.json | 18 +- .../ConfigurableImportExport/composer.json | 14 +- .../Magento/ConfigurableProduct/composer.json | 36 +-- .../ConfigurableProductSales/composer.json | 12 +- app/code/Magento/Contact/composer.json | 12 +- app/code/Magento/Cookie/composer.json | 8 +- app/code/Magento/Cron/composer.json | 8 +- app/code/Magento/CurrencySymbol/composer.json | 14 +- app/code/Magento/Customer/composer.json | 46 ++-- .../Magento/CustomerAnalytics/composer.json | 6 +- .../CustomerImportExport/composer.json | 16 +- app/code/Magento/Deploy/composer.json | 12 +- app/code/Magento/Developer/composer.json | 8 +- app/code/Magento/Dhl/composer.json | 24 +- app/code/Magento/Directory/composer.json | 10 +- app/code/Magento/Downloadable/composer.json | 38 +-- .../DownloadableImportExport/composer.json | 16 +- app/code/Magento/Eav/composer.json | 14 +- app/code/Magento/Email/composer.json | 18 +- app/code/Magento/EncryptionKey/composer.json | 8 +- app/code/Magento/Fedex/composer.json | 20 +- app/code/Magento/GiftMessage/composer.json | 22 +- app/code/Magento/GoogleAdwords/composer.json | 8 +- .../Magento/GoogleAnalytics/composer.json | 12 +- .../Magento/GoogleOptimizer/composer.json | 16 +- .../Magento/GroupedImportExport/composer.json | 14 +- app/code/Magento/GroupedProduct/composer.json | 30 +-- app/code/Magento/ImportExport/composer.json | 14 +- app/code/Magento/Indexer/composer.json | 6 +- app/code/Magento/Integration/composer.json | 16 +- .../Magento/LayeredNavigation/composer.json | 8 +- app/code/Magento/Marketplace/composer.json | 6 +- app/code/Magento/MediaStorage/composer.json | 10 +- app/code/Magento/Msrp/composer.json | 20 +- app/code/Magento/Multishipping/composer.json | 22 +- .../Magento/NewRelicReporting/composer.json | 16 +- app/code/Magento/Newsletter/composer.json | 20 +- .../Magento/OfflinePayments/composer.json | 10 +- .../Magento/OfflineShipping/composer.json | 26 +- app/code/Magento/PageCache/composer.json | 10 +- app/code/Magento/Payment/composer.json | 16 +- app/code/Magento/Paypal/composer.json | 36 +-- app/code/Magento/Persistent/composer.json | 16 +- app/code/Magento/ProductAlert/composer.json | 14 +- app/code/Magento/ProductVideo/composer.json | 18 +- app/code/Magento/Quote/composer.json | 34 +-- app/code/Magento/QuoteAnalytics/composer.json | 6 +- app/code/Magento/Reports/composer.json | 36 +-- app/code/Magento/RequireJs/composer.json | 4 +- app/code/Magento/Review/composer.json | 24 +- .../Magento/ReviewAnalytics/composer.json | 6 +- app/code/Magento/Robots/composer.json | 44 ++-- app/code/Magento/Rss/composer.json | 10 +- app/code/Magento/Rule/composer.json | 12 +- app/code/Magento/Sales/composer.json | 52 ++-- app/code/Magento/SalesAnalytics/composer.json | 6 +- app/code/Magento/SalesInventory/composer.json | 12 +- app/code/Magento/SalesRule/composer.json | 38 +-- app/code/Magento/SalesSequence/composer.json | 4 +- app/code/Magento/SampleData/composer.json | 6 +- app/code/Magento/Search/composer.json | 14 +- app/code/Magento/Security/composer.json | 10 +- app/code/Magento/SendFriend/composer.json | 10 +- app/code/Magento/Shipping/composer.json | 36 +-- app/code/Magento/Sitemap/composer.json | 24 +- app/code/Magento/Store/composer.json | 16 +- app/code/Magento/Swagger/composer.json | 4 +- app/code/Magento/Swatches/composer.json | 26 +- .../SwatchesLayeredNavigation/composer.json | 4 +- app/code/Magento/Tax/composer.json | 32 +-- .../Magento/TaxImportExport/composer.json | 12 +- app/code/Magento/Theme/composer.json | 32 +-- app/code/Magento/Translation/composer.json | 12 +- app/code/Magento/Ui/composer.json | 14 +- app/code/Magento/Ups/composer.json | 20 +- app/code/Magento/UrlRewrite/composer.json | 16 +- app/code/Magento/User/composer.json | 16 +- app/code/Magento/Usps/composer.json | 20 +- app/code/Magento/Variable/composer.json | 10 +- app/code/Magento/Vault/composer.json | 16 +- app/code/Magento/Version/composer.json | 4 +- app/code/Magento/Webapi/composer.json | 14 +- app/code/Magento/WebapiSecurity/composer.json | 6 +- app/code/Magento/Weee/composer.json | 30 +-- app/code/Magento/Widget/composer.json | 20 +- app/code/Magento/Wishlist/composer.json | 34 +-- .../Magento/WishlistAnalytics/composer.json | 6 +- .../adminhtml/Magento/backend/composer.json | 4 +- .../frontend/Magento/blank/composer.json | 4 +- .../frontend/Magento/luma/composer.json | 6 +- app/i18n/Magento/de_DE/composer.json | 4 +- app/i18n/Magento/en_US/composer.json | 4 +- app/i18n/Magento/es_ES/composer.json | 4 +- app/i18n/Magento/fr_FR/composer.json | 4 +- app/i18n/Magento/nl_NL/composer.json | 4 +- app/i18n/Magento/pt_BR/composer.json | 4 +- app/i18n/Magento/zh_Hans_CN/composer.json | 4 +- composer.json | 248 +++++++++--------- lib/internal/Magento/Framework/composer.json | 2 +- 124 files changed, 1146 insertions(+), 1146 deletions(-) diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index afb820a2e6c93..227837558a8b3 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*", + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*", "lib-libxml": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/AdvancedPricingImportExport/composer.json b/app/code/Magento/AdvancedPricingImportExport/composer.json index 228464ecd6304..acc3e3ead715a 100644 --- a/app/code/Magento/AdvancedPricingImportExport/composer.json +++ b/app/code/Magento/AdvancedPricingImportExport/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-import-export": "100.2.*", - "magento/module-catalog-import-export": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-import-export": "100.3.*", + "magento/module-catalog-import-export": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Analytics/composer.json b/app/code/Magento/Analytics/composer.json index edc3443e487b6..bdea53c445a34 100644 --- a/app/code/Magento/Analytics/composer.json +++ b/app/code/Magento/Analytics/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-backend": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-integration": "100.2.*", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-backend": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-integration": "100.3.*", + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json index a894193888100..5e80365847ce5 100644 --- a/app/code/Magento/Authorization/composer.json +++ b/app/code/Magento/Authorization/composer.json @@ -3,11 +3,11 @@ "description": "Authorization module provides access to Magento ACL functionality.", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Authorizenet/composer.json b/app/code/Magento/Authorizenet/composer.json index 2abfebc3c1cb7..be581500c4020 100644 --- a/app/code/Magento/Authorizenet/composer.json +++ b/app/code/Magento/Authorizenet/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-sales": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/framework": "100.2.*" + "magento/module-sales": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-config": "100.2.*" + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "proprietary" ], diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index d3c94c1e286e0..0b141226f7574 100644 --- a/app/code/Magento/Backend/composer.json +++ b/app/code/Magento/Backend/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-developer": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-reports": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-user": "100.2.*", - "magento/module-security": "100.2.*", - "magento/module-backup": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-translation": "100.2.*", - "magento/module-require-js": "100.2.*", - "magento/module-config": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-developer": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-reports": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-user": "100.3.*", + "magento/module-security": "100.3.*", + "magento/module-backup": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-translation": "100.3.*", + "magento/module-require-js": "100.3.*", + "magento/module-config": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-theme": "100.2.*" + "magento/module-theme": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Backup/composer.json b/app/code/Magento/Backup/composer.json index cc1b13f773480..dc3914a2185a2 100644 --- a/app/code/Magento/Backup/composer.json +++ b/app/code/Magento/Backup/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-cron": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-cron": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Braintree/composer.json b/app/code/Magento/Braintree/composer.json index 67f80ff8dd79a..3e2c9e9c005e6 100644 --- a/app/code/Magento/Braintree/composer.json +++ b/app/code/Magento/Braintree/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", + "magento/framework": "100.3.*", "magento/magento-composer-installer": "*", - "magento/module-config": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-vault": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-quote": "100.2.*", - "magento/module-paypal": "100.2.*", - "magento/module-ui": "100.2.*", + "magento/module-config": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-vault": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-quote": "100.3.*", + "magento/module-paypal": "100.3.*", + "magento/module-ui": "100.3.*", "braintree/braintree_php": "3.22.0" }, "suggest": { - "magento/module-checkout-agreements": "100.2.*", - "magento/module-theme": "100.2.*" + "magento/module-checkout-agreements": "100.3.*", + "magento/module-theme": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "proprietary" ], diff --git a/app/code/Magento/Bundle/composer.json b/app/code/Magento/Bundle/composer.json index a839c110402d5..2b12028882cfd 100644 --- a/app/code/Magento/Bundle/composer.json +++ b/app/code/Magento/Bundle/composer.json @@ -3,29 +3,29 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-tax": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-catalog-rule": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-gift-message": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-tax": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-catalog-rule": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-gift-message": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-ui": "100.3.*" }, "suggest": { - "magento/module-webapi": "100.2.*", - "magento/module-bundle-sample-data": "Sample Data version:100.2.*" + "magento/module-webapi": "100.3.*", + "magento/module-bundle-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/BundleImportExport/composer.json b/app/code/Magento/BundleImportExport/composer.json index 8c45c565785b7..c0193b9eb365f 100644 --- a/app/code/Magento/BundleImportExport/composer.json +++ b/app/code/Magento/BundleImportExport/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-import-export": "100.2.*", - "magento/module-catalog-import-export": "100.2.*", - "magento/module-bundle": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-import-export": "100.3.*", + "magento/module-catalog-import-export": "100.3.*", + "magento/module-bundle": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CacheInvalidate/composer.json b/app/code/Magento/CacheInvalidate/composer.json index feb0466a3744b..c11e55bd448d9 100644 --- a/app/code/Magento/CacheInvalidate/composer.json +++ b/app/code/Magento/CacheInvalidate/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-page-cache": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-page-cache": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Captcha/composer.json b/app/code/Magento/Captcha/composer.json index 08f49a584fbe7..db5ed92fab74b 100644 --- a/app/code/Magento/Captcha/composer.json +++ b/app/code/Magento/Captcha/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-store": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*", "zendframework/zend-db": "^2.8.2", "zendframework/zend-captcha": "^2.7.1", "zendframework/zend-session": "^2.7.3" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index 391d6065fd867..bdf4ac03e2eb6 100644 --- a/app/code/Magento/Catalog/composer.json +++ b/app/code/Magento/Catalog/composer.json @@ -3,38 +3,38 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/module-indexer": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-widget": "100.2.*", - "magento/module-wishlist": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-msrp": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-catalog-rule": "100.2.*", - "magento/module-product-alert": "100.2.*", - "magento/module-url-rewrite": "100.2.*", - "magento/module-catalog-url-rewrite": "100.2.*", - "magento/module-page-cache": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/module-indexer": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-widget": "100.3.*", + "magento/module-wishlist": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-msrp": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-catalog-rule": "100.3.*", + "magento/module-product-alert": "100.3.*", + "magento/module-url-rewrite": "100.3.*", + "magento/module-catalog-url-rewrite": "100.3.*", + "magento/module-page-cache": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "suggest": { - "magento/module-cookie": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-catalog-sample-data": "Sample Data version:100.2.*" + "magento/module-cookie": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-catalog-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "101.1.0-dev", + "version": "101.2.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogAnalytics/composer.json b/app/code/Magento/CatalogAnalytics/composer.json index 6cda52197f80a..35ebf21515875 100644 --- a/app/code/Magento/CatalogAnalytics/composer.json +++ b/app/code/Magento/CatalogAnalytics/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-catalog": "101.1.*" + "magento/framework": "100.3.*", + "magento/module-catalog": "101.2.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json index 120c45a70a5bc..ee7c2e8c41870 100644 --- a/app/code/Magento/CatalogImportExport/composer.json +++ b/app/code/Magento/CatalogImportExport/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-catalog-url-rewrite": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-import-export": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-catalog": "101.2.*", + "magento/module-catalog-url-rewrite": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-import-export": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/framework": "100.3.*", "ext-ctype": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json index 170f28909852c..34df89f295216 100644 --- a/app/code/Magento/CatalogInventory/composer.json +++ b/app/code/Magento/CatalogInventory/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-customer": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-customer": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json index ecd464fdc9fc4..96ab069276c6a 100644 --- a/app/code/Magento/CatalogRule/composer.json +++ b/app/code/Magento/CatalogRule/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-rule": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-customer": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-rule": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-customer": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-import-export": "100.2.*", - "magento/module-catalog-rule-sample-data": "Sample Data version:100.2.*" + "magento/module-import-export": "100.3.*", + "magento/module-catalog-rule-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogRuleConfigurable/composer.json b/app/code/Magento/CatalogRuleConfigurable/composer.json index 7817c2712a299..002606b462d30 100644 --- a/app/code/Magento/CatalogRuleConfigurable/composer.json +++ b/app/code/Magento/CatalogRuleConfigurable/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-configurable-product": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-catalog-rule": "100.2.*", + "magento/module-configurable-product": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-catalog-rule": "100.3.*", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-catalog-rule": "100.2.*" + "magento/module-catalog-rule": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json index 0e328014da0d8..cf93298e1f87f 100644 --- a/app/code/Magento/CatalogSearch/composer.json +++ b/app/code/Magento/CatalogSearch/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-search": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-search": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json index 931e1f26f82e8..a806ce1b454c8 100644 --- a/app/code/Magento/CatalogUrlRewrite/composer.json +++ b/app/code/Magento/CatalogUrlRewrite/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-backend": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-catalog-import-export": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-import-export": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-url-rewrite": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-backend": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-catalog-import-export": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-import-export": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-url-rewrite": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CatalogWidget/composer.json b/app/code/Magento/CatalogWidget/composer.json index 6bd93c6eb188b..76d60c275aa78 100644 --- a/app/code/Magento/CatalogWidget/composer.json +++ b/app/code/Magento/CatalogWidget/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-widget": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-rule": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-wishlist": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-widget": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-rule": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-wishlist": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json index 7dc6a9ae0ffb4..3b1e2918d477a 100644 --- a/app/code/Magento/Checkout/composer.json +++ b/app/code/Magento/Checkout/composer.json @@ -3,31 +3,31 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-payment": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-page-cache": "100.2.*", - "magento/module-sales-rule": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/module-msrp": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/module-quote": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-payment": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-page-cache": "100.3.*", + "magento/module-sales-rule": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/module-msrp": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/module-quote": "100.3.*" }, "suggest": { - "magento/module-cookie": "100.2.*" + "magento/module-cookie": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CheckoutAgreements/composer.json b/app/code/Magento/CheckoutAgreements/composer.json index 9c8232b8534f3..0fb04e84fcb5d 100644 --- a/app/code/Magento/CheckoutAgreements/composer.json +++ b/app/code/Magento/CheckoutAgreements/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-checkout": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-checkout": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cms/composer.json b/app/code/Magento/Cms/composer.json index 7a8651e7948bb..daa5159643f23 100644 --- a/app/code/Magento/Cms/composer.json +++ b/app/code/Magento/Cms/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/module-widget": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-email": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/module-variable": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/module-widget": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-email": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/module-variable": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-cms-sample-data": "Sample Data version:100.2.*" + "magento/module-cms-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "101.1.0-dev", + "version": "101.2.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CmsUrlRewrite/composer.json b/app/code/Magento/CmsUrlRewrite/composer.json index a19d7b262f8c2..a51156b18ab4f 100644 --- a/app/code/Magento/CmsUrlRewrite/composer.json +++ b/app/code/Magento/CmsUrlRewrite/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/module-url-rewrite": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/module-url-rewrite": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Config/composer.json b/app/code/Magento/Config/composer.json index ce4dcc96be187..c3a1d014ac1eb 100644 --- a/app/code/Magento/Config/composer.json +++ b/app/code/Magento/Config/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-cron": "100.2.*", - "magento/module-email": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-deploy": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-cron": "100.3.*", + "magento/module-email": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-deploy": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableImportExport/composer.json b/app/code/Magento/ConfigurableImportExport/composer.json index 08c50e53f81a0..3a7beafe5ed2c 100644 --- a/app/code/Magento/ConfigurableImportExport/composer.json +++ b/app/code/Magento/ConfigurableImportExport/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-catalog-import-export": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-import-export": "100.2.*", - "magento/module-configurable-product": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-catalog-import-export": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-import-export": "100.3.*", + "magento/module-configurable-product": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json index 970fe638cf89e..fef24da4a3594 100644 --- a/app/code/Magento/ConfigurableProduct/composer.json +++ b/app/code/Magento/ConfigurableProduct/composer.json @@ -3,28 +3,28 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-msrp": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-msrp": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-ui": "100.3.*" }, "suggest": { - "magento/module-webapi": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-product-video": "100.2.*", - "magento/module-configurable-sample-data": "Sample Data version:100.2.*", - "magento/module-product-links-sample-data": "Sample Data version:100.2.*" + "magento/module-webapi": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-product-video": "100.3.*", + "magento/module-configurable-sample-data": "Sample Data version:100.3.*", + "magento/module-product-links-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ConfigurableProductSales/composer.json b/app/code/Magento/ConfigurableProductSales/composer.json index acf7b5c191f8a..555ee9a82a6bb 100644 --- a/app/code/Magento/ConfigurableProductSales/composer.json +++ b/app/code/Magento/ConfigurableProductSales/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-sales": "100.2.*", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-sales": "100.3.*", + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-configurable-product": "100.2.*" + "magento/module-configurable-product": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json index 1872856db8d74..72d6c4bc1b5e3 100644 --- a/app/code/Magento/Contact/composer.json +++ b/app/code/Magento/Contact/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cookie/composer.json b/app/code/Magento/Cookie/composer.json index bb10b2c7af1fb..80d0268715773 100644 --- a/app/code/Magento/Cookie/composer.json +++ b/app/code/Magento/Cookie/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-backend": "100.2.*" + "magento/module-backend": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json index d0a9acbac35b9..8277fa0d1b4fb 100644 --- a/app/code/Magento/Cron/composer.json +++ b/app/code/Magento/Cron/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-config": "100.2.*" + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json index 1efea8538e16e..e53db901eb4b7 100644 --- a/app/code/Magento/CurrencySymbol/composer.json +++ b/app/code/Magento/CurrencySymbol/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-page-cache": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-page-cache": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json index a8868c2f15ea1..b62b51935d360 100644 --- a/app/code/Magento/Customer/composer.json +++ b/app/code/Magento/Customer/composer.json @@ -3,33 +3,33 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-newsletter": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-wishlist": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-review": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-page-cache": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-authorization": "100.2.*", - "magento/module-integration": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-quote": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-newsletter": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-wishlist": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-review": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-page-cache": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-authorization": "100.3.*", + "magento/module-integration": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-quote": "100.3.*" }, "suggest": { - "magento/module-cookie": "100.2.*", - "magento/module-customer-sample-data": "Sample Data version:100.2.*" + "magento/module-cookie": "100.3.*", + "magento/module-customer-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CustomerAnalytics/composer.json b/app/code/Magento/CustomerAnalytics/composer.json index 36e7492decc50..199c9b9a1927f 100644 --- a/app/code/Magento/CustomerAnalytics/composer.json +++ b/app/code/Magento/CustomerAnalytics/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-customer": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-customer": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json index e5701887adc71..a874e1c052337 100644 --- a/app/code/Magento/CustomerImportExport/composer.json +++ b/app/code/Magento/CustomerImportExport/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-import-export": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-import-export": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Deploy/composer.json b/app/code/Magento/Deploy/composer.json index 945363bd36401..65d194368d57f 100644 --- a/app/code/Magento/Deploy/composer.json +++ b/app/code/Magento/Deploy/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-require-js": "100.2.*", - "magento/module-user": "100.2.*", - "magento/module-config": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-require-js": "100.3.*", + "magento/module-user": "100.3.*", + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Developer/composer.json b/app/code/Magento/Developer/composer.json index 8deb7275c8683..7d54772bb2af2 100644 --- a/app/code/Magento/Developer/composer.json +++ b/app/code/Magento/Developer/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-config": "100.2.*" + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json index dcf24bda02e70..49875fa220334 100644 --- a/app/code/Magento/Dhl/composer.json +++ b/app/code/Magento/Dhl/composer.json @@ -3,23 +3,23 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*", "lib-libxml": "*" }, "suggest": { - "magento/module-checkout": "100.2.*" + "magento/module-checkout": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json index f7754c6f0a738..a27720ac86275 100644 --- a/app/code/Magento/Directory/composer.json +++ b/app/code/Magento/Directory/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*", "lib-libxml": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json index 7abf19039ad5e..ab27f2ccadc46 100644 --- a/app/code/Magento/Downloadable/composer.json +++ b/app/code/Magento/Downloadable/composer.json @@ -3,29 +3,29 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-customer": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-gift-message": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-customer": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-gift-message": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "suggest": { - "magento/module-downloadable-sample-data": "Sample Data version:100.2.*" + "magento/module-downloadable-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/DownloadableImportExport/composer.json b/app/code/Magento/DownloadableImportExport/composer.json index abd094a37db8e..3c647b2270f3c 100644 --- a/app/code/Magento/DownloadableImportExport/composer.json +++ b/app/code/Magento/DownloadableImportExport/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-import-export": "100.2.*", - "magento/module-catalog-import-export": "100.2.*", - "magento/module-downloadable": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-import-export": "100.3.*", + "magento/module-catalog-import-export": "100.3.*", + "magento/module-downloadable": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json index 84029f18878a0..a9605b987b564 100644 --- a/app/code/Magento/Eav/composer.json +++ b/app/code/Magento/Eav/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-config": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-config": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json index 2a30c94c9899f..f01ce69e4c4be 100644 --- a/app/code/Magento/Email/composer.json +++ b/app/code/Magento/Email/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-theme": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/module-backend": "100.2.*", - "magento/module-variable": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-theme": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/module-backend": "100.3.*", + "magento/module-variable": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-theme": "100.2.*" + "magento/module-theme": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/EncryptionKey/composer.json b/app/code/Magento/EncryptionKey/composer.json index 3b1c700ba9732..644eff1ed579a 100644 --- a/app/code/Magento/EncryptionKey/composer.json +++ b/app/code/Magento/EncryptionKey/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "proprietary" ], diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json index 2d6b5c24584f9..0b98e3204bcfe 100644 --- a/app/code/Magento/Fedex/composer.json +++ b/app/code/Magento/Fedex/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-sales": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-config": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-store": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-sales": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-config": "100.3.*", + "magento/framework": "100.3.*", "lib-libxml": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json index f164d42881fd5..eeb2e7c1c666b 100644 --- a/app/code/Magento/GiftMessage/composer.json +++ b/app/code/Magento/GiftMessage/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-checkout": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-checkout": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "suggest": { - "magento/module-multishipping": "100.2.*" + "magento/module-multishipping": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleAdwords/composer.json b/app/code/Magento/GoogleAdwords/composer.json index ae4554e3f1f29..4b92e931ac7da 100644 --- a/app/code/Magento/GoogleAdwords/composer.json +++ b/app/code/Magento/GoogleAdwords/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleAnalytics/composer.json b/app/code/Magento/GoogleAnalytics/composer.json index d163eda692447..73f6a4298f2ec 100644 --- a/app/code/Magento/GoogleAnalytics/composer.json +++ b/app/code/Magento/GoogleAnalytics/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-cookie": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-cookie": "100.3.*" }, "suggest": { - "magento/module-config": "100.2.*" + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GoogleOptimizer/composer.json b/app/code/Magento/GoogleOptimizer/composer.json index 8461e2b5b7d28..b13bcd44f807a 100644 --- a/app/code/Magento/GoogleOptimizer/composer.json +++ b/app/code/Magento/GoogleOptimizer/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-google-analytics": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-cms": "101.1.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-google-analytics": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-cms": "101.2.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GroupedImportExport/composer.json b/app/code/Magento/GroupedImportExport/composer.json index a3fedcae493cf..e1e26262a38ba 100644 --- a/app/code/Magento/GroupedImportExport/composer.json +++ b/app/code/Magento/GroupedImportExport/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-import-export": "100.2.*", - "magento/module-catalog-import-export": "100.2.*", - "magento/module-grouped-product": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-import-export": "100.3.*", + "magento/module-catalog-import-export": "100.3.*", + "magento/module-grouped-product": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/GroupedProduct/composer.json b/app/code/Magento/GroupedProduct/composer.json index 95173e65dc5c8..61e9f6fe20c9f 100644 --- a/app/code/Magento/GroupedProduct/composer.json +++ b/app/code/Magento/GroupedProduct/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-msrp": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-msrp": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "suggest": { - "magento/module-grouped-product-sample-data": "Sample Data version:100.2.*" + "magento/module-grouped-product-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ImportExport/composer.json b/app/code/Magento/ImportExport/composer.json index 8b37cc0360651..10e3c4b9f2c03 100644 --- a/app/code/Magento/ImportExport/composer.json +++ b/app/code/Magento/ImportExport/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-catalog": "101.2.*", + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/framework": "100.3.*", "ext-ctype": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Indexer/composer.json b/app/code/Magento/Indexer/composer.json index fbbac51bbb700..9d481c3f97189 100644 --- a/app/code/Magento/Indexer/composer.json +++ b/app/code/Magento/Indexer/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Integration/composer.json b/app/code/Magento/Integration/composer.json index 6ded78fbffd80..616c2b0ebb47f 100644 --- a/app/code/Magento/Integration/composer.json +++ b/app/code/Magento/Integration/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-user": "100.2.*", - "magento/module-security": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-authorization": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-user": "100.3.*", + "magento/module-security": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-authorization": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/LayeredNavigation/composer.json b/app/code/Magento/LayeredNavigation/composer.json index d7f900ea1db8f..4d4f791c22b3a 100644 --- a/app/code/Magento/LayeredNavigation/composer.json +++ b/app/code/Magento/LayeredNavigation/composer.json @@ -3,12 +3,12 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Marketplace/composer.json b/app/code/Magento/Marketplace/composer.json index 83ad33e0ff1de..3c9cbc7ca883d 100644 --- a/app/code/Magento/Marketplace/composer.json +++ b/app/code/Magento/Marketplace/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-backend": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-backend": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/MediaStorage/composer.json b/app/code/Magento/MediaStorage/composer.json index 80e154ebc8ef1..83e95e99b1f59 100644 --- a/app/code/Magento/MediaStorage/composer.json +++ b/app/code/Magento/MediaStorage/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-config": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-config": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Msrp/composer.json b/app/code/Magento/Msrp/composer.json index 587bbe88b4101..3cd5f2be5118a 100644 --- a/app/code/Magento/Msrp/composer.json +++ b/app/code/Magento/Msrp/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-downloadable": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-grouped-product": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-downloadable": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-grouped-product": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-bundle": "100.2.*", - "magento/module-msrp-sample-data": "Sample Data version:100.2.*" + "magento/module-bundle": "100.3.*", + "magento/module-msrp-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Multishipping/composer.json b/app/code/Magento/Multishipping/composer.json index 456248065e949..cd55ca26044c3 100644 --- a/app/code/Magento/Multishipping/composer.json +++ b/app/code/Magento/Multishipping/composer.json @@ -3,21 +3,21 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-directory": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-directory": "100.3.*" }, "suggest": { - "magento/module-theme": "100.2.*" + "magento/module-theme": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/NewRelicReporting/composer.json b/app/code/Magento/NewRelicReporting/composer.json index 63ecfc277e42a..2838837de6074 100644 --- a/app/code/Magento/NewRelicReporting/composer.json +++ b/app/code/Magento/NewRelicReporting/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-configurable-product": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-config": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-configurable-product": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-config": "100.3.*", + "magento/framework": "100.3.*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Newsletter/composer.json b/app/code/Magento/Newsletter/composer.json index 04d75de1f6f5c..c4338a58def67 100644 --- a/app/code/Magento/Newsletter/composer.json +++ b/app/code/Magento/Newsletter/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-widget": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/module-email": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-require-js": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-widget": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/module-email": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-require-js": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/OfflinePayments/composer.json b/app/code/Magento/OfflinePayments/composer.json index 1296d5742199d..a640a5450fac2 100644 --- a/app/code/Magento/OfflinePayments/composer.json +++ b/app/code/Magento/OfflinePayments/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-checkout": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-checkout": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-config": "100.2.*" + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/OfflineShipping/composer.json b/app/code/Magento/OfflineShipping/composer.json index a9385effb8986..e5e27779472ca 100644 --- a/app/code/Magento/OfflineShipping/composer.json +++ b/app/code/Magento/OfflineShipping/composer.json @@ -3,23 +3,23 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-sales-rule": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-sales-rule": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-checkout": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-offline-shipping-sample-data": "Sample Data version:100.2.*" + "magento/module-checkout": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-offline-shipping-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/PageCache/composer.json b/app/code/Magento/PageCache/composer.json index 8d4b988a77aa7..d60467dd4439f 100644 --- a/app/code/Magento/PageCache/composer.json +++ b/app/code/Magento/PageCache/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Payment/composer.json b/app/code/Magento/Payment/composer.json index ef58fc5c09ea7..d93adc44de643 100644 --- a/app/code/Magento/Payment/composer.json +++ b/app/code/Magento/Payment/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Paypal/composer.json b/app/code/Magento/Paypal/composer.json index c525fb9293898..dcfba89a5025d 100644 --- a/app/code/Magento/Paypal/composer.json +++ b/app/code/Magento/Paypal/composer.json @@ -3,29 +3,29 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-eav": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/module-vault": "100.2.*", + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-eav": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/module-vault": "100.3.*", "lib-libxml": "*" }, "suggest": { - "magento/module-checkout-agreements": "100.2.*" + "magento/module-checkout-agreements": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "proprietary" ], diff --git a/app/code/Magento/Persistent/composer.json b/app/code/Magento/Persistent/composer.json index 516a1c2b4b8ac..9830dafb1fbbc 100644 --- a/app/code/Magento/Persistent/composer.json +++ b/app/code/Magento/Persistent/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-cron": "100.2.*", - "magento/module-page-cache": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-cron": "100.3.*", + "magento/module-page-cache": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ProductAlert/composer.json b/app/code/Magento/ProductAlert/composer.json index 694fb2dda9560..fd798246760f5 100644 --- a/app/code/Magento/ProductAlert/composer.json +++ b/app/code/Magento/ProductAlert/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-backend": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-customer": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-backend": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-customer": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-config": "100.2.*" + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ProductVideo/composer.json b/app/code/Magento/ProductVideo/composer.json index 9a39534fe3a6c..3a0b607758f1e 100644 --- a/app/code/Magento/ProductVideo/composer.json +++ b/app/code/Magento/ProductVideo/composer.json @@ -3,20 +3,20 @@ "description": "Add Video to Products", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-backend": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-catalog": "101.2.*", + "magento/module-backend": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*", "magento/magento-composer-installer": "*" }, "suggest": { - "magento/module-customer": "100.2.*", - "magento/module-config": "100.2.*" + "magento/module-customer": "100.3.*", + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "proprietary" ], diff --git a/app/code/Magento/Quote/composer.json b/app/code/Magento/Quote/composer.json index f15cb8c72e3bd..9378464b5706f 100644 --- a/app/code/Magento/Quote/composer.json +++ b/app/code/Magento/Quote/composer.json @@ -3,27 +3,27 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-customer": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-authorization": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-sales-sequence": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-customer": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-authorization": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-sales-sequence": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-webapi": "100.2.*" + "magento/module-webapi": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/QuoteAnalytics/composer.json b/app/code/Magento/QuoteAnalytics/composer.json index 7f38e489ab0b0..c683a5e25c889 100644 --- a/app/code/Magento/QuoteAnalytics/composer.json +++ b/app/code/Magento/QuoteAnalytics/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-quote": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-quote": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Reports/composer.json b/app/code/Magento/Reports/composer.json index 55da507c5e04d..16bae6930436d 100644 --- a/app/code/Magento/Reports/composer.json +++ b/app/code/Magento/Reports/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-sales": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/module-backend": "100.2.*", - "magento/module-widget": "100.2.*", - "magento/module-wishlist": "100.2.*", - "magento/module-review": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-downloadable": "100.2.*", - "magento/module-sales-rule": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-sales": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/module-backend": "100.3.*", + "magento/module-widget": "100.3.*", + "magento/module-wishlist": "100.3.*", + "magento/module-review": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-downloadable": "100.3.*", + "magento/module-sales-rule": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/RequireJs/composer.json b/app/code/Magento/RequireJs/composer.json index 093002b35c8a7..21cb7633e4069 100644 --- a/app/code/Magento/RequireJs/composer.json +++ b/app/code/Magento/RequireJs/composer.json @@ -3,10 +3,10 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Review/composer.json b/app/code/Magento/Review/composer.json index 48fe25430f504..f3506c234a825 100644 --- a/app/code/Magento/Review/composer.json +++ b/app/code/Magento/Review/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-customer": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-newsletter": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-customer": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-newsletter": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "suggest": { - "magento/module-cookie": "100.2.*", - "magento/module-review-sample-data": "Sample Data version:100.2.*" + "magento/module-cookie": "100.3.*", + "magento/module-review-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/ReviewAnalytics/composer.json b/app/code/Magento/ReviewAnalytics/composer.json index b31c420e181bf..9f0b58b529a25 100644 --- a/app/code/Magento/ReviewAnalytics/composer.json +++ b/app/code/Magento/ReviewAnalytics/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-review": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-review": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Robots/composer.json b/app/code/Magento/Robots/composer.json index a359918fad7d1..60ea30a751983 100644 --- a/app/code/Magento/Robots/composer.json +++ b/app/code/Magento/Robots/composer.json @@ -1,26 +1,26 @@ { - "name": "magento/module-robots", - "description": "N/A", - "require": { - "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-store": "100.2.*" - }, - "suggest": { - "magento/module-theme": "100.2.*" - }, - "type": "magento2-module", - "version": "100.2.0-dev", - "license": [ - "OSL-3.0", - "AFL-3.0" - ], - "autoload": { - "files": [ - "registration.php" + "name": "magento/module-robots", + "description": "N/A", + "require": { + "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", + "magento/framework": "100.3.*", + "magento/module-store": "100.3.*" + }, + "suggest": { + "magento/module-theme": "100.3.*" + }, + "type": "magento2-module", + "version": "100.3.0-dev", + "license": [ + "OSL-3.0", + "AFL-3.0" ], - "psr-4": { - "Magento\\Robots\\": "" + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\Robots\\": "" + } } - } } diff --git a/app/code/Magento/Rss/composer.json b/app/code/Magento/Rss/composer.json index 2c6223f192439..ce474c6405cb0 100644 --- a/app/code/Magento/Rss/composer.json +++ b/app/code/Magento/Rss/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-customer": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-customer": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Rule/composer.json b/app/code/Magento/Rule/composer.json index 661e73a86de1e..cec3883a4156c 100644 --- a/app/code/Magento/Rule/composer.json +++ b/app/code/Magento/Rule/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-store": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*", "lib-libxml": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sales/composer.json b/app/code/Magento/Sales/composer.json index b4bdf144b42bd..aa13be9d0bb05 100644 --- a/app/code/Magento/Sales/composer.json +++ b/app/code/Magento/Sales/composer.json @@ -3,36 +3,36 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-customer": "100.2.*", - "magento/module-authorization": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/module-sales-rule": "100.2.*", - "magento/module-sales-sequence": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-widget": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-gift-message": "100.2.*", - "magento/module-reports": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-wishlist": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/module-quote": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-customer": "100.3.*", + "magento/module-authorization": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/module-sales-rule": "100.3.*", + "magento/module-sales-sequence": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-widget": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-gift-message": "100.3.*", + "magento/module-reports": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-wishlist": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/module-quote": "100.3.*" }, "suggest": { - "magento/module-sales-sample-data": "Sample Data version:100.2.*" + "magento/module-sales-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SalesAnalytics/composer.json b/app/code/Magento/SalesAnalytics/composer.json index 7c9270a503b0d..e9d1eb7084925 100644 --- a/app/code/Magento/SalesAnalytics/composer.json +++ b/app/code/Magento/SalesAnalytics/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-sales": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-sales": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SalesInventory/composer.json b/app/code/Magento/SalesInventory/composer.json index 133b85be72983..26508eb7c3d45 100644 --- a/app/code/Magento/SalesInventory/composer.json +++ b/app/code/Magento/SalesInventory/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/framework": "100.2.*" + "magento/module-catalog-inventory": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SalesRule/composer.json b/app/code/Magento/SalesRule/composer.json index 92dd3757e89d1..321dd0569a463 100644 --- a/app/code/Magento/SalesRule/composer.json +++ b/app/code/Magento/SalesRule/composer.json @@ -3,29 +3,29 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-rule": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-sales": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/module-reports": "100.2.*", - "magento/module-catalog-rule": "100.2.*", - "magento/module-widget": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-rule": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-sales": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/module-reports": "100.3.*", + "magento/module-catalog-rule": "100.3.*", + "magento/module-widget": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-sales-rule-sample-data": "Sample Data version:100.2.*" + "magento/module-sales-rule-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SalesSequence/composer.json b/app/code/Magento/SalesSequence/composer.json index 7a203bca4e7aa..4d85e90ac9650 100644 --- a/app/code/Magento/SalesSequence/composer.json +++ b/app/code/Magento/SalesSequence/composer.json @@ -3,10 +3,10 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SampleData/composer.json b/app/code/Magento/SampleData/composer.json index 6a43300485240..204d1ae4d0491 100644 --- a/app/code/Magento/SampleData/composer.json +++ b/app/code/Magento/SampleData/composer.json @@ -3,13 +3,13 @@ "description": "Sample Data fixtures", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "suggest": { - "magento/sample-data-media": "Sample Data version:100.2.*" + "magento/sample-data-media": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Search/composer.json b/app/code/Magento/Search/composer.json index 453e749f183ad..370c82f237c05 100644 --- a/app/code/Magento/Search/composer.json +++ b/app/code/Magento/Search/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-catalog-search": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-reports": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-catalog-search": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-reports": "100.3.*", + "magento/module-ui": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Security/composer.json b/app/code/Magento/Security/composer.json index 853bf50dd38d5..2c4ab541d4112 100644 --- a/app/code/Magento/Security/composer.json +++ b/app/code/Magento/Security/composer.json @@ -3,15 +3,15 @@ "description": "Security management module", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-backend": "100.2.*", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-backend": "100.3.*", + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-customer": "100.2.*" + "magento/module-customer": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/SendFriend/composer.json b/app/code/Magento/SendFriend/composer.json index c4d6860420f99..cc7dc8907449d 100644 --- a/app/code/Magento/SendFriend/composer.json +++ b/app/code/Magento/SendFriend/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-customer": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-customer": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Shipping/composer.json b/app/code/Magento/Shipping/composer.json index 8922e286238aa..99c649abbd4fc 100644 --- a/app/code/Magento/Shipping/composer.json +++ b/app/code/Magento/Shipping/composer.json @@ -3,29 +3,29 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-sales": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-contact": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/module-tax": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-user": "100.2.*", + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-sales": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-contact": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/module-tax": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-user": "100.3.*", "ext-gd": "*" }, "suggest": { - "magento/module-fedex": "100.2.*", - "magento/module-ups": "100.2.*", - "magento/module-config": "100.2.*" + "magento/module-fedex": "100.3.*", + "magento/module-ups": "100.3.*", + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Sitemap/composer.json b/app/code/Magento/Sitemap/composer.json index d5e7b41a72add..ae92c87b2a425 100644 --- a/app/code/Magento/Sitemap/composer.json +++ b/app/code/Magento/Sitemap/composer.json @@ -3,22 +3,22 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-eav": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/module-backend": "100.2.*", - "magento/module-catalog-url-rewrite": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-robots": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-eav": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/module-backend": "100.3.*", + "magento/module-catalog-url-rewrite": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-robots": "100.3.*" }, "suggest": { - "magento/module-config": "100.2.*" + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Store/composer.json b/app/code/Magento/Store/composer.json index 08166068b743b..f2ebfa675c158 100644 --- a/app/code/Magento/Store/composer.json +++ b/app/code/Magento/Store/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-directory": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-directory": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-deploy": "100.2.*" + "magento/module-deploy": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Swagger/composer.json b/app/code/Magento/Swagger/composer.json index c49e3e6bffb6f..fc6325e55de0f 100644 --- a/app/code/Magento/Swagger/composer.json +++ b/app/code/Magento/Swagger/composer.json @@ -3,10 +3,10 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Swatches/composer.json b/app/code/Magento/Swatches/composer.json index 1ea213d10804a..02b55515cd357 100644 --- a/app/code/Magento/Swatches/composer.json +++ b/app/code/Magento/Swatches/composer.json @@ -3,23 +3,23 @@ "description": "Add Swatches to Products", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-configurable-product": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-configurable-product": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-layered-navigation": "100.2.*", - "magento/module-swatches-sample-data": "Sample Data version:100.2.*" + "magento/module-layered-navigation": "100.3.*", + "magento/module-swatches-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "proprietary" ], diff --git a/app/code/Magento/SwatchesLayeredNavigation/composer.json b/app/code/Magento/SwatchesLayeredNavigation/composer.json index 1e763bc552bfd..efcf164cbb351 100644 --- a/app/code/Magento/SwatchesLayeredNavigation/composer.json +++ b/app/code/Magento/SwatchesLayeredNavigation/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", + "magento/framework": "100.3.*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Tax/composer.json b/app/code/Magento/Tax/composer.json index a2cbab1fffbac..6041b428d9845 100644 --- a/app/code/Magento/Tax/composer.json +++ b/app/code/Magento/Tax/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-config": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-customer": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-reports": "100.2.*", - "magento/module-page-cache": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-config": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-customer": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-reports": "100.3.*", + "magento/module-page-cache": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-tax-sample-data": "Sample Data version:100.2.*" + "magento/module-tax-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/TaxImportExport/composer.json b/app/code/Magento/TaxImportExport/composer.json index 2f9798999a890..0c8960e2e5943 100644 --- a/app/code/Magento/TaxImportExport/composer.json +++ b/app/code/Magento/TaxImportExport/composer.json @@ -3,14 +3,14 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-tax": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-tax": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Theme/composer.json b/app/code/Magento/Theme/composer.json index 21979ba583df1..e711a4cbdc75c 100644 --- a/app/code/Magento/Theme/composer.json +++ b/app/code/Magento/Theme/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/module-eav": "100.2.*", - "magento/module-widget": "100.2.*", - "magento/module-config": "100.2.*", - "magento/module-media-storage": "100.2.*", - "magento/module-ui": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-require-js": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/module-eav": "100.3.*", + "magento/module-widget": "100.3.*", + "magento/module-config": "100.3.*", + "magento/module-media-storage": "100.3.*", + "magento/module-ui": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-require-js": "100.3.*" }, "suggest": { - "magento/module-translation": "100.2.*", - "magento/module-theme-sample-data": "Sample Data version:100.2.*", - "magento/module-deploy": "100.2.*", - "magento/module-directory": "100.2.*" + "magento/module-translation": "100.3.*", + "magento/module-theme-sample-data": "Sample Data version:100.3.*", + "magento/module-deploy": "100.3.*", + "magento/module-directory": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Translation/composer.json b/app/code/Magento/Translation/composer.json index 475abede960e0..178fe20c052c9 100644 --- a/app/code/Magento/Translation/composer.json +++ b/app/code/Magento/Translation/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-backend": "100.2.*", - "magento/module-developer": "100.2.*", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-backend": "100.3.*", + "magento/module-developer": "100.3.*", + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-deploy": "100.2.*" + "magento/module-deploy": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Ui/composer.json b/app/code/Magento/Ui/composer.json index 281a765141cf4..711c1b7e2acea 100644 --- a/app/code/Magento/Ui/composer.json +++ b/app/code/Magento/Ui/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-authorization": "100.2.*", - "magento/module-user": "100.2.*" + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-authorization": "100.3.*", + "magento/module-user": "100.3.*" }, "suggest": { - "magento/module-config": "100.2.*" + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Ups/composer.json b/app/code/Magento/Ups/composer.json index 90ec2a62b89c5..3a6ee38593717 100644 --- a/app/code/Magento/Ups/composer.json +++ b/app/code/Magento/Ups/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-config": "100.2.*" + "magento/module-config": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/UrlRewrite/composer.json b/app/code/Magento/UrlRewrite/composer.json index 87e033e994159..b848111d30c0a 100644 --- a/app/code/Magento/UrlRewrite/composer.json +++ b/app/code/Magento/UrlRewrite/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-catalog": "101.1.*", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-catalog-url-rewrite": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/module-cms-url-rewrite": "100.2.*" + "magento/module-catalog": "101.2.*", + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-catalog-url-rewrite": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/module-cms-url-rewrite": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/User/composer.json b/app/code/Magento/User/composer.json index 38e4061250c9a..d2a5faf4b2955 100644 --- a/app/code/Magento/User/composer.json +++ b/app/code/Magento/User/composer.json @@ -3,16 +3,16 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-authorization": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-security": "100.2.*", - "magento/module-integration": "100.2.*", - "magento/module-email": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-authorization": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-security": "100.3.*", + "magento/module-integration": "100.3.*", + "magento/module-email": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Usps/composer.json b/app/code/Magento/Usps/composer.json index 4b598813f0722..40eb87d8caf76 100644 --- a/app/code/Magento/Usps/composer.json +++ b/app/code/Magento/Usps/composer.json @@ -3,19 +3,19 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-shipping": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-sales": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-config": "100.2.*", - "magento/framework": "100.2.*", + "magento/module-store": "100.3.*", + "magento/module-shipping": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-sales": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-config": "100.3.*", + "magento/framework": "100.3.*", "lib-libxml": "*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Variable/composer.json b/app/code/Magento/Variable/composer.json index 19529620dc8e5..cd1e1d27ba83d 100644 --- a/app/code/Magento/Variable/composer.json +++ b/app/code/Magento/Variable/composer.json @@ -3,13 +3,13 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-backend": "100.2.*", - "magento/module-email": "100.2.*", - "magento/module-store": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-backend": "100.3.*", + "magento/module-email": "100.3.*", + "magento/module-store": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Vault/composer.json b/app/code/Magento/Vault/composer.json index bb398cf63c5d1..68cb94bac7634 100644 --- a/app/code/Magento/Vault/composer.json +++ b/app/code/Magento/Vault/composer.json @@ -3,16 +3,16 @@ "description": "", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-store": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/module-payment": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-quote": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-store": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/module-payment": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-quote": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "proprietary" ], diff --git a/app/code/Magento/Version/composer.json b/app/code/Magento/Version/composer.json index f12e3e8cb7167..8a39a9bf2eb8f 100644 --- a/app/code/Magento/Version/composer.json +++ b/app/code/Magento/Version/composer.json @@ -3,10 +3,10 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Webapi/composer.json b/app/code/Magento/Webapi/composer.json index 13f4f45eb878b..47de350d7ef70 100644 --- a/app/code/Magento/Webapi/composer.json +++ b/app/code/Magento/Webapi/composer.json @@ -3,17 +3,17 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-authorization": "100.2.*", - "magento/module-integration": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-authorization": "100.3.*", + "magento/module-integration": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/framework": "100.3.*" }, "suggest": { - "magento/module-user": "100.2.*" + "magento/module-user": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/WebapiSecurity/composer.json b/app/code/Magento/WebapiSecurity/composer.json index 4573837852276..0a4bfaa3756cc 100644 --- a/app/code/Magento/WebapiSecurity/composer.json +++ b/app/code/Magento/WebapiSecurity/composer.json @@ -3,11 +3,11 @@ "description": "WebapiSecurity module provides option to loosen security on some webapi resources.", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-webapi": "100.2.*", - "magento/framework": "100.2.*" + "magento/module-webapi": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Weee/composer.json b/app/code/Magento/Weee/composer.json index 29cf6d149b41d..3d96c187ebca9 100644 --- a/app/code/Magento/Weee/composer.json +++ b/app/code/Magento/Weee/composer.json @@ -3,25 +3,25 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-tax": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-directory": "100.2.*", - "magento/module-eav": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-page-cache": "100.2.*", - "magento/module-quote": "100.2.*", - "magento/module-checkout": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-tax": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-directory": "100.3.*", + "magento/module-eav": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-page-cache": "100.3.*", + "magento/module-quote": "100.3.*", + "magento/module-checkout": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "suggest": { - "magento/module-bundle": "100.2.*" + "magento/module-bundle": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Widget/composer.json b/app/code/Magento/Widget/composer.json index f953076eaec69..f0662f66f8ef7 100644 --- a/app/code/Magento/Widget/composer.json +++ b/app/code/Magento/Widget/composer.json @@ -3,20 +3,20 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-cms": "101.1.*", - "magento/module-backend": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-email": "100.2.*", - "magento/module-theme": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-variable": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-cms": "101.2.*", + "magento/module-backend": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-email": "100.3.*", + "magento/module-theme": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-variable": "100.3.*" }, "suggest": { - "magento/module-widget-sample-data": "Sample Data version:100.2.*" + "magento/module-widget-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/Wishlist/composer.json b/app/code/Magento/Wishlist/composer.json index ac6554d3c5fa8..cb636316ed776 100644 --- a/app/code/Magento/Wishlist/composer.json +++ b/app/code/Magento/Wishlist/composer.json @@ -3,27 +3,27 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/module-store": "100.2.*", - "magento/module-customer": "100.2.*", - "magento/module-catalog": "101.1.*", - "magento/module-checkout": "100.2.*", - "magento/module-catalog-inventory": "100.2.*", - "magento/module-rss": "100.2.*", - "magento/module-backend": "100.2.*", - "magento/module-sales": "100.2.*", - "magento/framework": "100.2.*", - "magento/module-ui": "100.2.*" + "magento/module-store": "100.3.*", + "magento/module-customer": "100.3.*", + "magento/module-catalog": "101.2.*", + "magento/module-checkout": "100.3.*", + "magento/module-catalog-inventory": "100.3.*", + "magento/module-rss": "100.3.*", + "magento/module-backend": "100.3.*", + "magento/module-sales": "100.3.*", + "magento/framework": "100.3.*", + "magento/module-ui": "100.3.*" }, "suggest": { - "magento/module-configurable-product": "100.2.*", - "magento/module-downloadable": "100.2.*", - "magento/module-bundle": "100.2.*", - "magento/module-cookie": "100.2.*", - "magento/module-grouped-product": "100.2.*", - "magento/module-wishlist-sample-data": "Sample Data version:100.2.*" + "magento/module-configurable-product": "100.3.*", + "magento/module-downloadable": "100.3.*", + "magento/module-bundle": "100.3.*", + "magento/module-cookie": "100.3.*", + "magento/module-grouped-product": "100.3.*", + "magento/module-wishlist-sample-data": "Sample Data version:100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/code/Magento/WishlistAnalytics/composer.json b/app/code/Magento/WishlistAnalytics/composer.json index 20f414c00c320..8a3fb3a5189d0 100644 --- a/app/code/Magento/WishlistAnalytics/composer.json +++ b/app/code/Magento/WishlistAnalytics/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*", - "magento/module-wishlist": "100.2.*" + "magento/framework": "100.3.*", + "magento/module-wishlist": "100.3.*" }, "type": "magento2-module", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/adminhtml/Magento/backend/composer.json b/app/design/adminhtml/Magento/backend/composer.json index 79ea84474fe29..9556e4607a8e9 100644 --- a/app/design/adminhtml/Magento/backend/composer.json +++ b/app/design/adminhtml/Magento/backend/composer.json @@ -3,10 +3,10 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-theme", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/frontend/Magento/blank/composer.json b/app/design/frontend/Magento/blank/composer.json index 03d38590071f6..de7e2a89f97bb 100644 --- a/app/design/frontend/Magento/blank/composer.json +++ b/app/design/frontend/Magento/blank/composer.json @@ -3,10 +3,10 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-theme", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/design/frontend/Magento/luma/composer.json b/app/design/frontend/Magento/luma/composer.json index 400e923d446a1..c23b5dbe6894b 100644 --- a/app/design/frontend/Magento/luma/composer.json +++ b/app/design/frontend/Magento/luma/composer.json @@ -3,11 +3,11 @@ "description": "N/A", "require": { "php": "7.0.2|7.0.4|~7.0.6|~7.1.0", - "magento/theme-frontend-blank": "100.2.*", - "magento/framework": "100.2.*" + "magento/theme-frontend-blank": "100.3.*", + "magento/framework": "100.3.*" }, "type": "magento2-theme", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" diff --git a/app/i18n/Magento/de_DE/composer.json b/app/i18n/Magento/de_DE/composer.json index 49029b06c2fec..aa7c32f61a84d 100644 --- a/app/i18n/Magento/de_DE/composer.json +++ b/app/i18n/Magento/de_DE/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-de_de", "description": "German (Germany) language", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-language", "autoload": { diff --git a/app/i18n/Magento/en_US/composer.json b/app/i18n/Magento/en_US/composer.json index 73be2ed8ddd7c..ec7b9d4805d07 100644 --- a/app/i18n/Magento/en_US/composer.json +++ b/app/i18n/Magento/en_US/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-en_us", "description": "English (United States) language", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-language", "autoload": { diff --git a/app/i18n/Magento/es_ES/composer.json b/app/i18n/Magento/es_ES/composer.json index 1403990ed8f62..f3834bbdf5ad3 100644 --- a/app/i18n/Magento/es_ES/composer.json +++ b/app/i18n/Magento/es_ES/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-es_es", "description": "Spanish (Spain) language", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-language", "autoload": { diff --git a/app/i18n/Magento/fr_FR/composer.json b/app/i18n/Magento/fr_FR/composer.json index fbb3608386704..a3703a8c216bc 100644 --- a/app/i18n/Magento/fr_FR/composer.json +++ b/app/i18n/Magento/fr_FR/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-fr_fr", "description": "French (France) language", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-language", "autoload": { diff --git a/app/i18n/Magento/nl_NL/composer.json b/app/i18n/Magento/nl_NL/composer.json index 54cff8f4dbd0a..8ea5b3f013428 100644 --- a/app/i18n/Magento/nl_NL/composer.json +++ b/app/i18n/Magento/nl_NL/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-nl_nl", "description": "Dutch (Netherlands) language", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-language", "autoload": { diff --git a/app/i18n/Magento/pt_BR/composer.json b/app/i18n/Magento/pt_BR/composer.json index f758005cda9f8..681c4978176fe 100644 --- a/app/i18n/Magento/pt_BR/composer.json +++ b/app/i18n/Magento/pt_BR/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-pt_br", "description": "Portuguese (Brazil) language", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-language", "autoload": { diff --git a/app/i18n/Magento/zh_Hans_CN/composer.json b/app/i18n/Magento/zh_Hans_CN/composer.json index f125443ca48cd..91e6f86901984 100644 --- a/app/i18n/Magento/zh_Hans_CN/composer.json +++ b/app/i18n/Magento/zh_Hans_CN/composer.json @@ -1,13 +1,13 @@ { "name": "magento/language-zh_hans_cn", "description": "Chinese (China) language", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" ], "require": { - "magento/framework": "100.2.*" + "magento/framework": "100.3.*" }, "type": "magento2-language", "autoload": { diff --git a/composer.json b/composer.json index 722a98baa63d2..f2fc0f9744622 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/magento2ce", "description": "Magento 2 (Community Edition)", "type": "project", - "version": "2.2.0-dev", + "version": "2.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" @@ -83,129 +83,129 @@ "sebastian/phpcpd": "2.0.4" }, "replace": { - "magento/module-marketplace": "100.2.0-dev", - "magento/module-admin-notification": "100.2.0-dev", - "magento/module-advanced-pricing-import-export": "100.2.0-dev", - "magento/module-analytics": "100.2.0-dev", - "magento/module-authorization": "100.2.0-dev", - "magento/module-authorizenet": "100.2.0-dev", - "magento/module-backend": "100.2.0-dev", - "magento/module-backup": "100.2.0-dev", - "magento/module-braintree": "100.2.0-dev", - "magento/module-bundle": "100.2.0-dev", - "magento/module-bundle-import-export": "100.2.0-dev", - "magento/module-cache-invalidate": "100.2.0-dev", - "magento/module-captcha": "100.2.0-dev", - "magento/module-catalog": "101.1.0-dev", - "magento/module-catalog-analytics": "100.2.0-dev", - "magento/module-catalog-import-export": "100.2.0-dev", - "magento/module-catalog-inventory": "100.2.0-dev", - "magento/module-catalog-rule": "100.2.0-dev", - "magento/module-catalog-rule-configurable": "100.2.0-dev", - "magento/module-catalog-search": "100.2.0-dev", - "magento/module-catalog-url-rewrite": "100.2.0-dev", - "magento/module-catalog-widget": "100.2.0-dev", - "magento/module-checkout": "100.2.0-dev", - "magento/module-checkout-agreements": "100.2.0-dev", - "magento/module-cms": "101.1.0-dev", - "magento/module-cms-url-rewrite": "100.2.0-dev", - "magento/module-config": "100.2.0-dev", - "magento/module-configurable-import-export": "100.2.0-dev", - "magento/module-configurable-product": "100.2.0-dev", - "magento/module-configurable-product-sales": "100.2.0-dev", - "magento/module-contact": "100.2.0-dev", - "magento/module-cookie": "100.2.0-dev", - "magento/module-cron": "100.2.0-dev", - "magento/module-currency-symbol": "100.2.0-dev", - "magento/module-customer": "100.2.0-dev", - "magento/module-customer-analytics": "100.2.0-dev", - "magento/module-customer-import-export": "100.2.0-dev", - "magento/module-deploy": "100.2.0-dev", - "magento/module-developer": "100.2.0-dev", - "magento/module-dhl": "100.2.0-dev", - "magento/module-directory": "100.2.0-dev", - "magento/module-downloadable": "100.2.0-dev", - "magento/module-downloadable-import-export": "100.2.0-dev", - "magento/module-eav": "100.2.0-dev", - "magento/module-email": "100.2.0-dev", - "magento/module-encryption-key": "100.2.0-dev", - "magento/module-fedex": "100.2.0-dev", - "magento/module-gift-message": "100.2.0-dev", - "magento/module-google-adwords": "100.2.0-dev", - "magento/module-google-analytics": "100.2.0-dev", - "magento/module-google-optimizer": "100.2.0-dev", - "magento/module-grouped-import-export": "100.2.0-dev", - "magento/module-grouped-product": "100.2.0-dev", - "magento/module-import-export": "100.2.0-dev", - "magento/module-indexer": "100.2.0-dev", - "magento/module-integration": "100.2.0-dev", - "magento/module-layered-navigation": "100.2.0-dev", - "magento/module-media-storage": "100.2.0-dev", - "magento/module-msrp": "100.2.0-dev", - "magento/module-multishipping": "100.2.0-dev", - "magento/module-new-relic-reporting": "100.2.0-dev", - "magento/module-newsletter": "100.2.0-dev", - "magento/module-offline-payments": "100.2.0-dev", - "magento/module-offline-shipping": "100.2.0-dev", - "magento/module-page-cache": "100.2.0-dev", - "magento/module-payment": "100.2.0-dev", - "magento/module-paypal": "100.2.0-dev", - "magento/module-persistent": "100.2.0-dev", - "magento/module-product-alert": "100.2.0-dev", - "magento/module-product-video": "100.2.0-dev", - "magento/module-quote": "100.2.0-dev", - "magento/module-quote-analytics": "100.2.0-dev", - "magento/module-reports": "100.2.0-dev", - "magento/module-require-js": "100.2.0-dev", - "magento/module-review": "100.2.0-dev", - "magento/module-review-analytics": "100.2.0-dev", - "magento/module-robots": "100.2.0-dev", - "magento/module-rss": "100.2.0-dev", - "magento/module-rule": "100.2.0-dev", - "magento/module-sales": "100.2.0-dev", - "magento/module-sales-analytics": "100.2.0-dev", - "magento/module-sales-inventory": "100.2.0-dev", - "magento/module-sales-rule": "100.2.0-dev", - "magento/module-sales-sequence": "100.2.0-dev", - "magento/module-sample-data": "100.2.0-dev", - "magento/module-search": "100.2.0-dev", - "magento/module-security": "100.2.0-dev", - "magento/module-send-friend": "100.2.0-dev", - "magento/module-shipping": "100.2.0-dev", - "magento/module-sitemap": "100.2.0-dev", - "magento/module-store": "100.2.0-dev", - "magento/module-swagger": "100.2.0-dev", - "magento/module-swatches": "100.2.0-dev", - "magento/module-swatches-layered-navigation": "100.2.0-dev", - "magento/module-tax": "100.2.0-dev", - "magento/module-tax-import-export": "100.2.0-dev", - "magento/module-theme": "100.2.0-dev", - "magento/module-translation": "100.2.0-dev", - "magento/module-ui": "100.2.0-dev", - "magento/module-ups": "100.2.0-dev", - "magento/module-url-rewrite": "100.2.0-dev", - "magento/module-user": "100.2.0-dev", - "magento/module-usps": "100.2.0-dev", - "magento/module-variable": "100.2.0-dev", - "magento/module-vault": "100.2.0-dev", - "magento/module-version": "100.2.0-dev", - "magento/module-webapi": "100.2.0-dev", - "magento/module-webapi-security": "100.2.0-dev", - "magento/module-weee": "100.2.0-dev", - "magento/module-widget": "100.2.0-dev", - "magento/module-wishlist": "100.2.0-dev", - "magento/module-wishlist-analytics": "100.2.0-dev", - "magento/theme-adminhtml-backend": "100.2.0-dev", - "magento/theme-frontend-blank": "100.2.0-dev", - "magento/theme-frontend-luma": "100.2.0-dev", - "magento/language-de_de": "100.2.0-dev", - "magento/language-en_us": "100.2.0-dev", - "magento/language-es_es": "100.2.0-dev", - "magento/language-fr_fr": "100.2.0-dev", - "magento/language-nl_nl": "100.2.0-dev", - "magento/language-pt_br": "100.2.0-dev", - "magento/language-zh_hans_cn": "100.2.0-dev", - "magento/framework": "100.2.0-dev", + "magento/module-marketplace": "100.3.0-dev", + "magento/module-admin-notification": "100.3.0-dev", + "magento/module-advanced-pricing-import-export": "100.3.0-dev", + "magento/module-analytics": "100.3.0-dev", + "magento/module-authorization": "100.3.0-dev", + "magento/module-authorizenet": "100.3.0-dev", + "magento/module-backend": "100.3.0-dev", + "magento/module-backup": "100.3.0-dev", + "magento/module-braintree": "100.3.0-dev", + "magento/module-bundle": "100.3.0-dev", + "magento/module-bundle-import-export": "100.3.0-dev", + "magento/module-cache-invalidate": "100.3.0-dev", + "magento/module-captcha": "100.3.0-dev", + "magento/module-catalog": "101.2.0-dev", + "magento/module-catalog-analytics": "100.3.0-dev", + "magento/module-catalog-import-export": "100.3.0-dev", + "magento/module-catalog-inventory": "100.3.0-dev", + "magento/module-catalog-rule": "100.3.0-dev", + "magento/module-catalog-rule-configurable": "100.3.0-dev", + "magento/module-catalog-search": "100.3.0-dev", + "magento/module-catalog-url-rewrite": "100.3.0-dev", + "magento/module-catalog-widget": "100.3.0-dev", + "magento/module-checkout": "100.3.0-dev", + "magento/module-checkout-agreements": "100.3.0-dev", + "magento/module-cms": "101.2.0-dev", + "magento/module-cms-url-rewrite": "100.3.0-dev", + "magento/module-config": "100.3.0-dev", + "magento/module-configurable-import-export": "100.3.0-dev", + "magento/module-configurable-product": "100.3.0-dev", + "magento/module-configurable-product-sales": "100.3.0-dev", + "magento/module-contact": "100.3.0-dev", + "magento/module-cookie": "100.3.0-dev", + "magento/module-cron": "100.3.0-dev", + "magento/module-currency-symbol": "100.3.0-dev", + "magento/module-customer": "100.3.0-dev", + "magento/module-customer-analytics": "100.3.0-dev", + "magento/module-customer-import-export": "100.3.0-dev", + "magento/module-deploy": "100.3.0-dev", + "magento/module-developer": "100.3.0-dev", + "magento/module-dhl": "100.3.0-dev", + "magento/module-directory": "100.3.0-dev", + "magento/module-downloadable": "100.3.0-dev", + "magento/module-downloadable-import-export": "100.3.0-dev", + "magento/module-eav": "100.3.0-dev", + "magento/module-email": "100.3.0-dev", + "magento/module-encryption-key": "100.3.0-dev", + "magento/module-fedex": "100.3.0-dev", + "magento/module-gift-message": "100.3.0-dev", + "magento/module-google-adwords": "100.3.0-dev", + "magento/module-google-analytics": "100.3.0-dev", + "magento/module-google-optimizer": "100.3.0-dev", + "magento/module-grouped-import-export": "100.3.0-dev", + "magento/module-grouped-product": "100.3.0-dev", + "magento/module-import-export": "100.3.0-dev", + "magento/module-indexer": "100.3.0-dev", + "magento/module-integration": "100.3.0-dev", + "magento/module-layered-navigation": "100.3.0-dev", + "magento/module-media-storage": "100.3.0-dev", + "magento/module-msrp": "100.3.0-dev", + "magento/module-multishipping": "100.3.0-dev", + "magento/module-new-relic-reporting": "100.3.0-dev", + "magento/module-newsletter": "100.3.0-dev", + "magento/module-offline-payments": "100.3.0-dev", + "magento/module-offline-shipping": "100.3.0-dev", + "magento/module-page-cache": "100.3.0-dev", + "magento/module-payment": "100.3.0-dev", + "magento/module-paypal": "100.3.0-dev", + "magento/module-persistent": "100.3.0-dev", + "magento/module-product-alert": "100.3.0-dev", + "magento/module-product-video": "100.3.0-dev", + "magento/module-quote": "100.3.0-dev", + "magento/module-quote-analytics": "100.3.0-dev", + "magento/module-reports": "100.3.0-dev", + "magento/module-require-js": "100.3.0-dev", + "magento/module-review": "100.3.0-dev", + "magento/module-review-analytics": "100.3.0-dev", + "magento/module-robots": "100.3.0-dev", + "magento/module-rss": "100.3.0-dev", + "magento/module-rule": "100.3.0-dev", + "magento/module-sales": "100.3.0-dev", + "magento/module-sales-analytics": "100.3.0-dev", + "magento/module-sales-inventory": "100.3.0-dev", + "magento/module-sales-rule": "100.3.0-dev", + "magento/module-sales-sequence": "100.3.0-dev", + "magento/module-sample-data": "100.3.0-dev", + "magento/module-search": "100.3.0-dev", + "magento/module-security": "100.3.0-dev", + "magento/module-send-friend": "100.3.0-dev", + "magento/module-shipping": "100.3.0-dev", + "magento/module-sitemap": "100.3.0-dev", + "magento/module-store": "100.3.0-dev", + "magento/module-swagger": "100.3.0-dev", + "magento/module-swatches": "100.3.0-dev", + "magento/module-swatches-layered-navigation": "100.3.0-dev", + "magento/module-tax": "100.3.0-dev", + "magento/module-tax-import-export": "100.3.0-dev", + "magento/module-theme": "100.3.0-dev", + "magento/module-translation": "100.3.0-dev", + "magento/module-ui": "100.3.0-dev", + "magento/module-ups": "100.3.0-dev", + "magento/module-url-rewrite": "100.3.0-dev", + "magento/module-user": "100.3.0-dev", + "magento/module-usps": "100.3.0-dev", + "magento/module-variable": "100.3.0-dev", + "magento/module-vault": "100.3.0-dev", + "magento/module-version": "100.3.0-dev", + "magento/module-webapi": "100.3.0-dev", + "magento/module-webapi-security": "100.3.0-dev", + "magento/module-weee": "100.3.0-dev", + "magento/module-widget": "100.3.0-dev", + "magento/module-wishlist": "100.3.0-dev", + "magento/module-wishlist-analytics": "100.3.0-dev", + "magento/theme-adminhtml-backend": "100.3.0-dev", + "magento/theme-frontend-blank": "100.3.0-dev", + "magento/theme-frontend-luma": "100.3.0-dev", + "magento/language-de_de": "100.3.0-dev", + "magento/language-en_us": "100.3.0-dev", + "magento/language-es_es": "100.3.0-dev", + "magento/language-fr_fr": "100.3.0-dev", + "magento/language-nl_nl": "100.3.0-dev", + "magento/language-pt_br": "100.3.0-dev", + "magento/language-zh_hans_cn": "100.3.0-dev", + "magento/framework": "100.3.0-dev", "trentrichardson/jquery-timepicker-addon": "1.4.3", "components/jquery": "1.11.0", "blueimp/jquery-file-upload": "5.6.14", diff --git a/lib/internal/Magento/Framework/composer.json b/lib/internal/Magento/Framework/composer.json index f9300ecfef6c9..edc36de95ddd4 100644 --- a/lib/internal/Magento/Framework/composer.json +++ b/lib/internal/Magento/Framework/composer.json @@ -2,7 +2,7 @@ "name": "magento/framework", "description": "N/A", "type": "magento2-library", - "version": "100.2.0-dev", + "version": "100.3.0-dev", "license": [ "OSL-3.0", "AFL-3.0" From 29508d602db7020efbb290b05abb81b87e78c49c Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Fri, 28 Jul 2017 15:31:34 -0500 Subject: [PATCH 0393/1004] MAGETWO-71052: 2.3 version bump - generating composer.lock --- composer.lock | 235 +++++++++++++++++++++++++------------------------- 1 file changed, 117 insertions(+), 118 deletions(-) diff --git a/composer.lock b/composer.lock index 051d5e718cb84..9d6216c8481a8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "41d9b342039acfeb677394858981ab6d", - "content-hash": "a3fcf274ad343f711f29f0c313994e1a", + "content-hash": "3375a604cb23088317e3daa54900aee2", "packages": [ { "name": "braintree/braintree_php", @@ -52,7 +51,7 @@ } ], "description": "Braintree PHP Client Library", - "time": "2017-02-16 19:59:04" + "time": "2017-02-16T19:59:04+00:00" }, { "name": "colinmollenhour/cache-backend-file", @@ -88,7 +87,7 @@ ], "description": "The stock Zend_Cache_Backend_File backend has extremely poor performance for cleaning by tags making it become unusable as the number of cached items increases. This backend makes many changes resulting in a huge performance boost, especially for tag cleaning.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_File", - "time": "2016-05-02 16:24:47" + "time": "2016-05-02T16:24:47+00:00" }, { "name": "colinmollenhour/cache-backend-redis", @@ -124,7 +123,7 @@ ], "description": "Zend_Cache backend using Redis with full support for tags.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_Redis", - "time": "2017-03-25 04:54:24" + "time": "2017-03-25T04:54:24+00:00" }, { "name": "colinmollenhour/credis", @@ -163,7 +162,7 @@ ], "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", "homepage": "https://github.com/colinmollenhour/credis", - "time": "2015-11-28 01:20:04" + "time": "2015-11-28T01:20:04+00:00" }, { "name": "colinmollenhour/php-redis-session-abstract", @@ -200,7 +199,7 @@ ], "description": "A Redis-based session handler with optimistic locking", "homepage": "https://github.com/colinmollenhour/php-redis-session-abstract", - "time": "2017-04-19 14:21:43" + "time": "2017-04-19T14:21:43+00:00" }, { "name": "composer/ca-bundle", @@ -259,7 +258,7 @@ "ssl", "tls" ], - "time": "2017-03-06 11:59:08" + "time": "2017-03-06T11:59:08+00:00" }, { "name": "composer/composer", @@ -336,7 +335,7 @@ "dependency", "package" ], - "time": "2017-03-10 08:29:45" + "time": "2017-03-10T08:29:45+00:00" }, { "name": "composer/semver", @@ -398,7 +397,7 @@ "validation", "versioning" ], - "time": "2016-08-30 16:08:34" + "time": "2016-08-30T16:08:34+00:00" }, { "name": "composer/spdx-licenses", @@ -459,7 +458,7 @@ "spdx", "validator" ], - "time": "2017-04-03 19:08:52" + "time": "2017-04-03T19:08:52+00:00" }, { "name": "container-interop/container-interop", @@ -490,7 +489,7 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14 19:40:03" + "time": "2017-02-14T19:40:03+00:00" }, { "name": "justinrainbow/json-schema", @@ -557,7 +556,7 @@ "json", "schema" ], - "time": "2017-05-16 21:06:09" + "time": "2017-05-16T21:06:09+00:00" }, { "name": "league/climate", @@ -606,7 +605,7 @@ "php", "terminal" ], - "time": "2015-01-18 14:31:58" + "time": "2015-01-18T14:31:58+00:00" }, { "name": "magento/composer", @@ -642,7 +641,7 @@ "AFL-3.0" ], "description": "Magento composer library helps to instantiate Composer application and run composer commands.", - "time": "2017-04-24 09:57:02" + "time": "2017-04-24T09:57:02+00:00" }, { "name": "magento/magento-composer-installer", @@ -721,7 +720,7 @@ "composer-installer", "magento" ], - "time": "2016-10-06 16:05:07" + "time": "2016-10-06T16:05:07+00:00" }, { "name": "magento/zendframework1", @@ -768,7 +767,7 @@ "ZF1", "framework" ], - "time": "2017-06-21 14:56:23" + "time": "2017-06-21T14:56:23+00:00" }, { "name": "monolog/monolog", @@ -846,7 +845,7 @@ "logging", "psr-3" ], - "time": "2017-06-19 01:22:40" + "time": "2017-06-19T01:22:40+00:00" }, { "name": "oyejorge/less.php", @@ -908,7 +907,7 @@ "php", "stylesheet" ], - "time": "2017-03-28 22:19:25" + "time": "2017-03-28T22:19:25+00:00" }, { "name": "paragonie/random_compat", @@ -956,7 +955,7 @@ "pseudorandom", "random" ], - "time": "2017-03-13 16:27:32" + "time": "2017-03-13T16:27:32+00:00" }, { "name": "pelago/emogrifier", @@ -1012,7 +1011,7 @@ ], "description": "Converts CSS styles into inline style attributes in your HTML code", "homepage": "http://www.pelagodesign.com/sidecar/emogrifier/", - "time": "2015-05-15 11:37:51" + "time": "2015-05-15T11:37:51+00:00" }, { "name": "phpseclib/phpseclib", @@ -1104,7 +1103,7 @@ "x.509", "x509" ], - "time": "2017-06-05 06:31:10" + "time": "2017-06-05T06:31:10+00:00" }, { "name": "psr/container", @@ -1153,7 +1152,7 @@ "container-interop", "psr" ], - "time": "2017-02-14 16:28:37" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/log", @@ -1200,7 +1199,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "ramsey/uuid", @@ -1282,7 +1281,7 @@ "identifier", "uuid" ], - "time": "2017-03-26 20:37:53" + "time": "2017-03-26T20:37:53+00:00" }, { "name": "seld/cli-prompt", @@ -1330,7 +1329,7 @@ "input", "prompt" ], - "time": "2017-03-18 11:32:45" + "time": "2017-03-18T11:32:45+00:00" }, { "name": "seld/jsonlint", @@ -1379,7 +1378,7 @@ "parser", "validator" ], - "time": "2017-06-18 15:11:04" + "time": "2017-06-18T15:11:04+00:00" }, { "name": "seld/phar-utils", @@ -1423,7 +1422,7 @@ "keywords": [ "phra" ], - "time": "2015-10-13 18:44:15" + "time": "2015-10-13T18:44:15+00:00" }, { "name": "sjparkinson/static-review", @@ -1476,11 +1475,11 @@ } ], "description": "An extendable framework for version control hooks.", - "time": "2014-09-22 08:40:36" + "time": "2014-09-22T08:40:36+00:00" }, { "name": "symfony/console", - "version": "v2.8.24", + "version": "v2.8.25", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -1537,7 +1536,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-07-03 08:04:30" + "time": "2017-07-03T08:04:30+00:00" }, { "name": "symfony/debug", @@ -1594,11 +1593,11 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-07-30 07:22:48" + "time": "2016-07-30T07:22:48+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.24", + "version": "v2.8.25", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -1654,20 +1653,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-06-02 07:47:27" + "time": "2017-06-02T07:47:27+00:00" }, { "name": "symfony/filesystem", - "version": "v3.3.4", + "version": "v3.3.5", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "311fa718389efbd8b627c272b9324a62437018cc" + "reference": "427987eb4eed764c3b6e38d52a0f87989e010676" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/311fa718389efbd8b627c272b9324a62437018cc", - "reference": "311fa718389efbd8b627c272b9324a62437018cc", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/427987eb4eed764c3b6e38d52a0f87989e010676", + "reference": "427987eb4eed764c3b6e38d52a0f87989e010676", "shasum": "" }, "require": { @@ -1703,11 +1702,11 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-06-24 09:29:48" + "time": "2017-07-11T07:17:58+00:00" }, { "name": "symfony/finder", - "version": "v3.3.4", + "version": "v3.3.5", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -1752,7 +1751,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-06-01 21:01:25" + "time": "2017-06-01T21:01:25+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1811,11 +1810,11 @@ "portable", "shim" ], - "time": "2017-06-09 14:24:12" + "time": "2017-06-09T14:24:12+00:00" }, { "name": "symfony/process", - "version": "v2.8.24", + "version": "v2.8.25", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -1860,7 +1859,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-07-03 08:04:30" + "time": "2017-07-03T08:04:30+00:00" }, { "name": "tedivm/jshrink", @@ -1906,7 +1905,7 @@ "javascript", "minifier" ], - "time": "2015-07-04 07:35:09" + "time": "2015-07-04T07:35:09+00:00" }, { "name": "tubalmartin/cssmin", @@ -1959,7 +1958,7 @@ "minify", "yui" ], - "time": "2017-05-16 13:45:26" + "time": "2017-05-16T13:45:26+00:00" }, { "name": "zendframework/zend-captcha", @@ -2016,7 +2015,7 @@ "captcha", "zf2" ], - "time": "2017-02-23 08:09:44" + "time": "2017-02-23T08:09:44+00:00" }, { "name": "zendframework/zend-code", @@ -2069,7 +2068,7 @@ "code", "zf2" ], - "time": "2016-10-24 13:23:32" + "time": "2016-10-24T13:23:32+00:00" }, { "name": "zendframework/zend-config", @@ -2125,7 +2124,7 @@ "config", "zf2" ], - "time": "2016-02-04 23:01:10" + "time": "2016-02-04T23:01:10+00:00" }, { "name": "zendframework/zend-console", @@ -2177,7 +2176,7 @@ "console", "zf2" ], - "time": "2016-02-09 17:15:12" + "time": "2016-02-09T17:15:12+00:00" }, { "name": "zendframework/zend-crypt", @@ -2227,7 +2226,7 @@ "crypt", "zf2" ], - "time": "2016-02-03 23:46:30" + "time": "2016-02-03T23:46:30+00:00" }, { "name": "zendframework/zend-db", @@ -2284,7 +2283,7 @@ "db", "zf2" ], - "time": "2016-08-09 19:28:55" + "time": "2016-08-09T19:28:55+00:00" }, { "name": "zendframework/zend-di", @@ -2331,7 +2330,7 @@ "di", "zf2" ], - "time": "2016-04-25 20:58:11" + "time": "2016-04-25T20:58:11+00:00" }, { "name": "zendframework/zend-escaper", @@ -2375,7 +2374,7 @@ "escaper", "zf2" ], - "time": "2016-06-30 19:48:38" + "time": "2016-06-30T19:48:38+00:00" }, { "name": "zendframework/zend-eventmanager", @@ -2422,7 +2421,7 @@ "eventmanager", "zf2" ], - "time": "2016-02-18 20:49:05" + "time": "2016-02-18T20:49:05+00:00" }, { "name": "zendframework/zend-filter", @@ -2482,7 +2481,7 @@ "filter", "zf2" ], - "time": "2017-05-17 20:56:17" + "time": "2017-05-17T20:56:17+00:00" }, { "name": "zendframework/zend-form", @@ -2559,7 +2558,7 @@ "form", "zf2" ], - "time": "2017-05-18 14:59:53" + "time": "2017-05-18T14:59:53+00:00" }, { "name": "zendframework/zend-http", @@ -2609,7 +2608,7 @@ "http", "zf2" ], - "time": "2017-01-31 14:41:02" + "time": "2017-01-31T14:41:02+00:00" }, { "name": "zendframework/zend-hydrator", @@ -2667,7 +2666,7 @@ "hydrator", "zf2" ], - "time": "2016-02-18 22:38:26" + "time": "2016-02-18T22:38:26+00:00" }, { "name": "zendframework/zend-i18n", @@ -2734,7 +2733,7 @@ "i18n", "zf2" ], - "time": "2017-05-17 17:00:12" + "time": "2017-05-17T17:00:12+00:00" }, { "name": "zendframework/zend-inputfilter", @@ -2789,7 +2788,7 @@ "inputfilter", "zf2" ], - "time": "2017-05-18 14:20:56" + "time": "2017-05-18T14:20:56+00:00" }, { "name": "zendframework/zend-json", @@ -2844,7 +2843,7 @@ "json", "zf2" ], - "time": "2016-02-04 21:20:26" + "time": "2016-02-04T21:20:26+00:00" }, { "name": "zendframework/zend-loader", @@ -2888,7 +2887,7 @@ "loader", "zf2" ], - "time": "2015-06-03 14:05:47" + "time": "2015-06-03T14:05:47+00:00" }, { "name": "zendframework/zend-log", @@ -2959,7 +2958,7 @@ "logging", "zf2" ], - "time": "2017-05-17 16:03:26" + "time": "2017-05-17T16:03:26+00:00" }, { "name": "zendframework/zend-mail", @@ -3021,7 +3020,7 @@ "mail", "zf2" ], - "time": "2017-06-08 20:03:58" + "time": "2017-06-08T20:03:58+00:00" }, { "name": "zendframework/zend-math", @@ -3071,7 +3070,7 @@ "math", "zf2" ], - "time": "2016-04-07 16:29:53" + "time": "2016-04-07T16:29:53+00:00" }, { "name": "zendframework/zend-mime", @@ -3120,7 +3119,7 @@ "mime", "zf2" ], - "time": "2017-01-16 16:43:38" + "time": "2017-01-16T16:43:38+00:00" }, { "name": "zendframework/zend-modulemanager", @@ -3178,7 +3177,7 @@ "modulemanager", "zf2" ], - "time": "2017-07-11 19:39:57" + "time": "2017-07-11T19:39:57+00:00" }, { "name": "zendframework/zend-mvc", @@ -3265,7 +3264,7 @@ "mvc", "zf2" ], - "time": "2016-02-23 15:24:59" + "time": "2016-02-23T15:24:59+00:00" }, { "name": "zendframework/zend-serializer", @@ -3322,7 +3321,7 @@ "serializer", "zf2" ], - "time": "2016-06-21 17:01:55" + "time": "2016-06-21T17:01:55+00:00" }, { "name": "zendframework/zend-server", @@ -3368,7 +3367,7 @@ "server", "zf2" ], - "time": "2016-06-20 22:27:55" + "time": "2016-06-20T22:27:55+00:00" }, { "name": "zendframework/zend-servicemanager", @@ -3420,7 +3419,7 @@ "servicemanager", "zf2" ], - "time": "2016-12-19 19:14:29" + "time": "2016-12-19T19:14:29+00:00" }, { "name": "zendframework/zend-session", @@ -3486,7 +3485,7 @@ "session", "zf2" ], - "time": "2017-06-19 21:31:39" + "time": "2017-06-19T21:31:39+00:00" }, { "name": "zendframework/zend-soap", @@ -3538,7 +3537,7 @@ "soap", "zf2" ], - "time": "2016-04-21 16:06:27" + "time": "2016-04-21T16:06:27+00:00" }, { "name": "zendframework/zend-stdlib", @@ -3597,7 +3596,7 @@ "stdlib", "zf2" ], - "time": "2016-04-12 21:17:31" + "time": "2016-04-12T21:17:31+00:00" }, { "name": "zendframework/zend-text", @@ -3644,7 +3643,7 @@ "text", "zf2" ], - "time": "2016-02-08 19:03:52" + "time": "2016-02-08T19:03:52+00:00" }, { "name": "zendframework/zend-uri", @@ -3691,20 +3690,20 @@ "uri", "zf2" ], - "time": "2016-02-17 22:38:51" + "time": "2016-02-17T22:38:51+00:00" }, { "name": "zendframework/zend-validator", - "version": "2.9.1", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-validator.git", - "reference": "c9a8160a0191e34bb98ac1ecd4e453391c424bb3" + "reference": "a58dbe8463b93de0d650e296d56cb7da4a129ff3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/c9a8160a0191e34bb98ac1ecd4e453391c424bb3", - "reference": "c9a8160a0191e34bb98ac1ecd4e453391c424bb3", + "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/a58dbe8463b93de0d650e296d56cb7da4a129ff3", + "reference": "a58dbe8463b93de0d650e296d56cb7da4a129ff3", "shasum": "" }, "require": { @@ -3762,7 +3761,7 @@ "validator", "zf2" ], - "time": "2017-05-17 22:06:13" + "time": "2017-07-20T16:44:59+00:00" }, { "name": "zendframework/zend-view", @@ -3849,7 +3848,7 @@ "view", "zf2" ], - "time": "2017-03-21 15:05:56" + "time": "2017-03-21T15:05:56+00:00" } ], "packages-dev": [ @@ -3905,7 +3904,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -3975,7 +3974,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2017-03-31 12:59:38" + "time": "2017-03-31T12:59:38+00:00" }, { "name": "ircmaxell/password-compat", @@ -4017,7 +4016,7 @@ "hashing", "password" ], - "time": "2014-11-20 16:49:30" + "time": "2014-11-20T16:49:30+00:00" }, { "name": "lusitanian/oauth", @@ -4084,7 +4083,7 @@ "oauth", "security" ], - "time": "2016-07-12 22:15:40" + "time": "2016-07-12T22:15:40+00:00" }, { "name": "pdepend/pdepend", @@ -4124,7 +4123,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2017-01-19 14:23:36" + "time": "2017-01-19T14:23:36+00:00" }, { "name": "phpmd/phpmd", @@ -4190,7 +4189,7 @@ "phpmd", "pmd" ], - "time": "2017-01-20 14:41:10" + "time": "2017-01-20T14:41:10+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4252,7 +4251,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4297,7 +4296,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2013-10-10T15:34:57+00:00" }, { "name": "phpunit/php-text-template", @@ -4338,7 +4337,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -4387,7 +4386,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", @@ -4436,7 +4435,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27 10:12:30" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", @@ -4510,7 +4509,7 @@ "testing", "xunit" ], - "time": "2014-05-02 07:13:40" + "time": "2014-05-02T07:13:40+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -4566,7 +4565,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", @@ -4630,7 +4629,7 @@ "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", @@ -4682,7 +4681,7 @@ "keywords": [ "diff" ], - "time": "2017-05-22 07:24:03" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", @@ -4732,7 +4731,7 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", @@ -4799,7 +4798,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/finder-facade", @@ -4838,7 +4837,7 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2016-02-17 07:02:23" + "time": "2016-02-17T07:02:23+00:00" }, { "name": "sebastian/phpcpd", @@ -4889,7 +4888,7 @@ ], "description": "Copy/Paste Detector (CPD) for PHP code.", "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2016-04-17 19:32:49" + "time": "2016-04-17T19:32:49+00:00" }, { "name": "sebastian/recursion-context", @@ -4942,7 +4941,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03 07:41:43" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", @@ -4977,7 +4976,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -5052,11 +5051,11 @@ "phpcs", "standards" ], - "time": "2014-05-01 03:07:07" + "time": "2014-05-01T03:07:07+00:00" }, { "name": "symfony/config", - "version": "v3.2.11", + "version": "v3.2.12", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -5108,7 +5107,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/dependency-injection", @@ -5168,7 +5167,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-01-28 00:04:57" + "time": "2017-01-28T00:04:57+00:00" }, { "name": "symfony/polyfill-php54", @@ -5226,7 +5225,7 @@ "portable", "shim" ], - "time": "2017-06-09 08:25:21" + "time": "2017-06-09T08:25:21+00:00" }, { "name": "symfony/polyfill-php55", @@ -5282,7 +5281,7 @@ "portable", "shim" ], - "time": "2017-06-09 08:25:21" + "time": "2017-06-09T08:25:21+00:00" }, { "name": "symfony/polyfill-php70", @@ -5341,7 +5340,7 @@ "portable", "shim" ], - "time": "2017-06-09 14:24:12" + "time": "2017-06-09T14:24:12+00:00" }, { "name": "symfony/polyfill-php72", @@ -5396,7 +5395,7 @@ "portable", "shim" ], - "time": "2017-06-09 08:25:21" + "time": "2017-06-09T08:25:21+00:00" }, { "name": "symfony/polyfill-xml", @@ -5444,11 +5443,11 @@ "portable", "shim" ], - "time": "2017-06-09 08:25:21" + "time": "2017-06-09T08:25:21+00:00" }, { "name": "symfony/stopwatch", - "version": "v3.3.4", + "version": "v3.3.5", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -5493,11 +5492,11 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:14:56" + "time": "2017-04-12T14:14:56+00:00" }, { "name": "symfony/yaml", - "version": "v2.8.24", + "version": "v2.8.25", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -5542,7 +5541,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-06-01 20:52:29" + "time": "2017-06-01T20:52:29+00:00" }, { "name": "theseer/fdomdocument", @@ -5582,7 +5581,7 @@ ], "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2017-06-30 11:53:12" + "time": "2017-06-30T11:53:12+00:00" } ], "aliases": [], From a1dab12c4d05e99390f055c7a220c12ccf49d991 Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Sun, 30 Jul 2017 10:31:15 +0200 Subject: [PATCH 0394/1004] Improved calculating version hash for the js-translation.json file. --- app/code/Magento/Translation/Block/Js.php | 8 ++++++++ app/code/Magento/Translation/Model/FileManager.php | 2 +- .../Translation/view/base/templates/translate.phtml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Translation/Block/Js.php b/app/code/Magento/Translation/Block/Js.php index 316c136666cc0..cc0f2530f19f9 100644 --- a/app/code/Magento/Translation/Block/Js.php +++ b/app/code/Magento/Translation/Block/Js.php @@ -68,4 +68,12 @@ public function getTranslationFilePath() { return $this->fileManager->getTranslationFilePath(); } + + /** + * @return string + */ + public function getTranslationFileFullPath() + { + return $this->fileManager->getTranslationFileFullPath(); + } } diff --git a/app/code/Magento/Translation/Model/FileManager.php b/app/code/Magento/Translation/Model/FileManager.php index f1dca0189f3b8..11ce8bd2fb573 100644 --- a/app/code/Magento/Translation/Model/FileManager.php +++ b/app/code/Magento/Translation/Model/FileManager.php @@ -73,7 +73,7 @@ public function getTranslationFileTimestamp() /** * @return string */ - protected function getTranslationFileFullPath() + public function getTranslationFileFullPath() { return $this->directoryList->getPath(DirectoryList::STATIC_VIEW) . \DIRECTORY_SEPARATOR . diff --git a/app/code/Magento/Translation/view/base/templates/translate.phtml b/app/code/Magento/Translation/view/base/templates/translate.phtml index 9e1021022d876..c6cd2a33f0592 100644 --- a/app/code/Magento/Translation/view/base/templates/translate.phtml +++ b/app/code/Magento/Translation/view/base/templates/translate.phtml @@ -26,7 +26,7 @@ $.initNamespaceStorage('mage-translation-file-version'); versionObj = $.localStorage.get('mage-translation-file-version'); - getTranslationFileTimestamp() . $block->getTranslationFilePath()); ?> + getTranslationFileFullPath()) . $block->getTranslationFilePath()); ?> if (versionObj.version !== '') { dependencies.push( From a247a3d2e53af69982547856afa3caa2aa9ecfbc Mon Sep 17 00:00:00 2001 From: Serhii Date: Mon, 31 Jul 2017 10:03:01 +0300 Subject: [PATCH 0395/1004] Optimize validation Optimize validation when ShouldIgnoreValidation set `true` --- app/code/Magento/Customer/Model/Address/AbstractAddress.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index 536ceb28b3975..fec6f0be3d188 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -566,6 +566,10 @@ public function getDataModel($defaultBillingAddressId = null, $defaultShippingAd */ public function validate() { + if ($this->getShouldIgnoreValidation()) { + return true; + } + $errors = []; if (!\Zend_Validate::is($this->getFirstname(), 'NotEmpty')) { $errors[] = __('%fieldName is a required field.', ['fieldName' => 'firstname']); @@ -627,7 +631,7 @@ public function validate() $errors[] = __('%fieldName is a required field.', ['fieldName' => 'regionId']); } - if (empty($errors) || $this->getShouldIgnoreValidation()) { + if (empty($errors)) { return true; } return $errors; From b3a1c7ee7a17eff7b3964bcb3beecd58743ec9ac Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Mon, 31 Jul 2017 21:10:42 +0200 Subject: [PATCH 0396/1004] Refactored getting translation file version into a more desirable state, still using the modified timestamp for now. --- app/code/Magento/Translation/Block/Js.php | 4 ++-- app/code/Magento/Translation/Model/FileManager.php | 10 +++++++++- .../Translation/view/base/templates/translate.phtml | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Translation/Block/Js.php b/app/code/Magento/Translation/Block/Js.php index cc0f2530f19f9..2198ed5cf6b86 100644 --- a/app/code/Magento/Translation/Block/Js.php +++ b/app/code/Magento/Translation/Block/Js.php @@ -72,8 +72,8 @@ public function getTranslationFilePath() /** * @return string */ - public function getTranslationFileFullPath() + public function getTranslationFileVersion() { - return $this->fileManager->getTranslationFileFullPath(); + return $this->fileManager->getTranslationFileVersion(); } } diff --git a/app/code/Magento/Translation/Model/FileManager.php b/app/code/Magento/Translation/Model/FileManager.php index 11ce8bd2fb573..84d8bdacead24 100644 --- a/app/code/Magento/Translation/Model/FileManager.php +++ b/app/code/Magento/Translation/Model/FileManager.php @@ -73,7 +73,7 @@ public function getTranslationFileTimestamp() /** * @return string */ - public function getTranslationFileFullPath() + protected function getTranslationFileFullPath() { return $this->directoryList->getPath(DirectoryList::STATIC_VIEW) . \DIRECTORY_SEPARATOR . @@ -104,4 +104,12 @@ public function updateTranslationFileContent($content) } $this->driverFile->filePutContents($this->getTranslationFileFullPath(), $content); } + + /** + * @return string + */ + public function getTranslationFileVersion() + { + return sha1($this->getTranslationFileTimestamp() . $this->getTranslationFilePath()); + } } diff --git a/app/code/Magento/Translation/view/base/templates/translate.phtml b/app/code/Magento/Translation/view/base/templates/translate.phtml index c6cd2a33f0592..7007cd7fd55a9 100644 --- a/app/code/Magento/Translation/view/base/templates/translate.phtml +++ b/app/code/Magento/Translation/view/base/templates/translate.phtml @@ -26,7 +26,7 @@ $.initNamespaceStorage('mage-translation-file-version'); versionObj = $.localStorage.get('mage-translation-file-version'); - getTranslationFileFullPath()) . $block->getTranslationFilePath()); ?> + getTranslationFileVersion(); ?> if (versionObj.version !== '') { dependencies.push( From 507cd4208b18f63ff147c9c605b6c70addbb2cba Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Mon, 31 Jul 2017 22:57:39 +0200 Subject: [PATCH 0397/1004] Start using the file contents for calculating the hash again instead of the modified timestamp. --- app/code/Magento/Translation/Model/FileManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Translation/Model/FileManager.php b/app/code/Magento/Translation/Model/FileManager.php index 84d8bdacead24..e25838053f0ac 100644 --- a/app/code/Magento/Translation/Model/FileManager.php +++ b/app/code/Magento/Translation/Model/FileManager.php @@ -110,6 +110,6 @@ public function updateTranslationFileContent($content) */ public function getTranslationFileVersion() { - return sha1($this->getTranslationFileTimestamp() . $this->getTranslationFilePath()); + return sha1(sha1_file($this->getTranslationFileFullPath()) . $this->getTranslationFilePath()); } } From def3cff68d8a39efb41acf409d74cef6eb15208f Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Mon, 31 Jul 2017 23:17:20 +0200 Subject: [PATCH 0398/1004] Fixes integration tests. --- app/code/Magento/Translation/Model/FileManager.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Translation/Model/FileManager.php b/app/code/Magento/Translation/Model/FileManager.php index e25838053f0ac..3ca454546ccea 100644 --- a/app/code/Magento/Translation/Model/FileManager.php +++ b/app/code/Magento/Translation/Model/FileManager.php @@ -110,6 +110,13 @@ public function updateTranslationFileContent($content) */ public function getTranslationFileVersion() { - return sha1(sha1_file($this->getTranslationFileFullPath()) . $this->getTranslationFilePath()); + $translationFile = $this->getTranslationFileFullPath(); + $translationFileHash = ''; + + if ($this->driverFile->isExists($translationFile)) { + $translationFileHash = sha1_file($translationFile); + } + + return sha1($translationFileHash . $this->getTranslationFilePath()); } } From 67fbe615eeaae3e0742ff63a130c5c68dd87c176 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Mon, 31 Jul 2017 16:30:24 -0500 Subject: [PATCH 0399/1004] MAGETWO-71062: Remove zend json from json controller #10342 - Reverted Pull Request magento/magento2#10342 from dmanners/magento2:remove-zend-json-from-json-controller - Merged commits: 1. baeb58c 2. db6f353 3. 4f78388 4. 7e46cea 5. ff0581b 6. 41e118b --- .../Controller/Adminhtml/Rate/AjaxLoad.php | 3 +- .../Controller/Adminhtml/Rate/AjaxSave.php | 1 - .../Framework/Controller/Result/Json.php | 57 +++---------------- 3 files changed, 9 insertions(+), 52 deletions(-) diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php index c182fb53b3880..fb6aca4396542 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php @@ -14,8 +14,7 @@ class AjaxLoad extends \Magento\Tax\Controller\Adminhtml\Rate /** * Json needed for the Ajax Edit Form * - * @return \Magento\Framework\Controller\Result\Json - * @throws \InvalidArgumentException + * @return void */ public function execute() { diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php index f6cd0fff9c9b0..354865e5828ef 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php @@ -14,7 +14,6 @@ class AjaxSave extends \Magento\Tax\Controller\Adminhtml\Rate * Save Tax Rate via AJAX * * @return \Magento\Framework\Controller\Result\Json - * @throws \InvalidArgumentException */ public function execute() { diff --git a/lib/internal/Magento/Framework/Controller/Result/Json.php b/lib/internal/Magento/Framework/Controller/Result/Json.php index 188dcd6029f56..3349d4507577b 100644 --- a/lib/internal/Magento/Framework/Controller/Result/Json.php +++ b/lib/internal/Magento/Framework/Controller/Result/Json.php @@ -29,65 +29,24 @@ class Json extends AbstractResult protected $json; /** - * @var \Magento\Framework\Serialize\Serializer\Json + * @param \Magento\Framework\Translate\InlineInterface $translateInline */ - private $serializer; - - /** - * @param InlineInterface $translateInline - * @param \Magento\Framework\Serialize\Serializer\Json|null $serializer - * @throws \RuntimeException - */ - public function __construct( - InlineInterface $translateInline, - \Magento\Framework\Serialize\Serializer\Json $serializer = null - ) { + public function __construct(InlineInterface $translateInline) + { $this->translateInline = $translateInline; - $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() - ->get(\Magento\Framework\Serialize\Serializer\Json::class); } /** * Set json data * - * @param array|string|\Magento\Framework\DataObject $data - * @param bool $cycleCheck - * @param array $options - * @return Json - * @throws \InvalidArgumentException - * @throws \Magento\Framework\Exception\LocalizedException - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - * @deprecated - * @see Json::setArrayData - * @see Json::setJsonData - */ - public function setData($data, $cycleCheck = false, $options = []) - { - if ($data instanceof \Magento\Framework\DataObject) { - return $this->setArrayData($data->toArray()); - } - - if (is_array($data)) { - return $this->setArrayData($data); - } - - if (is_string($data)) { - return $this->setJsonData($data); - } - - throw new \Magento\Framework\Exception\LocalizedException( - new \Magento\Framework\Phrase('Invalid argument type') - ); - } - - /** - * @param array $data + * @param mixed $data + * @param boolean $cycleCheck Optional; whether or not to check for object recursion; off by default + * @param array $options Additional options used during encoding * @return $this - * @throws \InvalidArgumentException */ - public function setArrayData(array $data) + public function setData($data, $cycleCheck = false, $options = []) { - $this->setJsonData($this->serializer->serialize($data)); + $this->json = \Zend_Json::encode($data, $cycleCheck, $options); return $this; } From 0a1d85c24f20efee205cd6fc33e2bf3b0784b8ac Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Tue, 1 Aug 2017 16:35:22 -0500 Subject: [PATCH 0400/1004] MAGETWO-71255: Merge 2.2 into develop mainline (2.3) - stabilize builds --- .../Controller/Adminhtml/Product/Attribute/ValidateTest.php | 2 +- app/code/Magento/Newsletter/Model/Template.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php index 6373712066695..803ce855672bb 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php @@ -233,7 +233,7 @@ public function provideUniqueData() "option_1" => "", "option_2" => "", ] - ], true + ], false ], 'duplicate and deleted' => [ [ diff --git a/app/code/Magento/Newsletter/Model/Template.php b/app/code/Magento/Newsletter/Model/Template.php index 5e4cf1e06f3be..4d4396e31717e 100644 --- a/app/code/Magento/Newsletter/Model/Template.php +++ b/app/code/Magento/Newsletter/Model/Template.php @@ -40,7 +40,7 @@ class Template extends \Magento\Email\Model\AbstractTemplate { /** * Mail object - * + * * @deprecated Unused property * */ From 2e463631bf66748b8076065c640996c80fcb532a Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Tue, 1 Aug 2017 17:50:28 -0500 Subject: [PATCH 0401/1004] MAGETWO-70798: Fall back to parent directory if composer.json not found in module directory #8990 - fixed code style --- app/code/Magento/SampleData/Model/Dependency.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index 1fe48d573a27f..c4c7c2860d2b4 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -43,33 +43,29 @@ class Dependency */ private $directoryReadFactory; - //@codingStandardsIgnoreStart /** * @param ComposerInformation $composerInformation - * @param Filesystem $filesystem + * @param Filesystem $filesystem @deprecated 2.3.0 $directoryReadFactory is used instead * @param PackageFactory $packageFactory * @param ComponentRegistrarInterface $componentRegistrar * @param Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory * @throws \RuntimeException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( ComposerInformation $composerInformation, - // $filesystem kept for BC - Filesystem $filesystem, + Filesystem $filesystem, // $filesystem kept for BC PackageFactory $packageFactory, ComponentRegistrarInterface $componentRegistrar, - // $directoryReadFactory optional for BC Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory = null ) { $this->composerInformation = $composerInformation; $this->packageFactory = $packageFactory; $this->componentRegistrar = $componentRegistrar; - if ($directoryReadFactory === null) { - $directoryReadFactory = ObjectManager::getInstance()->get(Filesystem\Directory\ReadInterfaceFactory::class); - } - $this->directoryReadFactory = $directoryReadFactory; + $this->directoryReadFactory = $directoryReadFactory ?: ObjectManager::getInstance()->get( + Filesystem\Directory\ReadInterfaceFactory::class + ); } - //@codingStandardsIgnoreEnd /** * Retrieve list of sample data packages from suggests From b11309cfd8cac2dc6c3b6d95e9697d010536f53d Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Tue, 1 Aug 2017 18:06:06 -0500 Subject: [PATCH 0402/1004] MAGETWO-70798: Fall back to parent directory if composer.json not found in module directory #8990 - fixed code style --- .../Magento/SampleData/Model/Dependency.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/SampleData/Model/Dependency.php b/app/code/Magento/SampleData/Model/Dependency.php index c4c7c2860d2b4..e3949a6bd502e 100644 --- a/app/code/Magento/SampleData/Model/Dependency.php +++ b/app/code/Magento/SampleData/Model/Dependency.php @@ -12,6 +12,7 @@ use Magento\Framework\Config\Composer\Package; use Magento\Framework\Config\Composer\PackageFactory; use Magento\Framework\Filesystem; +use Magento\Framework\Filesystem\Directory\ReadInterfaceFactory; /** * Sample Data dependency @@ -39,32 +40,32 @@ class Dependency private $componentRegistrar; /** - * @var Filesystem\Directory\ReadInterfaceFactory + * @var ReadInterfaceFactory */ private $directoryReadFactory; /** + * Initialize dependencies. + * * @param ComposerInformation $composerInformation * @param Filesystem $filesystem @deprecated 2.3.0 $directoryReadFactory is used instead * @param PackageFactory $packageFactory * @param ComponentRegistrarInterface $componentRegistrar - * @param Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory - * @throws \RuntimeException + * @param Filesystem\Directory\ReadInterfaceFactory|null $directoryReadFactory * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( ComposerInformation $composerInformation, - Filesystem $filesystem, // $filesystem kept for BC + Filesystem $filesystem, PackageFactory $packageFactory, ComponentRegistrarInterface $componentRegistrar, - Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory = null + \Magento\Framework\Filesystem\Directory\ReadInterfaceFactory $directoryReadFactory = null ) { $this->composerInformation = $composerInformation; $this->packageFactory = $packageFactory; $this->componentRegistrar = $componentRegistrar; - $this->directoryReadFactory = $directoryReadFactory ?: ObjectManager::getInstance()->get( - Filesystem\Directory\ReadInterfaceFactory::class - ); + $this->directoryReadFactory = $directoryReadFactory ?: + ObjectManager::getInstance()->get(ReadInterfaceFactory::class); } /** From ec00c1e082b68236ebc45a0f7f9accc9e6004e7e Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Tue, 1 Aug 2017 18:24:34 -0500 Subject: [PATCH 0403/1004] MAGETWO-70798: Fall back to parent directory if composer.json not found in module directory #8990 - fixed code style --- app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php index 3be13af6ae91b..b0ae7f36439e9 100644 --- a/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php +++ b/app/code/Magento/SampleData/Test/Unit/Model/DependencyTest.php @@ -1,6 +1,6 @@ Date: Wed, 2 Aug 2017 10:48:29 +0100 Subject: [PATCH 0404/1004] Update _buttons.less Fix a minor spelling mistake. --- lib/web/css/source/lib/_buttons.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/css/source/lib/_buttons.less b/lib/web/css/source/lib/_buttons.less index b2e5a0d35c1db..804302fcb69ac 100644 --- a/lib/web/css/source/lib/_buttons.less +++ b/lib/web/css/source/lib/_buttons.less @@ -8,7 +8,7 @@ // _____________________________________________ // -// Button with solid or pictire background +// Button with solid or picture background // --------------------------------------------- .lib-button( From e750fa2e2d4ca39d67c242596df928e7921f37de Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Wed, 2 Aug 2017 12:07:20 -0500 Subject: [PATCH 0405/1004] MAGETWO-71255: Merge 2.2 into develop mainline (2.3) - stabilize builds --- .../Controller/Adminhtml/Product/Attribute/Validate.php | 8 ++++---- .../Adminhtml/Product/Attribute/ValidateTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php index d99d947e184bb..7638f71ebb6ea 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php @@ -160,17 +160,17 @@ private function checkUniqueOption(DataObject $response, array $options = null) if (is_array($options) && isset($options['value']) && isset($options['delete']) - && !$this->isUniqueAdminValues($options['value'], $options['delete']) + && !empty($options['value']) + && !empty($options['delete']) ) { $duplicates = $this->isUniqueAdminValues($options['value'], $options['delete']); - if ($duplicates) { + if (!empty($duplicates)) { $this->setMessageToResponse( $response, [__('The value of Admin must be unique. (%1)', implode(', ', $duplicates))] ); - - $response->setError(true); } + $response->setError(true); } return $this; } diff --git a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php index 803ce855672bb..6373712066695 100644 --- a/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Attribute/ValidateTest.php @@ -233,7 +233,7 @@ public function provideUniqueData() "option_1" => "", "option_2" => "", ] - ], false + ], true ], 'duplicate and deleted' => [ [ From 66f1460af0723d4581bd9f81c37aa7918be1b4a9 Mon Sep 17 00:00:00 2001 From: dmanners Date: Thu, 3 Aug 2017 12:10:11 +0000 Subject: [PATCH 0406/1004] Update the return type in the tax rate ajax controllers to be correct --- .../Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php | 10 ++++++---- .../Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php index fb6aca4396542..ff610a8f0da2e 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxLoad.php @@ -4,6 +4,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Tax\Controller\Adminhtml\Rate; use Magento\Framework\Exception\NoSuchEntityException; @@ -14,7 +15,8 @@ class AjaxLoad extends \Magento\Tax\Controller\Adminhtml\Rate /** * Json needed for the Ajax Edit Form * - * @return void + * @return \Magento\Framework\Controller\Result\Json + * @throws \InvalidArgumentException */ public function execute() { @@ -23,13 +25,13 @@ public function execute() /* @var \Magento\Tax\Api\Data\TaxRateInterface */ $taxRateDataObject = $this->_taxRateRepository->get($rateId); /* @var array */ - $resultArray= $this->_taxRateConverter->createArrayFromServiceObject($taxRateDataObject, true); + $resultArray = $this->_taxRateConverter->createArrayFromServiceObject($taxRateDataObject, true); $responseContent = [ 'success' => true, 'error_message' => '', - 'result'=>$resultArray, - ]; + 'result' => $resultArray, + ]; } catch (NoSuchEntityException $e) { $responseContent = [ 'success' => false, diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php index 354865e5828ef..f6cd0fff9c9b0 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate/AjaxSave.php @@ -14,6 +14,7 @@ class AjaxSave extends \Magento\Tax\Controller\Adminhtml\Rate * Save Tax Rate via AJAX * * @return \Magento\Framework\Controller\Result\Json + * @throws \InvalidArgumentException */ public function execute() { From d27cf63f8f7d20dd6428913cba50fdeb59dc3cc8 Mon Sep 17 00:00:00 2001 From: dmanners Date: Thu, 3 Aug 2017 12:16:40 +0000 Subject: [PATCH 0407/1004] Add the thrown notice to all Ajax controlers in the tax module --- .../Magento/Tax/Controller/Adminhtml/Rule/AjaxLoadRates.php | 1 + app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxDelete.php | 2 ++ app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxSave.php | 2 ++ 3 files changed, 5 insertions(+) diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rule/AjaxLoadRates.php b/app/code/Magento/Tax/Controller/Adminhtml/Rule/AjaxLoadRates.php index 4d40e20ce7b8e..060a4350bb624 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rule/AjaxLoadRates.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rule/AjaxLoadRates.php @@ -48,6 +48,7 @@ public function __construct( * Get rates page via AJAX * * @return Json + * @throws \InvalidArgumentException */ public function execute() { diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxDelete.php b/app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxDelete.php index fb842d1e08acd..2f32e76cd3c75 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxDelete.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxDelete.php @@ -14,6 +14,7 @@ class AjaxDelete extends \Magento\Tax\Controller\Adminhtml\Tax * Delete Tax Class via AJAX * * @return \Magento\Framework\Controller\Result\Json + * @throws \InvalidArgumentException */ public function execute() { @@ -29,6 +30,7 @@ public function execute() 'error_message' => __('We can\'t delete this tax class right now.') ]; } + /** @var \Magento\Framework\Controller\Result\Json $resultJson */ $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON); $resultJson->setData($responseContent); diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxSave.php b/app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxSave.php index 1e3b644c901b6..1206d68e614d1 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxSave.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Tax/AjaxSave.php @@ -14,6 +14,7 @@ class AjaxSave extends \Magento\Tax\Controller\Adminhtml\Tax * Save Tax Class via AJAX * * @return \Magento\Framework\Controller\Result\Json + * @throws \InvalidArgumentException */ public function execute() { @@ -47,6 +48,7 @@ public function execute() 'class_name' => '', ]; } + /** @var \Magento\Framework\Controller\Result\Json $resultJson */ $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON); $resultJson->setData($responseContent); From 8d49269bfe670cb5db3597d03dd092761b906432 Mon Sep 17 00:00:00 2001 From: dmanners Date: Thu, 3 Aug 2017 14:37:36 +0000 Subject: [PATCH 0408/1004] Update the AdminNotification AjaxMarkAsRead controller - stop the direct usage of object manager in the execute method, - modify the execute method to use the resultFactory for building the response --- .../Adminhtml/Notification/AjaxMarkAsRead.php | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/AjaxMarkAsRead.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/AjaxMarkAsRead.php index 31a129d57ab90..da797fe12e75a 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/AjaxMarkAsRead.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification/AjaxMarkAsRead.php @@ -6,12 +6,35 @@ */ namespace Magento\AdminNotification\Controller\Adminhtml\Notification; +use Magento\Backend\App\Action; +use Magento\Framework\Controller\ResultFactory; + class AjaxMarkAsRead extends \Magento\AdminNotification\Controller\Adminhtml\Notification { + /** + * @var \Magento\AdminNotification\Model\NotificationService + */ + private $notificationService; + + /** + * @param Action\Context $context + * @param \Magento\AdminNotification\Model\NotificationService|null $notificationService + * @throws \RuntimeException + */ + public function __construct( + Action\Context $context, + \Magento\AdminNotification\Model\NotificationService $notificationService = null + ) { + parent::__construct($context); + $this->notificationService = $notificationService?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\AdminNotification\Model\NotificationService::class); + } + /** * Mark notification as read (AJAX action) * - * @return void + * @return \Magento\Framework\Controller\Result\Json|void + * @throws \InvalidArgumentException */ public function execute() { @@ -21,17 +44,15 @@ public function execute() $notificationId = (int)$this->getRequest()->getPost('id'); $responseData = []; try { - $this->_objectManager->create( - \Magento\AdminNotification\Model\NotificationService::class - )->markAsRead( - $notificationId - ); + $this->notificationService->markAsRead($notificationId); $responseData['success'] = true; } catch (\Exception $e) { $responseData['success'] = false; } - $this->getResponse()->representJson( - $this->_objectManager->create(\Magento\Framework\Json\Helper\Data::class)->jsonEncode($responseData) - ); + + /** @var \Magento\Framework\Controller\Result\Json $resultJson */ + $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON); + $resultJson->setData($responseData); + return $resultJson; } } From 5688d6adc753744dc7f42da2af6b6b4ec62b0932 Mon Sep 17 00:00:00 2001 From: Cristian Partica Date: Thu, 3 Aug 2017 14:03:00 -0500 Subject: [PATCH 0409/1004] MAGETWO-71255: Merge 2.2 into develop mainline (2.3) - stabilize builds --- .../Catalog/Controller/Adminhtml/Product/Attribute/Validate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php index 7638f71ebb6ea..4dd406a5d14db 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate.php @@ -169,8 +169,8 @@ private function checkUniqueOption(DataObject $response, array $options = null) $response, [__('The value of Admin must be unique. (%1)', implode(', ', $duplicates))] ); + $response->setError(true); } - $response->setError(true); } return $this; } From 322e7a4c8fb64f3df07354c0a5da508223840558 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Fri, 4 Aug 2017 12:45:52 +0600 Subject: [PATCH 0410/1004] remove leading backslash from import name --- app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php index f772a6c0c8493..b98a456a511f1 100644 --- a/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php +++ b/app/code/Magento/Cron/Observer/ProcessCronQueueObserver.php @@ -12,7 +12,7 @@ use Magento\Framework\App\State; use Magento\Framework\Console\Cli; use Magento\Framework\Event\ObserverInterface; -use \Magento\Cron\Model\Schedule; +use Magento\Cron\Model\Schedule; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) From 45686878a919064ed2abc1321bc3eff3f41b807b Mon Sep 17 00:00:00 2001 From: Jeroen Alewijns Date: Fri, 4 Aug 2017 09:23:18 +0200 Subject: [PATCH 0411/1004] Update menu.js Prevent remove click listener when switch from mobile to desktop mode. --- lib/web/mage/menu.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js index fdb796addbcf0..6b022dec0fa00 100644 --- a/lib/web/mage/menu.js +++ b/lib/web/mage/menu.js @@ -371,7 +371,8 @@ define([ */ _toggleDesktopMode: function () { var categoryParent, html; - + + $(this.element).off('click mouseenter mouseleave'); this._on({ /** * Prevent focus from sticking to links inside menu after clicking From fe0e347e92052d09ca2083eab1809d403c1aa979 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Fri, 4 Aug 2017 14:32:17 +0600 Subject: [PATCH 0412/1004] Test cron expressions against localized time --- app/code/Magento/Cron/Model/Schedule.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cron/Model/Schedule.php b/app/code/Magento/Cron/Model/Schedule.php index df9586143aa9a..46cedea62aebc 100644 --- a/app/code/Magento/Cron/Model/Schedule.php +++ b/app/code/Magento/Cron/Model/Schedule.php @@ -44,21 +44,30 @@ class Schedule extends \Magento\Framework\Model\AbstractModel const STATUS_ERROR = 'error'; + /** + * @var \Magento\Framework\Stdlib\DateTime\DateTime + */ + private $dateTime; + /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data + * @param \Magento\Framework\Stdlib\DateTime\DateTime|null $dateTime */ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, - array $data = [] + array $data = [], + \Magento\Framework\Stdlib\DateTime\DateTime $dateTime = null ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); + $this->dateTime = $dateTime ?: \Magento\Framework\App\ObjectManager::getInstance() + ->get(\Magento\Framework\Stdlib\DateTime\DateTime::class); } /** @@ -101,7 +110,7 @@ public function trySchedule() return false; } if (!is_numeric($time)) { - $time = strtotime($time); + $time = strtotime($time) + $this->dateTime->getGmtOffset(); } $match = $this->matchCronExpression($e[0], strftime('%M', $time)) && $this->matchCronExpression($e[1], strftime('%H', $time)) From a3599fe8757b0511de184d78792bc0e3e40761e4 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Fri, 4 Aug 2017 15:55:04 +0600 Subject: [PATCH 0413/1004] Fixes #10255: base_shipping_discount_tax_compensation_amnt was empty from order onwards --- app/code/Magento/Sales/etc/fieldset.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Sales/etc/fieldset.xml b/app/code/Magento/Sales/etc/fieldset.xml index 3d29575063fef..7ddec847b06fb 100644 --- a/app/code/Magento/Sales/etc/fieldset.xml +++ b/app/code/Magento/Sales/etc/fieldset.xml @@ -279,7 +279,7 @@ - + From 4540f30545c339ccc778ad18f5c0c43b83d75e18 Mon Sep 17 00:00:00 2001 From: Jeroen Alewijns Date: Fri, 4 Aug 2017 13:14:03 +0200 Subject: [PATCH 0414/1004] Update menu.js --- lib/web/mage/menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js index 6b022dec0fa00..c9850a47f19a1 100644 --- a/lib/web/mage/menu.js +++ b/lib/web/mage/menu.js @@ -372,7 +372,7 @@ define([ _toggleDesktopMode: function () { var categoryParent, html; - $(this.element).off('click mouseenter mouseleave'); + $(this.element).off('click mousedown mouseenter mouseleave'); this._on({ /** * Prevent focus from sticking to links inside menu after clicking From 274703ec5ce53e292273dcfd6f9675d1067dbf1f Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 4 Aug 2017 15:30:10 +0300 Subject: [PATCH 0415/1004] magento/magento2#10430: Prevent remove click listener when switch from mobile to desktop mode. - Fixed test failures regarding coding style --- lib/web/mage/menu.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/web/mage/menu.js b/lib/web/mage/menu.js index c9850a47f19a1..b345813b2779c 100644 --- a/lib/web/mage/menu.js +++ b/lib/web/mage/menu.js @@ -323,6 +323,7 @@ define([ $(this.element).off('mouseenter mouseleave'); this._on({ + /** * @param {jQuery.Event} event */ @@ -371,9 +372,10 @@ define([ */ _toggleDesktopMode: function () { var categoryParent, html; - + $(this.element).off('click mousedown mouseenter mouseleave'); this._on({ + /** * Prevent focus from sticking to links inside menu after clicking * them (focus should always stay on UL during navigation). From 10a243bd724afd44aa2e8be2a595c87aec05bd68 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 4 Aug 2017 16:12:37 +0300 Subject: [PATCH 0416/1004] MSI: unit test exampel --- .../Test/Unit/Model/SourceRepositoryTest.php | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php new file mode 100644 index 0000000000000..207199a4c324c --- /dev/null +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -0,0 +1,147 @@ +commandSave = $this->getMockBuilder(SaveInterface::class)->getMock(); + $this->commandGet = $this->getMockBuilder(GetInterface::class)->getMock(); + $this->commandGetList = $this->getMockBuilder(GetListInterface::class)->getMock(); + $this->source = $this->getMockBuilder(SourceInterface::class)->getMock(); + + $this->sourceRepository = (new ObjectManager($this))->getObject( + SourceRepository::class, + [ + 'commandSave' => $this->commandSave, + 'commandGet' => $this->commandGet, + 'commandGetList' => $this->commandGetList, + ] + ); + } + + public function testSave() + { + $sourceId = 42; + + $this->commandSave + ->expects($this->once()) + ->method('execute') + ->with($this->source) + ->willReturn($sourceId); + + self::assertEquals($sourceId, $this->sourceRepository->save($this->source)); + } + + /** + * @expectedException \Magento\Framework\Exception\CouldNotSaveException + * @expectedExceptionMessage Some error + */ + public function testSaveWithCouldNotSaveException() + { + $this->commandSave + ->expects($this->once()) + ->method('execute') + ->with($this->source) + ->willThrowException(new CouldNotSaveException(__('Some error'))); + + $this->sourceRepository->save($this->source); + } + + public function testGet() + { + $sourceId = 42; + + $this->commandGet + ->expects($this->once()) + ->method('execute') + ->with($sourceId) + ->willReturn($this->source); + + self::assertEquals($this->source, $this->sourceRepository->get($sourceId)); + } + + /** + * @expectedException \Magento\Framework\Exception\NoSuchEntityException + * @expectedExceptionMessage Some error + */ + public function testGetWithNoSuchEntityException() + { + $sourceId = 42; + + $this->commandGet + ->expects($this->once()) + ->method('execute') + ->with($sourceId) + ->willThrowException(new NoSuchEntityException(__('Some error'))); + + $this->sourceRepository->get($sourceId); + } + + public function testGetListWithoutSearchCriteria() + { + $searchResult = $this->getMockBuilder(SourceSearchResultsInterface::class)->getMock(); + + $this->commandGetList + ->expects($this->once()) + ->method('execute') + ->with(null) + ->willReturn($searchResult); + + self::assertEquals($searchResult, $this->sourceRepository->getList()); + } + + public function testGetListWithSearchCriteria() + { + $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class)->getMock(); + $searchResult = $this->getMockBuilder(SourceSearchResultsInterface::class)->getMock(); + + $this->commandGetList + ->expects($this->once()) + ->method('execute') + ->with($searchCriteria) + ->willReturn($searchResult); + + self::assertEquals($searchResult, $this->sourceRepository->getList($searchCriteria)); + } +} From ccf7e9c2bce696f64b45c7e83884f65a10ac5ce5 Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 4 Aug 2017 16:25:48 +0300 Subject: [PATCH 0417/1004] MSI: unit test exampel --- .../Test/Unit/Model/SourceRepositoryTest.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php index 207199a4c324c..fe26df702c04b 100644 --- a/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php +++ b/app/code/Magento/Inventory/Test/Unit/Model/SourceRepositoryTest.php @@ -38,6 +38,11 @@ class SourceRepositoryTest extends \PHPUnit_Framework_TestCase */ private $source; + /** + * @var SourceSearchResultsInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $searchResult; + /** * @var SourceRepository */ @@ -49,6 +54,7 @@ protected function setUp() $this->commandGet = $this->getMockBuilder(GetInterface::class)->getMock(); $this->commandGetList = $this->getMockBuilder(GetListInterface::class)->getMock(); $this->source = $this->getMockBuilder(SourceInterface::class)->getMock(); + $this->searchResult = $this->getMockBuilder(SourceSearchResultsInterface::class)->getMock(); $this->sourceRepository = (new ObjectManager($this))->getObject( SourceRepository::class, @@ -120,28 +126,25 @@ public function testGetWithNoSuchEntityException() public function testGetListWithoutSearchCriteria() { - $searchResult = $this->getMockBuilder(SourceSearchResultsInterface::class)->getMock(); - $this->commandGetList ->expects($this->once()) ->method('execute') ->with(null) - ->willReturn($searchResult); + ->willReturn($this->searchResult); - self::assertEquals($searchResult, $this->sourceRepository->getList()); + self::assertEquals($this->searchResult, $this->sourceRepository->getList()); } public function testGetListWithSearchCriteria() { $searchCriteria = $this->getMockBuilder(SearchCriteriaInterface::class)->getMock(); - $searchResult = $this->getMockBuilder(SourceSearchResultsInterface::class)->getMock(); $this->commandGetList ->expects($this->once()) ->method('execute') ->with($searchCriteria) - ->willReturn($searchResult); + ->willReturn($this->searchResult); - self::assertEquals($searchResult, $this->sourceRepository->getList($searchCriteria)); + self::assertEquals($this->searchResult, $this->sourceRepository->getList($searchCriteria)); } } From bcdcd568bc66370170d4c4a38602560f7536baec Mon Sep 17 00:00:00 2001 From: Valeriy Nayda Date: Fri, 4 Aug 2017 17:21:53 +0300 Subject: [PATCH 0418/1004] MSI: Ui components structure refactoring --- .../ui_component/inventory_source_form.xml | 7 +- .../ui_component/inventory_stock_form.xml | 181 +++++++-------- .../adminhtml/ui_component/product_form.xml | 209 ++++++++---------- 3 files changed, 171 insertions(+), 226 deletions(-) diff --git a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml index 12f76b4c64a14..2ab354954fb6f 100644 --- a/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml +++ b/app/code/Magento/Inventory/view/adminhtml/ui_component/inventory_source_form.xml @@ -32,12 +32,7 @@