From 8f72656ff34b751fae5227481de836f269f52270 Mon Sep 17 00:00:00 2001 From: mage2-team <mage2-team@magento.com> Date: Fri, 24 Jan 2014 09:25:27 -0800 Subject: [PATCH] 2.0.0.0-dev62 * Modularity improvements: * Moved all Grouped Product functionality to newly created module GroupedProduct * Moved Multishipping functionality to newly created module Multishipping * Extracted Product duplication behavior from Product model to Product\Copier model * Replaced event "catalog_model_product_duplicate" with composite Product\Copier model * Replaced event "catalog_product_prepare_save" with controller product initialization helper that can be customozed via plugins * Consolidated Authorize.Net functionality in single module Authorizenet * Eliminated dependency of Sales module on Shipping and Usa modules * Eliminated dependency of Shipping module on Customer module * Improved accuracy and quality of Module Dependency Test * Fixed bugs: * Fixed an issue when order was sent to PayPal in USD regardless of currency used during order creation * Fixed an issue with 404 error when clicking any button on a Recurring Billing Profile in the backend * Fixed an issue with synchronization with Google Shopping on product update caused by missed service property * Fixed ability to submit order in the backend when Authorize.Net Direct Post is used * Fixed an issue with notice that _attribute_set column is missing during Import/Export * Removed the deprecated service-calls and data source functionality * Request\Response workflow improvements: * Added Console\Response * Changed behavior of AppInterface to return ResponseInterface instead of sending it --- CHANGELOG.md | 27 + .../AdminNotification/Block/Window.php | 9 + .../Block/Authorizenet/Form/Cc.php | 22 +- .../Block/Authorizenet/Info/Cc.php | 10 +- .../Authorizenet/Directpost/Payment.php | 12 +- .../Adminhtml}/Authorizenet/Payment.php | 30 +- .../Controller/Authorizenet/Payment.php | 32 +- .../Controller/Directpost/Payment.php | 23 +- .../Magento/Authorizenet/Helper/Backend.php | 31 +- app/code/Magento/Authorizenet/Helper/Data.php | 156 +++++ .../Authorizenet/Helper/HelperInterface.php | 12 +- .../Model/Authorizenet.php | 118 ++-- .../Model/Authorizenet/Cards.php | 10 +- .../Model/Authorizenet/Debug.php | 24 +- .../Model/Authorizenet/Request.php | 4 +- .../Model/Authorizenet/Result.php | 4 +- .../Model/Authorizenet/Source/Cctype.php | 6 +- .../Authorizenet/Source/PaymentAction.php | 8 +- .../Magento/Authorizenet/Model/Directpost.php | 33 +- .../Model/Directpost/Observer.php | 8 +- .../Authorizenet/Model/Directpost/Request.php | 4 +- .../Model/Resource/Authorizenet/Debug.php | 8 +- .../Authorizenet/Debug/Collection.php | 11 +- .../Magento/Authorizenet/etc/adminhtml/di.xml | 5 + .../Authorizenet/etc/adminhtml/system.xml | 110 +++- app/code/Magento/Authorizenet/etc/config.xml | 18 + .../Magento/Authorizenet/etc/frontend/di.xml | 12 + app/code/Magento/Authorizenet/etc/module.xml | 3 +- app/code/Magento/Authorizenet/i18n/de_DE.csv | 60 ++ app/code/Magento/Authorizenet/i18n/en_US.csv | 46 ++ app/code/Magento/Authorizenet/i18n/es_ES.csv | 59 ++ app/code/Magento/Authorizenet/i18n/fr_FR.csv | 60 ++ app/code/Magento/Authorizenet/i18n/nl_NL.csv | 61 ++ app/code/Magento/Authorizenet/i18n/pt_BR.csv | 46 ++ app/code/Magento/Authorizenet/i18n/zh_CN.csv | 46 ++ .../view/adminhtml/form/cc.phtml | 0 .../view/adminhtml/info/cc.phtml | 0 .../view/adminhtml/info/pdf.phtml | 0 .../frontend/authorizenet-authenticate.js} | 2 +- .../view/frontend/form/cc.phtml | 4 +- .../view/frontend/info/cc.phtml | 0 ...et_directpost_payment_backendresponse.xml} | 3 +- app/code/Magento/Authz/etc/module.xml | 2 + .../Backend/App/Response/Http/FileFactory.php | 6 +- .../Backend/Block/Template/Context.php | 4 +- .../Backend/Block/Widget/Grid/Export.php | 2 +- .../Backend/Block/Widget/Grid/Extended.php | 2 +- app/code/Magento/Backend/Block/Widget/Tab.php | 86 +++ .../Controller/Adminhtml/System/Config.php | 2 +- .../Controller/Adminhtml/System/Store.php | 3 +- .../Model/Config/Backend/Admin/Robots.php | 6 +- .../Backend/Model/Config/Backend/File.php | 10 +- .../Model/Config/Structure/Element/Field.php | 64 +- app/code/Magento/Backend/etc/module.xml | 13 + app/code/Magento/Backend/etc/system.xsd | 1 - app/code/Magento/Backend/etc/system_file.xsd | 1 - .../Backup/Controller/Adminhtml/Index.php | 6 +- app/code/Magento/Backup/Helper/Data.php | 36 +- app/code/Magento/Backup/Model/Backup.php | 14 +- .../Magento/Backup/Model/Fs/Collection.php | 6 +- app/code/Magento/Backup/Model/Observer.php | 8 +- app/code/Magento/Backup/etc/module.xml | 1 + .../Catalog/Product/View/Type/Bundle.php | 7 +- .../Block/Checkout/Cart/Item/Renderer.php | 1 + .../Initialization/Helper/Plugin/Bundle.php | 74 +++ app/code/Magento/Bundle/Model/Observer.php | 93 --- .../Model/Product/CopyConstructor/Bundle.php | 80 +++ .../Magento/Bundle/Model/Product/Type.php | 4 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 4 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 4 +- .../Model/Sales/Order/Pdf/Items/Shipment.php | 4 +- app/code/Magento/Bundle/etc/adminhtml/di.xml | 10 + .../Magento/Bundle/etc/adminhtml/events.xml | 6 - app/code/Magento/Bundle/etc/module.xml | 2 + .../mysql4-upgrade-1.6.0.0-1.6.0.0.1.php | 2 +- .../view/frontend/catalog/product/price.phtml | 62 +- ...l => multishipping_checkout_addresses.xml} | 2 +- ...ml => multishipping_checkout_overview.xml} | 2 +- ...ml => multishipping_checkout_shipping.xml} | 4 +- .../Magento/Captcha/Helper/Adminhtml/Data.php | 4 +- app/code/Magento/Captcha/Helper/Data.php | 12 +- app/code/Magento/Captcha/Model/Cron.php | 6 +- .../Catalog/Block/Adminhtml/Product/Edit.php | 5 - .../Adminhtml/Product/Edit/Tab/Alerts.php | 14 +- .../Adminhtml/Product/Edit/Tab/Attributes.php | 1 + .../Block/Adminhtml/Product/Edit/Tabs.php | 26 +- .../Adminhtml/Product/Edit/Tabs/Grouped.php | 48 -- .../Product/Helper/Form/Category.php | 9 +- .../Adminhtml/Product/Helper/Form/Weight.php | 3 + app/code/Magento/Catalog/Block/Navigation.php | 1 + .../Catalog/Block/Product/AbstractProduct.php | 23 +- .../Block/Product/Compare/ListCompare.php | 20 +- .../Magento/Catalog/Block/Product/Gallery.php | 2 +- .../Catalog/Block/Product/ListProduct.php | 7 +- .../Catalog/Block/Product/NewProduct.php | 8 +- .../Catalog/Block/Product/Price/Template.php | 14 + .../Block/Product/ProductList/Promotion.php | 7 +- .../Block/Product/ProductList/Random.php | 7 +- .../Block/Product/ProductList/Related.php | 8 +- .../Block/Product/ProductList/Toolbar.php | 1 + .../Block/Product/ProductList/Upsell.php | 8 +- .../Magento/Catalog/Block/Product/Send.php | 8 +- .../Magento/Catalog/Block/Product/View.php | 29 +- .../Block/Product/View/AbstractView.php | 8 +- .../Block/Product/View/Type/Configurable.php | 61 +- .../Catalog/Controller/Adminhtml/Product.php | 234 ++----- .../Controller/Adminhtml/Product/Gallery.php | 2 +- .../Product/Initialization/Helper.php | 145 +++++ .../Helper/Plugin/Configurable.php | 69 ++ .../Initialization/Helper/ProductLinks.php | 73 +++ .../Initialization/StockDataFilter.php | 77 +++ .../Catalog/Helper/Product/Compare.php | 66 +- .../Catalog/Helper/Product/Configuration.php | 54 +- .../Catalog/Helper/Product/Options.php | 6 +- .../Magento/Catalog/Helper/Product/Price.php | 152 +++++ .../Category/Attribute/Backend/Image.php | 8 +- app/code/Magento/Catalog/Model/Product.php | 195 +----- .../Model/Product/Attribute/Backend/Media.php | 6 +- .../Magento/Catalog/Model/Product/Copier.php | 81 +++ .../Product/CopyConstructor/Composite.php | 60 ++ .../Product/CopyConstructor/CrossSell.php | 52 ++ .../Model/Product/CopyConstructor/Related.php | 53 ++ .../Model/Product/CopyConstructor/UpSell.php | 52 ++ .../Model/Product/CopyConstructorFactory.php} | 38 +- .../Product/CopyConstructorInterface.php} | 17 +- .../Magento/Catalog/Model/Product/Image.php | 6 +- .../Magento/Catalog/Model/Product/Link.php | 22 - .../Model/Product/Option/Type/File.php | 14 +- .../Magento/Catalog/Model/Product/Type.php | 1 - .../Model/Product/Type/AbstractType.php | 12 +- .../Model/Product/Type/Configurable.php | 4 +- .../Catalog/Model/ProductTypes/Config.php | 15 +- .../Model/ProductTypes/ConfigInterface.php | 8 + .../Product/Attribute/Backend/Image.php | 8 +- .../Catalog/Model/Resource/Product/Link.php | 45 +- .../Magento/Catalog/Model/Resource/Setup.php | 6 +- .../catalog_setup/data-install-1.6.0.0.php | 14 - app/code/Magento/Catalog/etc/adminhtml/di.xml | 18 +- app/code/Magento/Catalog/etc/module.xml | 2 + .../Magento/Catalog/etc/product_types.xml | 8 - app/code/Magento/Catalog/i18n/de_DE.csv | 2 - app/code/Magento/Catalog/i18n/en_US.csv | 2 - app/code/Magento/Catalog/i18n/es_ES.csv | 2 - app/code/Magento/Catalog/i18n/fr_FR.csv | 2 - app/code/Magento/Catalog/i18n/nl_NL.csv | 2 - app/code/Magento/Catalog/i18n/pt_BR.csv | 2 - app/code/Magento/Catalog/i18n/zh_CN.csv | 2 - .../mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php | 2 +- .../upgrade-1.6.0.0.1-1.6.0.0.2.php | 2 +- .../catalog/product/edit/super/config.phtml | 32 +- .../adminhtml/catalog/product/price.phtml | 68 +- .../view/adminhtml/catalog/type-switcher.js | 35 +- .../adminhtml/layout/catalog_product_new.xml | 17 +- .../view/adminhtml/product/product.css | 23 - .../Magento/Catalog/view/frontend/js/msrp.js | 1 - .../view/frontend/product/compare/list.phtml | 7 +- .../frontend/product/compare/sidebar.phtml | 25 +- .../Catalog/view/frontend/product/list.phtml | 30 +- .../view/frontend/product/list/items.phtml | 31 +- .../view/frontend/product/listing.phtml | 4 +- .../Catalog/view/frontend/product/price.phtml | 591 ++++++++---------- .../view/frontend/product/view/addto.phtml | 20 +- .../frontend/product/view/addtocart.phtml | 40 +- .../frontend/product/view/tierprices.phtml | 11 +- .../view/frontend/product/view/validation.js | 17 +- .../widget/new/column/new_default_list.phtml | 19 +- .../product/widget/new/content/new_grid.phtml | 37 +- .../product/widget/new/content/new_list.phtml | 35 +- .../view/frontend/rss/product/price.phtml | 62 +- .../Block/Adminhtml/Form/Field/Stock.php | 7 +- .../CatalogInventory/Model/Observer.php | 36 +- .../CopyConstructor/CatalogInventory.php | 56 ++ .../Model/Resource/Indexer/Stock/Grouped.php | 3 +- .../CatalogInventory/etc/adminhtml/di.xml | 7 + .../Magento/CatalogInventory/etc/events.xml | 3 - .../Magento/CatalogInventory/etc/module.xml | 1 + .../CatalogInventory/etc/product_types.xml | 3 - .../Magento/CatalogRule/Model/Observer.php | 14 +- app/code/Magento/CatalogRule/Model/Rule.php | 20 +- .../CatalogSearch/Model/Resource/Fulltext.php | 10 +- .../Model/Resource/Fulltext/Engine.php | 20 +- .../Magento/Centinel/Block/Authentication.php | 1 + app/code/Magento/Centinel/etc/module.xml | 1 + ...ml => multishipping_checkout_overview.xml} | 0 .../Magento/Checkout/Block/Agreements.php | 10 +- app/code/Magento/Checkout/Block/Cart.php | 1 + .../Checkout/Block/Cart/AbstractCart.php | 1 + .../Magento/Checkout/Block/Cart/Coupon.php | 18 + .../Magento/Checkout/Block/Cart/Crosssell.php | 10 +- .../Checkout/Block/Cart/Item/Renderer.php | 1 + .../Block/Cart/Item/Renderer/Configurable.php | 30 + .../Block/Cart/Item/Renderer/Grouped.php | 30 + .../Magento/Checkout/Block/Cart/Shipping.php | 13 +- .../Magento/Checkout/Block/Cart/Sidebar.php | 1 + .../Magento/Checkout/Block/Cart/Totals.php | 1 + app/code/Magento/Checkout/Block/Onepage.php | 32 + .../Block/Onepage/AbstractOnepage.php | 21 +- .../Checkout/Block/Onepage/Billing.php | 15 +- .../Checkout/Block/Onepage/Failure.php | 1 + .../Magento/Checkout/Block/Onepage/Link.php | 1 + .../Magento/Checkout/Block/Onepage/Login.php | 13 +- .../Checkout/Block/Onepage/Payment/Info.php | 3 +- .../Block/Onepage/Payment/Methods.php | 1 + .../Checkout/Block/Onepage/Review/Info.php | 1 + .../Checkout/Block/Onepage/Shipping.php | 13 +- .../Onepage/Shipping/Method/Available.php | 13 +- .../Checkout/Block/Onepage/Success.php | 1 + .../Magento/Checkout/Controller/Action.php | 2 +- app/code/Magento/Checkout/Helper/Data.php | 10 +- app/code/Magento/Checkout/Helper/Url.php | 34 - .../Magento/Checkout/Model/Resource/Setup.php | 6 +- app/code/Magento/Checkout/etc/frontend/di.xml | 1 - .../Checkout/etc/frontend/page_types.xml | 15 - app/code/Magento/Checkout/etc/module.xml | 5 + .../sql/checkout_setup/install-1.6.0.0.php | 154 ----- .../cart/item/configure/updatecart.phtml | 4 +- .../view/frontend/cart/item/default.phtml | 2 +- .../frontend/layout/checkout_cart_index.xml | 1 - .../Controller/Adminhtml/Wysiwyg/Images.php | 6 +- .../Magento/Cms/Helper/Wysiwyg/Images.php | 6 +- .../Cms/Model/Wysiwyg/Images/Storage.php | 84 ++- .../Wysiwyg/Images/Storage/Collection.php | 8 +- app/code/Magento/Cms/etc/module.xml | 2 + app/code/Magento/Connect/Helper/Data.php | 8 +- app/code/Magento/Connect/Model/Extension.php | 8 +- .../Connect/Model/Extension/Collection.php | 8 +- app/code/Magento/Contacts/etc/module.xml | 1 + .../Plugin/DispatchExceptionHandler.php | 4 +- app/code/Magento/Core/App/Media.php | 35 +- app/code/Magento/Core/Block/Formkey.php | 1 + app/code/Magento/Core/Helper/File/Media.php | 8 +- .../Core/Helper/File/Storage/Database.php | 10 +- app/code/Magento/Core/Helper/PostData.php | 84 +++ app/code/Magento/Core/Helper/Theme.php | 14 +- app/code/Magento/Core/Model/AbstractShell.php | 6 +- app/code/Magento/Core/Model/App.php | 10 +- .../Model/Asset/Plugin/CleanMergedJsCss.php | 8 +- .../Core/Model/Config/FileResolver.php | 6 +- .../Magento/Core/Model/DataService/Config.php | 166 ----- .../Core/Model/DataService/Config/Reader.php | 122 ---- .../Magento/Core/Model/DataService/Graph.php | 132 ---- .../Core/Model/DataService/Invoker.php | 146 ----- .../Core/Model/DataService/Path/Composite.php | 62 -- .../Core/Model/DataService/Path/Navigator.php | 72 --- .../Model/DataService/Path/NodeInterface.php | 41 -- .../Core/Model/DataService/Path/Request.php | 64 -- .../Core/Model/DataService/Repository.php | 118 ---- app/code/Magento/Core/Model/File/Storage.php | 10 +- .../Core/Model/File/Storage/Config.php | 6 +- .../Core/Model/File/Storage/Response.php | 41 +- .../Model/File/Storage/Synchronization.php | 6 +- app/code/Magento/Core/Model/Layout.php | 67 +- app/code/Magento/Core/Model/Layout/Merge.php | 8 +- .../Locale/Hierarchy/Config/FileResolver.php | 6 +- .../Core/Model/Resource/File/Storage/File.php | 16 +- .../Magento/Core/Model/Resource/Setup.php | 6 +- .../Core/Model/Resource/Setup/Context.php | 8 +- .../Core/Model/Resource/Setup/Migration.php | 2 +- .../Core/Model/Resource/Type/Db/Pdo/Mysql.php | 6 +- .../Magento/Core/Model/Session/Config.php | 6 +- app/code/Magento/Core/Model/Store.php | 20 +- .../Magento/Core/Model/Theme/Collection.php | 6 +- .../Magento/Core/Model/Theme/Image/Path.php | 10 +- .../Magento/Core/Model/Theme/Registration.php | 6 +- app/code/Magento/Core/Model/Translate.php | 12 +- app/code/Magento/Core/etc/config.xml | 70 +-- app/code/Magento/Core/etc/di.xml | 1 - app/code/Magento/Core/etc/layouts.xsd | 12 - app/code/Magento/Core/etc/module.xml | 2 + app/code/Magento/Core/etc/service_calls.xsd | 71 --- .../Block/Account/AuthorizationLink.php | 1 + .../Customer/Block/Account/Customer.php | 1 + .../Customer/Block/Account/Dashboard.php | 1 + .../Block/Account/Dashboard/Address.php | 1 + .../Block/Account/Dashboard/Block.php | 12 +- .../Block/Account/Dashboard/Hello.php | 1 + .../Customer/Block/Account/Dashboard/Info.php | 1 + .../Block/Account/Dashboard/Newsletter.php | 1 + .../Block/Account/Dashboard/Sidebar.php | 3 +- .../Customer/Block/Account/Forgotpassword.php | 12 +- .../Magento/Customer/Block/Account/Link.php | 1 + .../Customer/Block/Account/RegisterLink.php | 1 + .../Customer/Block/Account/Resetpassword.php | 12 +- .../Magento/Customer/Block/Address/Book.php | 1 + .../Magento/Customer/Block/Address/Edit.php | 11 +- .../Address/Renderer/DefaultRenderer.php | 1 + app/code/Magento/Customer/Block/Form/Edit.php | 16 +- .../Magento/Customer/Block/Form/Login.php | 1 + .../Magento/Customer/Block/Form/Register.php | 13 +- .../Magento/Customer/Block/Newsletter.php | 17 +- .../Customer/Block/Widget/AbstractWidget.php | 1 + .../Magento/Customer/Block/Widget/Dob.php | 16 + .../Magento/Customer/Block/Widget/Gender.php | 1 + .../Magento/Customer/Block/Widget/Name.php | 1 + .../Magento/Customer/Block/Widget/Taxvat.php | 1 + .../Customer/Controller/Adminhtml/Index.php | 12 +- .../Model/Customer/Attribute/Source/Group.php | 6 +- .../Model/Customer/Attribute/Source/Store.php | 6 +- .../Customer/Attribute/Source/Website.php | 6 +- .../Address/Attribute/Source/Country.php | 6 +- .../Address/Attribute/Source/Region.php | 6 +- .../Magento/Customer/Model/Resource/Setup.php | 6 +- app/code/Magento/Customer/etc/module.xml | 5 + .../Editor/Tools/Controls/Configuration.php | 8 +- .../Model/Editor/Tools/Controls/Factory.php | 8 +- .../Tools/QuickStyles/ImageUploader.php | 8 +- app/code/Magento/Directory/Block/Currency.php | 1 + app/code/Magento/Directory/Block/Data.php | 22 +- app/code/Magento/Directory/Helper/Data.php | 12 +- .../Model/Config/Source/Allregion.php | 20 +- app/code/Magento/Directory/Model/Country.php | 10 +- app/code/Magento/Directory/etc/module.xml | 1 + .../Catalog/Product/Edit/Tab/Downloadable.php | 20 +- .../Block/Catalog/Product/Links.php | 8 +- .../Block/Customer/Products/ListProducts.php | 1 + .../Helper/Plugin/Downloadable.php} | 33 +- .../Magento/Downloadable/Helper/Download.php | 10 +- app/code/Magento/Downloadable/Helper/File.php | 8 +- .../Magento/Downloadable/Model/Observer.php | 67 -- .../Product/CopyConstructor/Downloadable.php | 109 ++++ .../Downloadable/Model/Product/Type.php | 4 +- .../Sales/Order/Pdf/Items/AbstractItems.php | 4 +- .../Sales/Order/Pdf/Items/Creditmemo.php | 4 +- .../Model/Sales/Order/Pdf/Items/Invoice.php | 4 +- .../etc/adminhtml}/di.xml | 19 +- .../Downloadable/etc/adminhtml/events.xml | 6 - app/code/Magento/Downloadable/etc/module.xml | 1 + .../mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php | 2 +- .../adminhtml/product/edit/downloadable.phtml | 2 +- .../frontend/checkout/cart/item/default.phtml | 2 +- ...l => multishipping_checkout_addresses.xml} | 0 ...ml => multishipping_checkout_overview.xml} | 0 ...ml => multishipping_checkout_shipping.xml} | 0 ...xml => multishipping_checkout_success.xml} | 0 .../Attribute/Edit/Options/Options.php | 12 +- .../Magento/Eav/Model/Attribute/Data/File.php | 6 +- .../Model/Entity/Attribute/Source/Store.php | 16 +- .../Model/Entity/Attribute/Source/Table.php | 10 +- app/code/Magento/Eav/Model/Entity/Setup.php | 10 +- .../Magento/Email/Model/BackendTemplate.php | 4 +- app/code/Magento/Email/Model/Template.php | 10 +- .../Model/Template/Config/FileResolver.php | 6 +- app/code/Magento/Email/etc/module.xml | 2 + .../GiftMessage/Block/Message/Inline.php | 1 + .../Message/Multishipping/Plugin/ItemsBox.php | 63 ++ .../Magento/GiftMessage/Helper/Message.php | 4 +- .../GiftMessage/Model/Resource/Setup.php | 6 +- .../Magento/GiftMessage/etc/frontend/di.xml | 3 + .../GiftMessage/view/frontend/inline.phtml | 2 - .../GoogleAdwords/etc/frontend/events.xml | 2 +- .../GoogleAnalytics/etc/frontend/events.xml | 2 +- .../Magento/GoogleCheckout/Block/Link.php | 1 + .../GoogleCheckout/Model/Api/Xml/Callback.php | 14 +- .../GoogleCheckout/Model/Api/Xml/Checkout.php | 11 +- .../Magento/GoogleCheckout/Model/Shipping.php | 4 +- .../Magento/GoogleShopping/Helper/Price.php | 4 +- .../Magento/GoogleShopping/Model/Service.php | 23 +- .../GoogleShopping/Model/Service/Item.php | 4 +- .../Magento/GoogleShopping/etc/module.xml | 2 + .../Product/Composite/Fieldset/Grouped.php | 39 +- .../Product/Grouped/AssociatedProducts.php | 2 +- .../ListAssociatedProducts.php | 2 +- .../Block/Product/View/Type/Grouped.php | 41 +- .../Controller/Adminhtml/Edit.php | 107 ++++ .../Helper/ProductLinks/Plugin/Grouped.php | 58 ++ .../Product/Configuration/Plugin/Grouped.php | 71 +++ .../Model/Product/CopyConstructor/Grouped.php | 78 +++ .../Model/Product/Type/Grouped.php | 98 ++- .../Model/Product/Type/Grouped/Backend.php | 8 +- .../Model/Product/Type/Grouped/Price.php | 15 +- .../Config/Converter/Plugin/Grouped.php} | 29 +- .../Product/Indexer/Price/Grouped.php | 24 +- .../Model/Resource/Product/Link.php | 104 +++ .../Grouped/AssociatedProductsCollection.php | 14 +- .../data-install-0.0.1.php | 62 ++ .../GroupedProduct/etc/adminhtml/di.xml | 38 ++ .../etc/adminhtml/routes.xml | 4 +- .../frontend => GroupedProduct/etc}/di.xml | 16 +- .../GroupedProduct/etc/frontend/di.xml | 47 ++ .../Magento/GroupedProduct}/etc/module.xml | 16 +- .../etc/product_types.xml} | 15 +- .../Magento/GroupedProduct/i18n/de_DE.csv | 2 + .../Magento/GroupedProduct/i18n/en_US.csv | 2 + .../Magento/GroupedProduct/i18n/es_ES.csv | 2 + .../Magento/GroupedProduct/i18n/fr_FR.csv | 2 + .../Magento/GroupedProduct/i18n/nl_NL.csv | 2 + .../Magento/GroupedProduct/i18n/pt_BR.csv | 2 + .../Magento/GroupedProduct/i18n/zh_CN.csv | 2 + .../groupedproduct_setup/install-0.0.1.php} | 11 +- .../product/composite/fieldset/grouped.phtml | 4 +- .../view/adminhtml/css/grouped-product.css | 42 ++ .../view/adminhtml/js/grouped-product.js | 0 .../layout/catalog_product_grouped.xml | 25 +- .../catalog_product_view_type_grouped.xml | 2 +- .../layout/groupedproduct_edit_popup.xml} | 2 +- .../layout/groupedproduct_popup_grid.xml} | 4 +- .../adminhtml/product/grouped/container.phtml | 2 +- .../adminhtml/product/grouped/grouped.phtml | 2 +- .../view/adminhtml/product/grouped/list.phtml | 2 +- .../catalog_product_view_type_grouped.xml | 2 +- .../frontend/layout/rss_catalog_category.xml | 34 + .../view/frontend/layout/rss_catalog_new.xml | 34 + .../view/frontend/product/price.phtml | 83 +++ .../frontend/product/view/type/grouped.phtml | 6 +- .../view/frontend/rss/product/price.phtml | 67 ++ .../Controller/Adminhtml/Export.php | 2 +- .../Controller/Adminhtml/Import.php | 3 +- .../ImportExport/Model/AbstractModel.php | 6 +- .../Magento/ImportExport/Model/Export.php | 4 +- .../Model/Export/Adapter/AbstractAdapter.php | 6 +- .../Model/Export/Entity/Product.php | 4 +- .../Magento/ImportExport/Model/Import.php | 8 +- .../Model/Import/Entity/Product.php | 12 +- .../Import/Entity/Product/Type/Grouped.php | 2 +- .../ImportExport/Model/Import/Uploader.php | 4 +- app/code/Magento/ImportExport/etc/module.xml | 1 + app/code/Magento/Index/App/Indexer.php | 24 +- app/code/Magento/Index/App/Shell.php | 26 +- app/code/Magento/Index/Model/Lock/Storage.php | 6 +- app/code/Magento/Index/Model/Shell.php | 4 +- .../Magento/Install/App/Action/Plugin/Dir.php | 2 +- app/code/Magento/Install/App/Console.php | 28 +- .../Magento/Install/Block/AbstractBlock.php | 1 + app/code/Magento/Install/Block/Begin.php | 2 +- app/code/Magento/Install/Block/Download.php | 2 +- app/code/Magento/Install/Block/State.php | 2 +- app/code/Magento/Install/Model/Config.php | 6 +- .../Install/Model/Installer/Config.php | 18 +- .../Install/Model/Installer/Console.php | 12 +- .../Install/Model/Installer/Filesystem.php | 8 +- app/code/Magento/Install/etc/module.xml | 1 + app/code/Magento/Integration/etc/module.xml | 2 + app/code/Magento/Log/App/Shell.php | 16 +- app/code/Magento/Log/Model/Shell.php | 4 +- app/code/Magento/Log/etc/module.xml | 1 + .../Block/Checkout}/AbstractMultishipping.php | 10 +- .../Block/Checkout}/Address/Select.php | 11 +- .../Block/Checkout}/Addresses.php | 13 +- .../Block/Checkout}/Billing.php | 11 +- .../Block/Checkout}/Billing/Items.php | 11 +- .../Block/Checkout}/Link.php | 5 +- .../Block/Checkout}/Overview.php | 17 +- .../Block/Checkout}/Payment/Info.php | 8 +- .../Block/Checkout}/Shipping.php | 24 +- .../Block/Checkout}/State.php | 8 +- .../Block/Checkout}/Success.php | 9 +- .../Controller/Checkout.php} | 103 ++- .../Controller/Checkout}/Address.php | 32 +- app/code/Magento/Multishipping/Helper/Url.php | 95 +++ .../Model/Checkout}/Type/Multishipping.php | 26 +- .../Checkout}/Type/Multishipping/State.php | 12 +- .../etc/frontend}/di.xml | 8 +- .../Multishipping/etc/frontend/page_types.xml | 42 ++ .../etc/frontend/routes.xml | 6 +- .../{Paygate => Multishipping}/etc/module.xml | 12 +- .../frontend/checkout}/address/select.phtml | 0 .../view/frontend/checkout}/addresses.phtml | 4 +- .../view/frontend/checkout}/billing.phtml | 2 +- .../frontend/checkout}/billing/items.phtml | 0 .../frontend/checkout}/item/default.phtml | 0 .../view/frontend/checkout}/link.phtml | 0 .../view/frontend/checkout}/overview.phtml | 2 +- .../frontend/checkout}/overview/item.phtml | 0 .../view/frontend/checkout}/shipping.phtml | 5 +- .../view/frontend/checkout}/state.phtml | 2 +- .../view/frontend/checkout}/success.phtml | 0 .../view/frontend/js/multi-shipping.js | 0 .../frontend/layout/checkout_cart_index.xml} | 4 +- .../layout/multishipping_checkout.xml} | 2 +- ...shipping_checkout_address_editaddress.xml} | 4 +- ...shipping_checkout_address_editbilling.xml} | 4 +- ...hipping_checkout_address_editshipping.xml} | 4 +- ...ishipping_checkout_address_newbilling.xml} | 4 +- ...shipping_checkout_address_newshipping.xml} | 4 +- ...multishipping_checkout_address_select.xml} | 4 +- ...ipping_checkout_address_selectbilling.xml} | 4 +- .../multishipping_checkout_addresses.xml} | 10 +- .../multishipping_checkout_billing.xml} | 4 +- ...ltishipping_checkout_customer_address.xml} | 0 .../layout/multishipping_checkout_login.xml} | 0 .../multishipping_checkout_overview.xml} | 16 +- .../multishipping_checkout_register.xml} | 0 .../multishipping_checkout_shipping.xml} | 18 +- .../multishipping_checkout_success.xml} | 4 +- .../frontend/multishipping/item/default.phtml | 47 ++ .../Magento/Newsletter/Block/Subscribe.php | 1 + .../Controller/Adminhtml/Subscriber.php | 12 +- app/code/Magento/Newsletter/etc/module.xml | 3 + app/code/Magento/Ogone/Block/Placeform.php | 1 + .../Controller/Adminhtml/PageCache.php | 69 -- app/code/Magento/PageCache/Helper/Data.php | 135 ---- .../App/FrontController/HeaderPlugin.php | 83 +++ .../PageCache/Model/CacheControlFactory.php | 101 --- app/code/Magento/PageCache/Model/Observer.php | 150 ----- .../Model/System/Config/Source/Controls.php | 70 --- .../Magento/PageCache/etc/adminhtml/acl.xml | 36 -- .../PageCache/etc/adminhtml/system.xml | 54 -- app/code/Magento/PageCache/etc/config.xml | 8 +- app/code/Magento/PageCache/etc/di.xml | 14 +- app/code/Magento/PageCache/etc/module.xml | 3 +- .../view/adminhtml/cache/additional.phtml | 39 -- .../PageCache/view/frontend/cookie.phtml | 40 -- app/code/Magento/Paygate/Helper/Data.php | 149 ----- .../Magento/Paygate/etc/adminhtml/system.xml | 139 ---- app/code/Magento/Paygate/etc/config.xml | 51 -- app/code/Magento/Paygate/i18n/de_DE.csv | 65 -- app/code/Magento/Paygate/i18n/en_US.csv | 65 -- app/code/Magento/Paygate/i18n/es_ES.csv | 65 -- app/code/Magento/Paygate/i18n/fr_FR.csv | 65 -- app/code/Magento/Paygate/i18n/nl_NL.csv | 65 -- app/code/Magento/Paygate/i18n/pt_BR.csv | 65 -- app/code/Magento/Paygate/i18n/zh_CN.csv | 65 -- app/code/Magento/Payment/Helper/Data.php | 21 +- app/code/Magento/Payment/etc/module.xml | 2 +- .../Magento/Paypal/Block/Express/Form.php | 1 + .../Magento/Paypal/Block/Express/Shortcut.php | 11 +- app/code/Magento/Paypal/Block/Iframe.php | 3 +- app/code/Magento/Paypal/Model/Api/Nvp.php | 2 +- app/code/Magento/Paypal/Model/Cert.php | 6 +- .../Magento/Paypal/Model/Method/Agreement.php | 6 +- .../Paypal/Model/Report/Settlement.php | 6 +- .../Model/System/Config/Backend/Cert.php | 6 +- .../System/Config/Source/BuyerCountry.php | 10 +- .../System/Config/Source/MerchantCountry.php | 10 +- app/code/Magento/Paypal/etc/module.xml | 2 +- app/code/Magento/PaypalUk/etc/module.xml | 1 - .../Persistent/Block/Header/Additional.php | 1 + .../Persistent/Model/Persistent/Config.php | 6 +- .../Persistent/etc/frontend/events.xml | 2 +- app/code/Magento/ProductAlert/etc/module.xml | 1 + app/code/Magento/Rating/etc/module.xml | 1 + .../Reports/Block/Product/AbstractProduct.php | 8 +- .../Reports/Controller/Adminhtml/Index.php | 4 +- .../Controller/Adminhtml/Report/Customer.php | 4 +- .../Controller/Adminhtml/Report/Review.php | 12 +- app/code/Magento/Reports/etc/module.xml | 4 + .../reports_setup/mysql4-install-1.6.0.0.php | 2 +- .../column/compared_default_list.phtml | 19 +- .../compared/content/compared_grid.phtml | 39 +- .../compared/content/compared_list.phtml | 37 +- .../viewed/column/viewed_default_list.phtml | 15 +- .../widget/viewed/content/viewed_grid.phtml | 31 +- .../widget/viewed/content/viewed_list.phtml | 35 +- .../Review/Block/Customer/ListCustomer.php | 1 + .../Magento/Review/Block/Customer/Recent.php | 1 + .../Magento/Review/Block/Customer/View.php | 8 +- app/code/Magento/Review/Block/Form.php | 1 + .../Magento/Review/Block/Product/View.php | 19 +- app/code/Magento/Review/Block/View.php | 7 +- app/code/Magento/Review/etc/module.xml | 2 + app/code/Magento/Rss/Block/AbstractBlock.php | 1 + .../Rss/Block/Catalog/AbstractCatalog.php | 1 + app/code/Magento/Rss/Block/ListBlock.php | 1 + app/code/Magento/Rss/Block/Wishlist.php | 7 +- app/code/Magento/Rss/etc/module.xml | 2 + .../Block/Adminhtml/Order/Comments/View.php | 2 +- .../Order/Create/Search/Grid/Renderer/Qty.php | 2 +- .../Adminhtml/Order/Invoice/Create/Form.php | 7 - .../Order/Invoice/Create/Tracking.php | 126 ---- .../Sales/Block/Adminhtml/Order/View.php | 2 +- .../Adminhtml/Order/View/Tab/Shipments.php | 2 +- .../Adminhtml/Recurring/Profile/View.php | 10 +- .../Recurring/Profile/View/Tab/Orders.php | 2 +- .../Sales/Block/Adminhtml/Shipment/Grid.php | 2 +- .../Sales/Block/Billing/Agreement/View.php | 1 + .../Sales/Block/Billing/Agreements.php | 1 + app/code/Magento/Sales/Block/Guest/Link.php | 1 + .../Magento/Sales/Block/Order/Comments.php | 51 +- .../Magento/Sales/Block/Order/Creditmemo.php | 1 + .../Sales/Block/Order/Creditmemo/Totals.php | 14 + .../Magento/Sales/Block/Order/History.php | 1 + .../Sales/Block/Order/Info/Buttons.php | 1 + .../Magento/Sales/Block/Order/Invoice.php | 1 + .../Sales/Block/Order/Invoice/Totals.php | 14 + app/code/Magento/Sales/Block/Order/Recent.php | 1 + app/code/Magento/Sales/Block/Order/View.php | 1 + .../Block/Payment/Form/Billing/Agreement.php | 1 + .../Sales/Block/Recurring/Profile/Grid.php | 2 +- .../Recurring/Profile/Related/Orders/Grid.php | 1 + .../Sales/Block/Recurring/Profiles.php | 12 + .../Magento/Sales/Block/Reorder/Sidebar.php | 1 + .../Magento/Sales/Block/Widget/Guest/Form.php | 1 + .../Creditmemo/AbstractCreditmemo.php | 4 +- .../Adminhtml/Invoice/AbstractInvoice.php | 4 +- .../Sales/Controller/Adminhtml/Order.php | 12 +- .../Adminhtml/Shipment/AbstractShipment.php | 11 +- .../Magento/Sales/Controller/Download.php | 16 +- .../Magento/Sales/Model/AdminOrder/Create.php | 2 +- .../Magento/Sales/Model/CarrierFactory.php | 75 --- app/code/Magento/Sales/Model/Observer.php | 58 +- app/code/Magento/Sales/Model/Order.php | 131 ++-- app/code/Magento/Sales/Model/Order/Config.php | 14 +- .../Magento/Sales/Model/Order/Creditmemo.php | 20 +- .../Magento/Sales/Model/Order/Invoice.php | 20 +- .../Magento/Sales/Model/Order/Payment.php | 10 +- .../Sales/Model/Order/Pdf/AbstractPdf.php | 28 +- .../Sales/Model/Order/Pdf/Creditmemo.php | 7 +- .../Magento/Sales/Model/Order/Pdf/Invoice.php | 7 +- .../Model/Order/Pdf/Items/AbstractItems.php | 6 +- .../Items/Creditmemo/DefaultCreditmemo.php | 4 +- .../Pdf/Items/Invoice/DefaultInvoice.php | 4 +- .../Pdf/Items/Shipment/DefaultShipment.php | 4 +- .../Sales/Model/Order/Pdf/Shipment.php | 7 +- .../Magento/Sales/Model/Order/Shipment.php | 40 +- .../Sales/Model/Order/Shipment/Track.php | 33 - app/code/Magento/Sales/Model/Quote.php | 20 +- .../Magento/Sales/Model/Quote/Address.php | 46 +- .../Address/AbstractCarrierInterface.php | 211 +++++++ .../Quote/Address/CarrierFactoryInterface.php | 61 ++ .../Sales/Model/Quote/Address/Rate.php | 12 +- .../Quote/Address/RateCollectorInterface.php | 33 + .../Sales/Model/Quote/Address/RateRequest.php | 134 ++++ .../Address/RateResult}/AbstractResult.php | 7 +- .../Model/Quote/Address/RateResult}/Error.php | 9 +- .../Quote/Address/RateResult}/Method.php | 10 +- .../Resource/Order/Grid/StatusesArray.php | 10 +- .../Quote/Address/Rate/Collection.php | 26 +- .../Model/Resource/Quote/Item/Collection.php | 20 +- .../Model/Resource/Report/Bestsellers.php | 2 +- .../Sales/Model/Resource/Sale/Collection.php | 8 +- .../Magento/Sales/Model/Resource/Setup.php | 6 +- app/code/Magento/Sales/etc/module.xml | 7 +- .../layout/sales_order_grid_block.xml | 2 +- .../order/create/sidebar/items.phtml | 6 +- .../order/invoice/create/tracking.phtml | 105 ---- .../order/shipment/create/tracking.phtml | 104 --- .../order/shipment/tracking/info.phtml | 64 -- .../view/adminhtml/order/view/info.phtml | 2 +- .../view/adminhtml/order/view/tab/info.phtml | 33 +- .../view/adminhtml/order/view/tracking.phtml | 48 -- .../Sales/view/email/shipment_new.html | 2 +- .../Sales/view/email/shipment_new_guest.html | 2 +- .../frontend/layout/sales_guest_shipment.xml | 6 - .../frontend/layout/sales_order_shipment.xml | 6 - .../view/frontend/order/trackinginfo.phtml | 63 -- .../Sales/view/frontend/order/view.phtml | 8 +- .../Controller/Adminhtml/Promo/Quote.php | 8 +- app/code/Magento/SalesRule/etc/module.xml | 2 + app/code/Magento/Sendfriend/Block/Send.php | 1 + app/code/Magento/Sendfriend/etc/module.xml | 2 + .../Block/Adminhtml}/Create.php | 3 +- .../Block/Adminhtml}/Create/Form.php | 7 +- .../Block/Adminhtml}/Create/Items.php | 14 +- .../Block/Adminhtml/Order}/Packaging.php | 54 +- .../Block/Adminhtml/Order}/Packaging/Grid.php | 15 +- .../Block/Adminhtml/Order}/Tracking.php | 23 +- .../Adminhtml/Order/Tracking/Invoice.php} | 30 +- .../Block/Adminhtml/Order/Tracking/View.php} | 77 +-- .../Block/Adminhtml}/View.php | 50 +- .../Block/Adminhtml}/View/Comments.php | 2 +- .../Block/Adminhtml}/View/Form.php | 31 +- .../Block/Adminhtml}/View/Items.php | 2 +- .../Shipment => Shipping/Block}/Items.php | 2 +- .../Block/Order/Shipment.php | 3 +- .../Block/Tracking/Link.php} | 56 +- .../Controller/Adminhtml/Order/Shipment.php | 147 ++--- .../Magento/Shipping/Controller/Tracking.php | 62 +- app/code/Magento/Shipping/Helper/Data.php | 25 - .../Model/Carrier/AbstractCarrier.php | 65 +- .../Shipping/Model/Carrier/Flatrate.php | 16 +- .../Shipping/Model/Carrier/Freeshipping.php | 18 +- .../Magento/Shipping/Model/Carrier/Pickup.php | 16 +- .../Shipping/Model/Carrier/Tablerate.php | 22 +- .../Factory.php => CarrierFactory.php} | 76 ++- app/code/Magento/Shipping/Model/Config.php | 38 +- app/code/Magento/Shipping/Model/Info.php | 36 +- app/code/Magento/Shipping/Model/Observer.php | 61 ++ .../Model/Order/Pdf}/Packaging.php | 45 +- .../Magento/Shipping/Model/Order/Track.php | 121 ++++ .../Shipping/Model/Rate/AbstractRate.php | 70 --- .../Magento/Shipping/Model/Rate/Request.php | 142 ----- .../Magento/Shipping/Model/Rate/Result.php | 12 +- .../Model/Resource/Carrier/Tablerate.php | 32 +- .../Resource/Order/Track/Collection.php} | 20 +- app/code/Magento/Shipping/Model/Shipping.php | 79 +-- .../Shipping/Model/Shipping/Labels.php | 42 +- .../etc/adminhtml/routes.xml | 2 +- .../events.xml => Shipping/etc/crontab.xml} | 6 +- app/code/Magento/Shipping/etc/di.xml | 29 + app/code/Magento/Shipping/etc/module.xml | 9 +- .../view/adminhtml}/create/form.phtml | 0 .../view/adminhtml}/create/items.phtml | 0 .../create/items/renderer/configurable.phtml | 0 .../create/items/renderer/default.phtml | 0 .../adminhtml_order_shipment_addcomment.xml} | 2 +- .../adminhtml_order_shipment_addtrack.xml} | 2 +- .../layout/adminhtml_order_shipment_new.xml} | 22 +- .../adminhtml_order_shipment_removetrack.xml} | 2 +- .../layout/adminhtml_order_shipment_view.xml} | 31 +- .../layout/sales_order_invoice_new.xml} | 4 +- .../adminhtml/layout/sales_order_view.xml | 30 + .../view/adminhtml/order/Tracking/view.phtml} | 2 +- .../view/adminhtml/order}/packaging.js | 0 .../adminhtml/order}/packaging/grid.phtml | 0 .../adminhtml/order}/packaging/packed.phtml | 2 +- .../adminhtml/order}/packaging/popup.phtml | 2 +- .../view/adminhtml/order/tracking.phtml | 102 +++ .../view/adminhtml/order/view/info.phtml | 59 ++ .../view/adminhtml}/view/form.phtml | 2 +- .../view/adminhtml}/view/items.phtml | 0 .../view/items/renderer/configurable.phtml | 0 .../view/items/renderer/default.phtml | 0 .../view/frontend}/items.phtml | 7 +- .../frontend/layout/sales_guest_reorder.xml | 34 + .../frontend/layout/sales_guest_shipment.xml | 40 ++ .../view/frontend/layout/sales_guest_view.xml | 34 + .../frontend/layout/sales_order_reorder.xml | 34 + .../frontend/layout/sales_order_shipment.xml | 40 ++ .../view/frontend/layout/sales_order_view.xml | 34 + .../view/frontend/order/shipment.phtml | 0 .../view/frontend/tracking/link.phtml | 30 + .../Block/Adminhtml/Grid/Renderer/Link.php | 8 +- .../Sitemap/Controller/Adminhtml/Sitemap.php | 8 +- app/code/Magento/Sitemap/Model/Sitemap.php | 6 +- app/code/Magento/Sitemap/etc/module.xml | 1 + .../Magento/Tax/Block/Checkout/Discount.php | 1 + .../Magento/Tax/Block/Checkout/Grandtotal.php | 1 + .../Magento/Tax/Block/Checkout/Shipping.php | 1 + .../Magento/Tax/Block/Checkout/Subtotal.php | 1 + .../Magento/Tax/Controller/Adminhtml/Rate.php | 6 +- app/code/Magento/Tax/Model/Resource/Setup.php | 6 +- app/code/Magento/Tax/etc/module.xml | 1 + .../Adminhtml/System/Design/Theme.php | 4 +- .../Adminhtml/System/Design/Wysiwyg/Files.php | 2 +- app/code/Magento/Theme/Helper/Storage.php | 8 +- app/code/Magento/Theme/Model/CopyService.php | 6 +- .../Magento/Theme/Model/Uploader/Service.php | 6 +- .../Magento/Theme/Model/Wysiwyg/Storage.php | 6 +- .../frontend/layout/default_head_blocks.xml | 5 + .../Shipping/Carrier/AbstractCarrier.php | 22 +- .../Usa/Model/Shipping/Carrier/Dhl.php | 30 +- .../Shipping/Carrier/Dhl/International.php | 54 +- .../Usa/Model/Shipping/Carrier/Fedex.php | 36 +- .../Usa/Model/Shipping/Carrier/Ups.php | 26 +- .../Usa/Model/Shipping/Carrier/Usps.php | 32 +- app/code/Magento/Usa/etc/module.xml | 1 + .../data-upgrade-1.6.1.1-1.6.1.2.php | 1 - app/code/Magento/User/etc/module.xml | 3 +- .../Adminhtml/Integration/Edit/Tab/Webapi.php | 8 +- .../Webapi/Controller/ErrorProcessor.php | 8 +- app/code/Magento/Webapi/Model/Soap/Config.php | 6 +- app/code/Magento/Webapi/etc/module.xml | 1 + app/code/Magento/Weee/Model/Observer.php | 4 +- app/code/Magento/Weee/etc/module.xml | 1 + .../Widget/Model/Config/FileResolver.php | 8 +- .../Magento/Widget/Model/Widget/Instance.php | 6 +- .../Magento/Wishlist/Block/AbstractBlock.php | 30 +- .../Wishlist/Block/Customer/Sharing.php | 1 + .../Wishlist/Block/Customer/Wishlist.php | 18 +- .../Block/Customer/Wishlist/Button.php | 1 + .../Block/Customer/Wishlist/Item/Options.php | 27 +- .../Block/Customer/Wishlist/Items.php | 12 + .../Magento/Wishlist/Block/Item/Configure.php | 10 + .../Magento/Wishlist/Block/Share/Wishlist.php | 7 +- .../Magento/Wishlist/Controller/Index.php | 19 +- app/code/Magento/Wishlist/Helper/Data.php | 96 +-- app/code/Magento/Wishlist/Model/Item.php | 12 +- .../Model/Resource/Item/Collection.php | 20 +- .../Model/Resource/Item/Collection/Grid.php | 12 +- app/code/Magento/Wishlist/Model/Wishlist.php | 10 +- app/code/Magento/Wishlist/etc/module.xml | 3 + .../view/frontend/item/column/remove.phtml | 2 +- .../view/frontend/item/configure/addto.phtml | 11 +- .../view/frontend/js/add-to-wishlist.js | 30 +- .../wishlist_index_configure_type_grouped.xml | 2 +- .../Wishlist/view/frontend/shared.phtml | 4 +- .../Wishlist/view/frontend/sidebar.phtml | 15 +- .../Wishlist/view/frontend/wishlist.js | 11 +- .../adminhtml/magento_backend/css/pages.css | 122 ++-- .../adminhtml/magento_backend/css/styles.css | 122 ++-- .../magento_backend/less/styles/pages.less | 122 ++-- .../frontend/magento_plushe/css/styles.css | 2 +- .../less/responsive/responsive.less | 2 +- app/etc/di.xml | 18 +- .../App/Filesystem/DirectoryList.php} | 27 +- .../Magento/TestFramework/Application.php | 38 +- .../TestFramework/ObjectManagerFactory.php | 17 +- .../TestCase/AbstractConfigFiles.php | 7 +- .../Magento/Test/ApplicationTest.php | 6 +- .../Magento/Test/Helper/BootstrapTest.php | 6 +- .../Magento/Test/ObjectManagerTest.php | 6 +- .../Backend/Block/System/Config/FormTest.php | 4 +- .../Block/Widget/Grid/MassactionTest.php | 4 +- .../Magento/Backend/Block/Widget/GridTest.php | 7 +- .../Model/Config/Backend/Admin/RobotsTest.php | 3 +- .../Backend/Model/_files/no_robots_txt.php | 2 +- .../Backend/Model/_files/robots_txt.php | 2 +- .../Catalog/Block/Product/AbstractTest.php | 17 +- .../Product/ProductList/CrosssellTest.php | 2 +- .../Block/Product/ProductList/RelatedTest.php | 2 +- .../Magento/Catalog/Helper/ImageTest.php | 6 +- .../Catalog/Helper/Product/CompareTest.php | 21 +- .../Product/Attribute/Backend/MediaTest.php | 7 +- .../Product/Attribute/Backend/SkuTest.php | 5 +- .../Model/Product/Type/AbstractTest.php | 2 +- .../Catalog/Model/Product/TypeTest.php | 8 - .../Catalog/Model/ProductExternalTest.php | 7 - .../Catalog/Model/ProductGettersTest.php | 4 +- .../Magento/Catalog/Model/ProductTest.php | 42 +- .../Magento/Catalog/_files/product_image.php | 2 +- .../Catalog/_files/product_image_rollback.php | 4 +- .../Catalog/controllers/_files/products.php | 2 +- .../Magento/Cms/Helper/Wysiwyg/ImagesTest.php | 4 +- .../Cms/Model/Wysiwyg/Images/StorageTest.php | 4 +- .../testsuite/Magento/Code/GeneratorTest.php | 2 +- .../Core/Model/DataService/ConfigTest.php | 122 ---- .../Core/Model/DataService/LayoutTest.php | 154 ----- .../Magento/Catalog/etc/service_calls.xml | 32 - .../LayoutTest/Magento/First/etc/module.xml | 28 - .../Magento/First/etc/service_calls.xml | 31 - .../Magento/Last/etc/service_calls.xml | 31 - .../LayoutTest/Magento/Test/etc/module.xml | 28 - .../Magento/Test/etc/service_calls.xml | 31 - .../Magento/Core/Model/File/StorageTest.php | 2 +- .../Magento/Core/Model/ObserverTest.php | 2 +- .../Magento/Core/Model/Session/ConfigTest.php | 3 +- .../Magento/Core/Model/StoreTest.php | 4 +- .../Core/Model/Theme/CollectionTest.php | 8 +- .../Core/Model/Theme/RegistrationTest.php | 4 +- .../Magento/Core/Model/View/DesignTest.php | 32 +- .../Core/Model/_files/design/themes.php | 4 +- .../testsuite/Magento/Core/Utility/Layout.php | 1 - .../Magento/Core/Utility/LayoutTest.php | 4 +- .../Core/_files/media_for_change_rollback.php | 6 +- .../Model/Config/QuickStylesTest.php | 6 +- .../Tools/Controls/ConfigurationTest.php | 13 +- .../Model/_files/design/themes.php | 4 +- .../Downloadable/Model/ObserverTest.php | 54 -- .../Email/Model/Template/FilterTest.php | 4 +- .../Magento/Email/Model/TemplateTest.php | 2 +- .../Magento/Email/Model/_files/themes.php | 4 +- .../Magento/Filesystem/Directory/ReadTest.php | 51 +- .../Filesystem/Directory/WriteTest.php | 49 +- .../Magento/Filesystem/Driver/FileTest.php | 13 +- .../Magento/Filesystem/File/ReadTest.php | 90 +++ .../Magento/Filesystem/FilesystemTest.php | 14 +- .../_files/recursively/directory.txt | 0 .../_files/recursively/directory/read.txt | 0 .../Model/Product/Type/GroupedTest.php | 50 ++ .../AssociatedProductsCollectionTest.php | 8 +- .../_files/product_grouped.php | 6 +- .../Magento/Image/Adapter/InterfaceTest.php | 10 +- .../Model/Export/Entity/ProductTest.php | 2 +- .../Import/Entity/CustomerCompositeTest.php | 6 +- .../Entity/Eav/Customer/AddressTest.php | 8 +- .../Import/Entity/Eav/CustomerImportTest.php | 4 +- .../Model/Import/Entity/ProductTest.php | 24 +- .../Model/Import/EntityAbstractTest.php | 4 +- .../Magento/Index/Model/Process/FileTest.php | 4 +- .../Magento/Install/Controller/WizardTest.php | 6 +- .../Magento/Install/Model/ConfigTest.php | 10 +- .../Install/Model/Installer/ConfigTest.php | 13 +- .../Magento/Install/Model/InstallerTest.php | 25 +- .../Block/Checkout}/OverviewTest.php | 6 +- .../Controller/CheckoutTest.php} | 8 +- .../Magento/Newsletter/Model/QueueTest.php | 4 +- .../Magento/Object/Copy/Config/ReaderTest.php | 10 +- .../Magento/PageCache/Helper/DataTest.php | 80 --- .../Magento/PageCache/Model/ObserverTest.php | 66 -- .../Model/Persistent/ConfigTest.php | 8 +- .../Shipment => Shipping/Block}/ItemsTest.php | 4 +- .../Sitemap/_files/sitemap_products.php | 6 +- .../DataService/ServiceCallsConfigTest.php | 77 --- .../Integrity/Modular/AclConfigFilesTest.php | 8 +- .../Integrity/Modular/DiConfigFilesTest.php | 6 +- .../Modular/EavAttributesConfigFilesTest.php | 6 +- .../Modular/ExportConfigFilesTest.php | 6 +- .../Modular/ImportConfigFilesTest.php | 6 +- .../Modular/IndexerConfigFilesTest.php | 6 +- .../Integrity/Modular/LayoutFilesTest.php | 2 +- .../Modular/ProductOptionsConfigFilesTest.php | 6 +- .../Modular/ProductTypesConfigFilesTest.php | 6 +- .../Modular/ResourcesConfigFilesTest.php | 6 +- .../Modular/ServiceCallsConfigFilesTest.php | 117 ---- .../Modular/SystemConfigFilesTest.php | 2 +- .../Integrity/Modular/ViewConfigFilesTest.php | 2 +- .../Test/Integrity/Theme/ViewFilesTest.php | 2 +- .../Test/Integrity/Theme/XmlFilesTest.php | 13 +- .../Tools/Layout/Reference/ProcessorTest.php | 4 +- .../System/Design/ThemeControllerTest.php | 14 +- .../Theme/Model/Wysiwyg/StorageTest.php | 16 +- .../Magento/View/Asset/MergedTest.php | 14 +- .../FileResolution/Strategy/FallbackTest.php | 6 +- .../View/Element/AbstractBlockTest.php | 13 +- .../testsuite/Magento/View/FileSystemTest.php | 4 +- .../Magento/View/PublicationTest.php | 32 +- .../Magento/Widget/Model/Config/DataTest.php | 18 +- .../Widget/Model/Config/FileResolverTest.php | 18 +- .../Widget/Model/Config/ReaderTest.php | 12 +- .../Magento/Widget/Model/WidgetTest.php | 10 +- .../Magento/Wishlist/Helper/DataTest.php | 107 ++++ .../Magento/TestFramework/Application.php | 4 +- .../TestFramework/Dependency/DbRule.php | 12 +- .../TestFramework/Dependency/LayoutRule.php | 256 +++----- .../TestFramework/Dependency/PhpRule.php | 228 ++++++- .../TestFramework/Dependency/TemplateRule.php | 494 --------------- .../TestFramework/Dependency/DbRuleTest.php | 88 +++ .../Dependency/LayoutRuleTest.php | 264 ++++++++ .../TestFramework/Dependency/PhpRuleTest.php | 154 +++++ .../Dependency/_files/layout_handle.xml} | 8 +- .../_files/layout_handle_parent.xml} | 6 +- .../_files/layout_handle_update.xml | 33 + .../Dependency/_files/layout_reference.xml | 31 + .../Magento/Test/Integrity/DependencyTest.php | 272 +++----- .../Integrity/Library/_files/blacklist.txt | 2 +- .../Model/DataService/LayoutConfigTest.php | 106 ---- .../Model/DataService/SystemConfigTest.php | 77 --- .../_files/dependency_test}/tables_ce.php | 2 +- .../Magento/Test/Js/_files/blacklist/core.txt | 2 +- .../Magento/Test/Js/_files/whitelist/core.txt | 2 - .../Magento/Test/Legacy/LayoutTest.php | 4 +- .../Magento/Test/Legacy/ObsoleteCodeTest.php | 2 +- .../Test/Legacy/_files/obsolete_classes.php | 84 ++- .../Test/Legacy/_files/obsolete_constants.php | 68 +- .../Test/Legacy/_files/obsolete_methods.php | 77 ++- .../Legacy/_files/obsolete_properties.php | 2 +- .../Test/Php/_files/blacklist/common.txt | 1 + .../Php/_files/phpcpd/blacklist/common.txt | 4 +- .../Test/Php/_files/whitelist/common.txt | 10 +- .../Magento/Test/Block/Adminhtml.php | 2 +- .../TestFramework/Helper/ObjectManager.php | 21 + .../App/Cache/Frontend/FactoryTest.php | 6 +- .../App/Config/FileResolver/PrimaryTest.php | 4 +- .../Magento/App/Config/LoaderTest.php | 4 +- .../Magento/App/Console/ResponseTest.php | 68 ++ .../unit/testsuite/Magento/App/CronTest.php | 12 +- .../Magento/App/EntryPoint/EntryPointTest.php | 16 +- .../Magento/App/Error/HandlerTest.php | 6 +- .../DirectoryList/VerificationTest.php | 59 +- .../testsuite/Magento/App/FilesystemTest.php | 71 +++ .../App/Response/Http/FileFactoryTest.php | 2 +- .../Authorizenet/Helper/BackendTest.php | 2 +- .../Model/Authorizenet/CardsTest.php | 8 +- .../Magento/Backend/Block/Widget/TabTest.php | 77 +++ .../Config/Structure/Element/FieldTest.php | 56 -- .../Config/_files/invalidSystemXmlArray.php | 14 - .../testsuite/Magento/Backup/MediaTest.php | 4 +- .../Backup/Model/Fs/CollectionTest.php | 2 +- .../testsuite/Magento/Backup/NomediaTest.php | 4 +- .../testsuite/Magento/Backup/SnapshotTest.php | 2 +- .../Helper/Plugin/BundleTest.php | 135 ++++ .../Product/CopyConstructor/BundleTest.php | 160 +++++ .../Captcha/Helper/Adminhtml/DataTest.php | 2 +- .../Magento/Captcha/Helper/DataTest.php | 6 +- .../Magento/Captcha/Model/CronTest.php | 2 +- .../Adminhtml/Product/Attribute/GridTest.php | 2 +- .../Adminhtml/Product/Edit/Tab/AlertsTest.php | 87 +++ .../Catalog/Block/Product/ViewTest.php | 74 +++ .../Helper/Plugin/ConfigurableTest.php | 146 +++++ .../Product/Initialization/HelperTest.php | 218 +++++++ .../Initialization/StockDataFilterTest.php | 133 ++++ .../Product/Attribute/Backend/MediaTest.php | 2 +- .../Catalog/Model/Product/CopierTest.php | 106 ++++ .../Product/CopyConstructor/CompositeTest.php | 52 ++ .../Product/CopyConstructor/CrossSellTest.php | 130 ++++ .../Product/CopyConstructor/RelatedTest.php | 130 ++++ .../Product/CopyConstructor/UpSellTest.php | 130 ++++ .../Product/CopyConstructorFactoryTest.php | 64 ++ .../Model/Product/Type/ConfigurableTest.php | 2 +- .../Model/Product/Type/GroupedTest.php | 62 -- .../Catalog/Model/Product/Type/SimpleTest.php | 2 +- .../Model/Product/Type/VirtualTest.php | 2 +- .../Catalog/Model/ProductTypes/ConfigTest.php | 42 +- .../Model/Resource/Product/LinkTest.php | 162 +++++ .../CopyConstructor/CatalogInventoryTest.php | 108 ++++ .../Magento/Checkout/Model/SessionTest.php | 4 +- .../Cms/Model/Wysiwyg/Images/StorageTest.php | 69 +- .../testsuite/Magento/Code/GeneratorTest.php | 4 +- .../Code/Minifier/Strategy/GenerateTest.php | 8 +- .../Code/Minifier/Strategy/LiteTest.php | 8 +- .../testsuite/Magento/Code/MinifierTest.php | 8 +- .../Plugin/DispatchExceptionHandlerTest.php | 2 +- .../testsuite/Magento/Core/App/MediaTest.php | 37 +- .../Magento/Core/Helper/PostDataTest.php | 75 +++ .../Magento/Core/Helper/ThemeTest.php | 16 +- .../Core/Model/Config/FileResolverTest.php | 6 +- .../Core/Model/Config/Initial/ReaderTest.php | 2 +- .../Model/DataService/Config/ReaderTest.php | 74 --- .../Core/Model/DataService/ConfigTest.php | 107 ---- .../Core/Model/DataService/GraphTest.php | 163 ----- .../Core/Model/DataService/InvokerTest.php | 218 ------- .../Model/DataService/Path/CompositeTest.php | 83 --- .../Model/DataService/Path/NavigatorTest.php | 112 ---- .../Model/DataService/Path/RequestTest.php | 57 -- .../Core/Model/DataService/RepositoryTest.php | 90 --- .../_files/second_service_calls.xml | 30 - .../DataService/_files/service_calls.xml | 38 -- .../Core/Model/File/Storage/ConfigTest.php | 4 +- .../File/Storage/SynchronizationTest.php | 4 +- .../Magento/Core/Model/Layout/MergeTest.php | 2 +- .../Hierarchy/Config/FileResolverTest.php | 4 +- .../Core/Model/Resource/Db/AbstractTest.php | 2 +- .../Model/Resource/File/Storage/FileTest.php | 6 +- .../Model/Resource/Setup/MigrationTest.php | 10 +- .../Magento/Core/Model/Session/ConfigTest.php | 4 +- .../Core/Model/Theme/Image/PathTest.php | 4 +- .../Block/Adminhtml/ThemeTest.php | 6 +- .../Renderer/BackgroundImageTest.php | 4 +- .../QuickStyles/Renderer/DefaultTest.php | 2 +- .../Magento/Directory/Helper/DataTest.php | 13 +- .../Helper/Plugin/DownloadableTest.php | 76 +++ .../Downloadable/Helper/DownloadTest.php | 6 +- .../Downloadable/Model/ObserverTest.php | 283 --------- .../CopyConstructor/DownloadableTest.php | 152 +++++ .../CopyConstructor/_files/expected_data.php | 81 +++ .../Downloadable/Model/Product/TypeTest.php | 2 +- .../Sales/Order/Pdf/Items/CreditmemoTest.php | 4 +- .../Block/Adminhtml/Template/EditTest.php | 8 +- .../Filesystem/Directory/WriteTest.php | 9 + .../Magento/Filesystem/DirectoryListTest.php | 69 +- .../Magento/Filesystem/Driver/HttpTest.php | 6 +- .../unit/testsuite/Magento/FilesystemTest.php | 20 +- .../GoogleShopping/Model/ServiceTest.php | 84 +++ .../Composite/Fieldset/GroupedTest.php | 315 ++++++++++ .../ListAssociatedProductsTest.php | 154 +++++ .../Grouped/AssociatedProductsTest.php | 60 ++ .../Block/Product/View/Type/GroupedTest.php | 194 ++++++ .../Controller/Adminhtml/EditTest.php | 135 ++++ .../ProductLinks/Plugin/GroupedTest.php | 89 +++ .../Configuration/Plugin/GroupedTest.php | 188 ++++++ .../Product/CopyConstructor/GroupedTest.php | 149 +++++ .../Model/Product/Type/Grouped/PriceTest.php | 194 ++++++ .../Model/Product/Type/GroupedTest.php | 261 ++++++++ .../Config/Converter/Plugin/GroupedTest.php | 55 ++ .../Magento/Image/Adapter/AbstractTest.php | 2 +- .../Magento/Image/Adapter/ImageMagickTest.php | 2 +- .../Magento/ImportExport/Model/ExportTest.php | 2 +- .../Model/Import/Source/CsvTest.php | 4 +- .../Magento/Index/App/IndexerTest.php | 22 +- .../testsuite/Magento/Index/App/ShellTest.php | 26 +- .../Magento/Index/Model/Lock/StorageTest.php | 4 +- .../Install/App/Action/Plugin/DirTest.php | 4 +- .../Magento/Install/App/ConsoleTest.php | 45 +- .../Magento/Install/Block/BeginTest.php | 4 +- .../Install/Model/Installer/ConfigTest.php | 6 +- .../testsuite/Magento/Log/App/ShellTest.php | 19 +- .../unit/testsuite/Magento/Log/LoggerTest.php | 13 +- .../testsuite/Magento/Log/Model/ShellTest.php | 2 +- .../Magento/Message/AbstractMessageTest.php | 14 +- .../Magento/Message/CollectionTest.php | 30 +- .../Module/Declaration/FileResolverTest.php | 4 +- .../Declaration/Reader/FilesystemTest.php | 4 +- .../Magento/Module/Dir/ReaderTest.php | 2 +- .../unit/testsuite/Magento/Module/DirTest.php | 4 +- .../App/FrontController/HeaderPluginTest.php | 103 +++ .../Paypal/Model/Method/AgreementTest.php | 122 ++++ .../Order/Invoice/Total/ShippingTest.php | 8 +- .../Magento/Sales/Model/Order/InvoiceTest.php | 4 +- .../Sales/Model/Order/Pdf/AbstractTest.php | 5 +- .../Sales/Model/Order/Pdf/InvoiceTest.php | 5 +- .../Block/Adminhtml/Order/TrackingTest.php | 63 ++ .../Shipping/Model/Order/TrackTest.php | 62 ++ .../Magento/Sitemap/Model/SitemapTest.php | 4 +- .../Di/Code/Scanner/PluginScannerTest.php | 1 - .../Test/Tools/Di/_files/app/etc/config.xml | 1 - .../Tools/Di/_files/app/etc/di/config.xml | 1 - .../Tools/View/Generator/CopyRuleTest.php | 2 +- .../View/Generator/ThemeDeploymentTest.php | 6 +- .../Magento/Theme/Block/Html/HeaderTest.php | 2 +- .../Magento/Theme/Helper/StorageTest.php | 4 +- .../Magento/Theme/Model/CopyServiceTest.php | 4 +- .../Theme/Model/Uploader/ServiceTest.php | 4 +- .../Theme/Model/Wysiwyg/StorageTest.php | 4 +- .../Carrier/Dhl/InternationalTest.php | 14 +- .../Usa/Model/Shipping/Carrier/DhlTest.php | 6 +- .../Usa/Model/Shipping/Carrier/UspsTest.php | 6 +- .../Magento/View/Asset/MergeServiceTest.php | 2 +- .../View/Asset/MergeStrategy/ChecksumTest.php | 2 +- .../View/Asset/MergeStrategy/DirectTest.php | 7 +- .../Asset/MergeStrategy/FileExistsTest.php | 2 +- .../Magento/View/Asset/MergedTest.php | 8 +- .../Magento/View/Asset/MinifyServiceTest.php | 2 +- .../View/Design/Fallback/FactoryTest.php | 14 +- .../Strategy/Fallback/CachingProxyTest.php | 8 +- .../FileResolution/Strategy/FallbackTest.php | 14 +- .../FileResolution/StrategyPoolTest.php | 8 +- .../Theme/Customization/AbstractFileTest.php | 6 +- .../Design/Theme/Customization/PathTest.php | 2 +- .../View/Design/Theme/Image/UploaderTest.php | 2 +- .../Magento/View/Design/Theme/ImageTest.php | 6 +- .../View/Element/AbstractBlockTest.php | 7 + .../Magento/View/Element/TemplateTest.php | 36 +- .../View/Layout/File/Source/BaseTest.php | 7 +- .../Layout/File/Source/Override/BaseTest.php | 7 +- .../Layout/File/Source/Override/ThemeTest.php | 4 +- .../View/Layout/File/Source/ThemeTest.php | 7 +- .../Magento/View/Url/CssResolverTest.php | 4 +- .../unit/testsuite/Magento/View/UrlTest.php | 4 +- .../Webapi/Controller/ErrorProcessorTest.php | 2 +- .../Magento/Webapi/Model/Soap/ConfigTest.php | 2 +- .../Widget/Model/Widget/InstanceTest.php | 2 +- .../Migration/Acl/log/AclXPathToAclId.log | 2 +- .../factory_table_names/replace_ce.php | 2 +- .../Magento/Tools/View/Generator/Config.php | 8 +- .../Magento/Tools/View/Generator/CopyRule.php | 8 +- downloader/lib/Magento/Backup/Snapshot.php | 8 +- index.php | 5 +- lib/Magento/App/Cache/Frontend/Factory.php | 12 +- .../App/Config/FileResolver/Primary.php | 6 +- lib/Magento/App/Config/Loader.php | 6 +- lib/Magento/App/Console/Response.php | 81 +++ lib/Magento/App/Cron.php | 21 +- lib/Magento/App/EntryPoint/EntryPoint.php | 9 +- lib/Magento/App/Error/Handler.php | 8 +- lib/Magento/App/Filesystem.php | 140 +++++ lib/Magento/App/Filesystem/DirectoryList.php | 109 ++++ .../DirectoryList/Configuration.php | 9 +- .../Filesystem/DirectoryList/Verification.php | 30 +- lib/Magento/App/FrontController.php | 2 + lib/Magento/App/Http.php | 75 +-- .../ObjectManager/ConfigLoader/Primary.php | 8 +- lib/Magento/App/ObjectManagerFactory.php | 78 ++- lib/Magento/App/Response/Http/FileFactory.php | 8 +- lib/Magento/AppInterface.php | 2 +- lib/Magento/Backup/Snapshot.php | 8 +- lib/Magento/Code/Generator.php | 4 +- lib/Magento/Code/Minifier.php | 8 +- .../Code/Minifier/Strategy/Generate.php | 8 +- lib/Magento/Code/Minifier/Strategy/Lite.php | 8 +- lib/Magento/DB/Adapter/Pdo/Mysql.php | 8 +- .../Data/Form/Element/AbstractElement.php | 28 + lib/Magento/Filesystem.php | 126 +--- lib/Magento/Filesystem/Directory/Read.php | 13 - .../Filesystem/Directory/ReadInterface.php | 9 - lib/Magento/Filesystem/Directory/Write.php | 26 +- .../Filesystem/Directory/WriteInterface.php | 7 + lib/Magento/Filesystem/DirectoryList.php | 69 +- lib/Magento/Filesystem/Driver/File.php | 61 +- lib/Magento/Filesystem/Driver/Http.php | 2 +- lib/Magento/Filesystem/DriverInterface.php | 17 +- lib/Magento/Image/Adapter/AbstractAdapter.php | 8 +- lib/Magento/Logger.php | 8 +- .../Module/Declaration/FileIterator.php | 4 +- .../Module/Declaration/FileResolver.php | 10 +- lib/Magento/Module/Dir.php | 6 +- lib/Magento/Module/Dir/Reader.php | 9 +- .../Object/Copy/Config/SchemaLocator.php | 8 +- lib/Magento/View/Asset/MergeService.php | 9 +- .../View/Asset/MergeStrategy/Checksum.php | 8 +- .../View/Asset/MergeStrategy/Direct.php | 6 +- .../View/Asset/MergeStrategy/FileExists.php | 8 +- lib/Magento/View/Asset/Merged.php | 10 +- lib/Magento/View/Asset/MinifyService.php | 8 +- lib/Magento/View/Config.php | 12 +- lib/Magento/View/Design/Fallback/Factory.php | 14 +- .../FileResolution/Strategy/Fallback.php | 4 +- .../Strategy/Fallback/CachingProxy.php | 4 +- .../Design/FileResolution/StrategyPool.php | 4 +- .../Theme/Customization/AbstractFile.php | 8 +- .../View/Design/Theme/Customization/Path.php | 10 +- lib/Magento/View/Design/Theme/Image.php | 6 +- .../View/Design/Theme/Image/Uploader.php | 6 +- lib/Magento/View/Element/AbstractBlock.php | 20 + lib/Magento/View/Element/BlockFactory.php | 3 + lib/Magento/View/Element/Template.php | 28 +- lib/Magento/View/Element/Template/Context.php | 10 +- lib/Magento/View/Layout/File/Source/Base.php | 4 +- .../View/Layout/File/Source/Override/Base.php | 4 +- .../Layout/File/Source/Override/Theme.php | 4 +- lib/Magento/View/Layout/File/Source/Theme.php | 4 +- lib/Magento/View/Publisher.php | 18 +- lib/Magento/View/Service.php | 6 +- lib/Magento/View/Url.php | 8 +- lib/Magento/View/Url/CssResolver.php | 8 +- pub/cron.php | 19 +- pub/errors/404.php | 6 +- pub/errors/503.php | 6 +- pub/errors/noCache.php | 5 +- pub/errors/processor.php | 78 +-- pub/errors/report.php | 8 +- pub/index.php | 7 +- pub/lib/mage/dataPost.js | 52 ++ pub/lib/mage/directpost.js | 12 +- 1173 files changed, 17016 insertions(+), 12853 deletions(-) rename app/code/Magento/{Paygate => Authorizenet}/Block/Authorizenet/Form/Cc.php (86%) rename app/code/Magento/{Paygate => Authorizenet}/Block/Authorizenet/Info/Cc.php (93%) rename app/code/Magento/{Paygate/Controller/Adminhtml/Paygate => Authorizenet/Controller/Adminhtml}/Authorizenet/Payment.php (79%) rename app/code/Magento/{Paygate => Authorizenet}/Controller/Authorizenet/Payment.php (75%) rename app/code/Magento/{Paygate => Authorizenet}/Model/Authorizenet.php (94%) rename app/code/Magento/{Paygate => Authorizenet}/Model/Authorizenet/Cards.php (95%) rename app/code/Magento/{Paygate => Authorizenet}/Model/Authorizenet/Debug.php (60%) rename app/code/Magento/{Paygate => Authorizenet}/Model/Authorizenet/Request.php (91%) rename app/code/Magento/{Paygate => Authorizenet}/Model/Authorizenet/Result.php (91%) rename app/code/Magento/{Paygate => Authorizenet}/Model/Authorizenet/Source/Cctype.php (90%) rename app/code/Magento/{Paygate => Authorizenet}/Model/Authorizenet/Source/PaymentAction.php (83%) rename app/code/Magento/{Paygate => Authorizenet}/Model/Resource/Authorizenet/Debug.php (86%) rename app/code/Magento/{Paygate => Authorizenet}/Model/Resource/Authorizenet/Debug/Collection.php (80%) rename app/code/Magento/{Paygate => Authorizenet}/view/adminhtml/form/cc.phtml (100%) rename app/code/Magento/{Paygate => Authorizenet}/view/adminhtml/info/cc.phtml (100%) rename app/code/Magento/{Paygate => Authorizenet}/view/adminhtml/info/pdf.phtml (100%) rename app/code/Magento/{Paygate/view/frontend/paygate-authenticate.js => Authorizenet/view/frontend/authorizenet-authenticate.js} (98%) rename app/code/Magento/{Paygate => Authorizenet}/view/frontend/form/cc.phtml (94%) rename app/code/Magento/{Paygate => Authorizenet}/view/frontend/info/cc.phtml (100%) rename app/code/Magento/{Catalog/view/adminhtml/layout/catalog_product_supergroup.xml => Authorizenet/view/frontend/layout/authorizenet_directpost_payment_backendresponse.xml} (87%) create mode 100644 app/code/Magento/Backend/Block/Widget/Tab.php create mode 100644 app/code/Magento/Bundle/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Bundle.php create mode 100644 app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php rename app/code/Magento/Bundle/view/frontend/layout/{checkout_multishipping_addresses.xml => multishipping_checkout_addresses.xml} (94%) rename app/code/Magento/Bundle/view/frontend/layout/{checkout_multishipping_overview.xml => multishipping_checkout_overview.xml} (94%) rename app/code/Magento/Bundle/view/frontend/layout/{checkout_multishipping_shipping.xml => multishipping_checkout_shipping.xml} (91%) delete mode 100644 app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs/Grouped.php create mode 100644 app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php create mode 100644 app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php create mode 100644 app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks.php create mode 100644 app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php create mode 100644 app/code/Magento/Catalog/Helper/Product/Price.php create mode 100644 app/code/Magento/Catalog/Model/Product/Copier.php create mode 100644 app/code/Magento/Catalog/Model/Product/CopyConstructor/Composite.php create mode 100644 app/code/Magento/Catalog/Model/Product/CopyConstructor/CrossSell.php create mode 100644 app/code/Magento/Catalog/Model/Product/CopyConstructor/Related.php create mode 100644 app/code/Magento/Catalog/Model/Product/CopyConstructor/UpSell.php rename app/code/Magento/{Sales/Model/ResourceFactory.php => Catalog/Model/Product/CopyConstructorFactory.php} (60%) rename app/code/Magento/{Core/Model/DataService/ConfigInterface.php => Catalog/Model/Product/CopyConstructorInterface.php} (73%) create mode 100644 app/code/Magento/CatalogInventory/Model/Product/CopyConstructor/CatalogInventory.php rename app/code/Magento/Centinel/view/frontend/layout/{checkout_multishipping_overview.xml => multishipping_checkout_overview.xml} (100%) create mode 100644 app/code/Magento/Core/Helper/PostData.php delete mode 100644 app/code/Magento/Core/Model/DataService/Config.php delete mode 100644 app/code/Magento/Core/Model/DataService/Config/Reader.php delete mode 100644 app/code/Magento/Core/Model/DataService/Graph.php delete mode 100644 app/code/Magento/Core/Model/DataService/Invoker.php delete mode 100644 app/code/Magento/Core/Model/DataService/Path/Composite.php delete mode 100644 app/code/Magento/Core/Model/DataService/Path/Navigator.php delete mode 100644 app/code/Magento/Core/Model/DataService/Path/NodeInterface.php delete mode 100644 app/code/Magento/Core/Model/DataService/Path/Request.php delete mode 100644 app/code/Magento/Core/Model/DataService/Repository.php delete mode 100644 app/code/Magento/Core/etc/service_calls.xsd rename app/code/Magento/{Core/Model/DataService/Config/Reader/Factory.php => Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Downloadable.php} (57%) create mode 100644 app/code/Magento/Downloadable/Model/Product/CopyConstructor/Downloadable.php rename app/code/Magento/{PageCache/etc/frontend => Downloadable/etc/adminhtml}/di.xml (68%) rename app/code/Magento/Downloadable/view/frontend/layout/{checkout_multishipping_addresses.xml => multishipping_checkout_addresses.xml} (100%) rename app/code/Magento/Downloadable/view/frontend/layout/{checkout_multishipping_overview.xml => multishipping_checkout_overview.xml} (100%) rename app/code/Magento/Downloadable/view/frontend/layout/{checkout_multishipping_shipping.xml => multishipping_checkout_shipping.xml} (100%) rename app/code/Magento/Downloadable/view/frontend/layout/{checkout_multishipping_success.xml => multishipping_checkout_success.xml} (100%) create mode 100644 app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php rename app/code/Magento/{Catalog => GroupedProduct}/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php (84%) rename app/code/Magento/{Catalog => GroupedProduct}/Block/Product/Grouped/AssociatedProducts.php (96%) rename app/code/Magento/{Catalog => GroupedProduct}/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php (97%) rename app/code/Magento/{Catalog => GroupedProduct}/Block/Product/View/Type/Grouped.php (68%) create mode 100644 app/code/Magento/GroupedProduct/Controller/Adminhtml/Edit.php create mode 100644 app/code/Magento/GroupedProduct/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks/Plugin/Grouped.php create mode 100644 app/code/Magento/GroupedProduct/Helper/Product/Configuration/Plugin/Grouped.php create mode 100644 app/code/Magento/GroupedProduct/Model/Product/CopyConstructor/Grouped.php rename app/code/Magento/{Catalog => GroupedProduct}/Model/Product/Type/Grouped.php (85%) rename app/code/Magento/{Catalog => GroupedProduct}/Model/Product/Type/Grouped/Backend.php (83%) rename app/code/Magento/{Catalog => GroupedProduct}/Model/Product/Type/Grouped/Price.php (89%) rename app/code/Magento/{PageCache/Model/Control/Zend.php => GroupedProduct/Model/ProductTypes/Config/Converter/Plugin/Grouped.php} (62%) rename app/code/Magento/{Catalog => GroupedProduct}/Model/Resource/Product/Indexer/Price/Grouped.php (89%) create mode 100644 app/code/Magento/GroupedProduct/Model/Resource/Product/Link.php rename app/code/Magento/{Catalog => GroupedProduct}/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php (96%) create mode 100644 app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-0.0.1.php create mode 100644 app/code/Magento/GroupedProduct/etc/adminhtml/di.xml rename app/code/Magento/{PageCache => GroupedProduct}/etc/adminhtml/routes.xml (89%) rename app/code/Magento/{Paygate/etc/frontend => GroupedProduct/etc}/di.xml (73%) create mode 100644 app/code/Magento/GroupedProduct/etc/frontend/di.xml rename {dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Last => app/code/Magento/GroupedProduct}/etc/module.xml (62%) mode change 100755 => 100644 rename app/code/Magento/{PageCache/etc/events.xml => GroupedProduct/etc/product_types.xml} (62%) create mode 100644 app/code/Magento/GroupedProduct/i18n/de_DE.csv create mode 100644 app/code/Magento/GroupedProduct/i18n/en_US.csv create mode 100644 app/code/Magento/GroupedProduct/i18n/es_ES.csv create mode 100644 app/code/Magento/GroupedProduct/i18n/fr_FR.csv create mode 100644 app/code/Magento/GroupedProduct/i18n/nl_NL.csv create mode 100644 app/code/Magento/GroupedProduct/i18n/pt_BR.csv create mode 100644 app/code/Magento/GroupedProduct/i18n/zh_CN.csv rename app/code/Magento/{Paygate/sql/paygate_setup/install-1.6.0.0.php => GroupedProduct/sql/groupedproduct_setup/install-0.0.1.php} (70%) rename app/code/Magento/{Catalog => GroupedProduct}/view/adminhtml/catalog/product/composite/fieldset/grouped.phtml (96%) create mode 100644 app/code/Magento/GroupedProduct/view/adminhtml/css/grouped-product.css rename app/code/Magento/{Catalog => GroupedProduct}/view/adminhtml/js/grouped-product.js (100%) rename app/code/Magento/{Catalog => GroupedProduct}/view/adminhtml/layout/catalog_product_grouped.xml (54%) rename app/code/Magento/{Catalog => GroupedProduct}/view/adminhtml/layout/catalog_product_view_type_grouped.xml (82%) rename app/code/Magento/{Catalog/view/adminhtml/layout/catalog_product_supergrouppopup.xml => GroupedProduct/view/adminhtml/layout/groupedproduct_edit_popup.xml} (96%) rename app/code/Magento/{Catalog/view/adminhtml/layout/catalog_product_grouped_grid_popup.xml => GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml} (95%) rename app/code/Magento/{Catalog => GroupedProduct}/view/adminhtml/product/grouped/container.phtml (94%) rename app/code/Magento/{Catalog => GroupedProduct}/view/adminhtml/product/grouped/grouped.phtml (94%) rename app/code/Magento/{Catalog => GroupedProduct}/view/adminhtml/product/grouped/list.phtml (96%) rename app/code/Magento/{Catalog => GroupedProduct}/view/frontend/layout/catalog_product_view_type_grouped.xml (87%) create mode 100644 app/code/Magento/GroupedProduct/view/frontend/layout/rss_catalog_category.xml create mode 100644 app/code/Magento/GroupedProduct/view/frontend/layout/rss_catalog_new.xml create mode 100644 app/code/Magento/GroupedProduct/view/frontend/product/price.phtml rename app/code/Magento/{Catalog => GroupedProduct}/view/frontend/product/view/type/grouped.phtml (95%) create mode 100644 app/code/Magento/GroupedProduct/view/frontend/rss/product/price.phtml rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/AbstractMultishipping.php (83%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/Address/Select.php (91%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/Addresses.php (91%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/Billing.php (91%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/Billing/Items.php (87%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/Link.php (94%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/Overview.php (93%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/Payment/Info.php (88%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/Shipping.php (86%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/State.php (84%) rename app/code/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/Success.php (87%) rename app/code/Magento/{Checkout/Controller/Multishipping.php => Multishipping/Controller/Checkout.php} (82%) rename app/code/Magento/{Checkout/Controller/Multishipping => Multishipping/Controller/Checkout}/Address.php (84%) create mode 100644 app/code/Magento/Multishipping/Helper/Url.php rename app/code/Magento/{Checkout/Model => Multishipping/Model/Checkout}/Type/Multishipping.php (96%) rename app/code/Magento/{Checkout/Model => Multishipping/Model/Checkout}/Type/Multishipping/State.php (92%) rename app/code/Magento/{Paygate/etc/adminhtml => Multishipping/etc/frontend}/di.xml (81%) create mode 100644 app/code/Magento/Multishipping/etc/frontend/page_types.xml rename app/code/Magento/{Paygate => Multishipping}/etc/frontend/routes.xml (89%) rename app/code/Magento/{Paygate => Multishipping}/etc/module.xml (80%) mode change 100755 => 100644 rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/address/select.phtml (100%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/addresses.phtml (96%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/billing.phtml (98%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/billing/items.phtml (100%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/item/default.phtml (100%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/link.phtml (100%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/overview.phtml (99%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/overview/item.phtml (100%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/shipping.phtml (95%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/state.phtml (96%) rename app/code/Magento/{Checkout/view/frontend/multishipping => Multishipping/view/frontend/checkout}/success.phtml (100%) rename app/code/Magento/{Checkout => Multishipping}/view/frontend/js/multi-shipping.js (100%) rename app/code/Magento/{PageCache/view/frontend/layout/catalog_product_view.xml => Multishipping/view/frontend/layout/checkout_cart_index.xml} (84%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping.xml => Multishipping/view/frontend/layout/multishipping_checkout.xml} (90%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_address_editaddress.xml => Multishipping/view/frontend/layout/multishipping_checkout_address_editaddress.xml} (91%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_address_editbilling.xml => Multishipping/view/frontend/layout/multishipping_checkout_address_editbilling.xml} (91%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_address_editshipping.xml => Multishipping/view/frontend/layout/multishipping_checkout_address_editshipping.xml} (91%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_address_newbilling.xml => Multishipping/view/frontend/layout/multishipping_checkout_address_newbilling.xml} (91%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_address_newshipping.xml => Multishipping/view/frontend/layout/multishipping_checkout_address_newshipping.xml} (91%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_address_select.xml => Multishipping/view/frontend/layout/multishipping_checkout_address_select.xml} (84%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_address_selectbilling.xml => Multishipping/view/frontend/layout/multishipping_checkout_address_selectbilling.xml} (85%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_addresses.xml => Multishipping/view/frontend/layout/multishipping_checkout_addresses.xml} (77%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_billing.xml => Multishipping/view/frontend/layout/multishipping_checkout_billing.xml} (90%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_customer_address.xml => Multishipping/view/frontend/layout/multishipping_checkout_customer_address.xml} (100%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_login.xml => Multishipping/view/frontend/layout/multishipping_checkout_login.xml} (100%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_overview.xml => Multishipping/view/frontend/layout/multishipping_checkout_overview.xml} (75%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_register.xml => Multishipping/view/frontend/layout/multishipping_checkout_register.xml} (100%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_shipping.xml => Multishipping/view/frontend/layout/multishipping_checkout_shipping.xml} (66%) rename app/code/Magento/{Checkout/view/frontend/layout/checkout_multishipping_success.xml => Multishipping/view/frontend/layout/multishipping_checkout_success.xml} (87%) create mode 100644 app/code/Magento/Multishipping/view/frontend/multishipping/item/default.phtml delete mode 100644 app/code/Magento/PageCache/Controller/Adminhtml/PageCache.php create mode 100644 app/code/Magento/PageCache/Model/App/FrontController/HeaderPlugin.php delete mode 100644 app/code/Magento/PageCache/Model/CacheControlFactory.php delete mode 100644 app/code/Magento/PageCache/Model/Observer.php delete mode 100644 app/code/Magento/PageCache/Model/System/Config/Source/Controls.php delete mode 100644 app/code/Magento/PageCache/etc/adminhtml/acl.xml delete mode 100644 app/code/Magento/PageCache/etc/adminhtml/system.xml delete mode 100644 app/code/Magento/PageCache/view/adminhtml/cache/additional.phtml delete mode 100644 app/code/Magento/PageCache/view/frontend/cookie.phtml delete mode 100644 app/code/Magento/Paygate/Helper/Data.php delete mode 100644 app/code/Magento/Paygate/etc/adminhtml/system.xml delete mode 100644 app/code/Magento/Paygate/etc/config.xml delete mode 100644 app/code/Magento/Paygate/i18n/de_DE.csv delete mode 100644 app/code/Magento/Paygate/i18n/en_US.csv delete mode 100644 app/code/Magento/Paygate/i18n/es_ES.csv delete mode 100644 app/code/Magento/Paygate/i18n/fr_FR.csv delete mode 100644 app/code/Magento/Paygate/i18n/nl_NL.csv delete mode 100644 app/code/Magento/Paygate/i18n/pt_BR.csv delete mode 100644 app/code/Magento/Paygate/i18n/zh_CN.csv delete mode 100644 app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Tracking.php delete mode 100644 app/code/Magento/Sales/Model/CarrierFactory.php create mode 100644 app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php create mode 100644 app/code/Magento/Sales/Model/Quote/Address/CarrierFactoryInterface.php create mode 100644 app/code/Magento/Sales/Model/Quote/Address/RateCollectorInterface.php create mode 100644 app/code/Magento/Sales/Model/Quote/Address/RateRequest.php rename app/code/Magento/{Shipping/Model/Rate/Result => Sales/Model/Quote/Address/RateResult}/AbstractResult.php (90%) rename app/code/Magento/{Shipping/Model/Rate/Result => Sales/Model/Quote/Address/RateResult}/Error.php (87%) rename app/code/Magento/{Shipping/Model/Rate/Result => Sales/Model/Quote/Address/RateResult}/Method.php (88%) delete mode 100644 app/code/Magento/Sales/view/adminhtml/order/invoice/create/tracking.phtml delete mode 100644 app/code/Magento/Sales/view/adminhtml/order/shipment/create/tracking.phtml delete mode 100644 app/code/Magento/Sales/view/adminhtml/order/shipment/tracking/info.phtml delete mode 100644 app/code/Magento/Sales/view/adminhtml/order/view/tracking.phtml delete mode 100644 app/code/Magento/Sales/view/frontend/order/trackinginfo.phtml rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment => Shipping/Block/Adminhtml}/Create.php (95%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment => Shipping/Block/Adminhtml}/Create/Form.php (84%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment => Shipping/Block/Adminhtml}/Create/Items.php (89%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment => Shipping/Block/Adminhtml/Order}/Packaging.php (85%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment => Shipping/Block/Adminhtml/Order}/Packaging/Grid.php (88%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment/Create => Shipping/Block/Adminhtml/Order}/Tracking.php (89%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment/Tracking/Info.php => Shipping/Block/Adminhtml/Order/Tracking/Invoice.php} (62%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment/View/Tracking.php => Shipping/Block/Adminhtml/Order/Tracking/View.php} (58%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment => Shipping/Block/Adminhtml}/View.php (74%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment => Shipping/Block/Adminhtml}/View/Comments.php (97%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment => Shipping/Block/Adminhtml}/View/Form.php (75%) rename app/code/Magento/{Sales/Block/Adminhtml/Order/Shipment => Shipping/Block/Adminhtml}/View/Items.php (96%) rename app/code/Magento/{Sales/Block/Order/Shipment => Shipping/Block}/Items.php (98%) rename app/code/Magento/{Sales => Shipping}/Block/Order/Shipment.php (98%) rename app/code/Magento/{PageCache/Block/Adminhtml/Cache/Additional.php => Shipping/Block/Tracking/Link.php} (52%) rename app/code/Magento/{Sales => Shipping}/Controller/Adminhtml/Order/Shipment.php (85%) rename app/code/Magento/Shipping/Model/{Carrier/Factory.php => CarrierFactory.php} (57%) create mode 100644 app/code/Magento/Shipping/Model/Observer.php rename app/code/Magento/{Sales/Model/Order/Pdf/Shipment => Shipping/Model/Order/Pdf}/Packaging.php (90%) create mode 100644 app/code/Magento/Shipping/Model/Order/Track.php delete mode 100644 app/code/Magento/Shipping/Model/Rate/AbstractRate.php delete mode 100644 app/code/Magento/Shipping/Model/Rate/Request.php rename app/code/Magento/{PageCache/Model/Control/ControlInterface.php => Shipping/Model/Resource/Order/Track/Collection.php} (71%) rename app/code/Magento/{Paygate => Shipping}/etc/adminhtml/routes.xml (93%) rename app/code/Magento/{PageCache/etc/frontend/events.xml => Shipping/etc/crontab.xml} (83%) create mode 100644 app/code/Magento/Shipping/etc/di.xml rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml}/create/form.phtml (100%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml}/create/items.phtml (100%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml}/create/items/renderer/configurable.phtml (100%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml}/create/items/renderer/default.phtml (100%) rename app/code/Magento/{Sales/view/adminhtml/layout/sales_order_shipment_addcomment.xml => Shipping/view/adminhtml/layout/adminhtml_order_shipment_addcomment.xml} (91%) rename app/code/Magento/{Sales/view/adminhtml/layout/sales_order_shipment_removetrack.xml => Shipping/view/adminhtml/layout/adminhtml_order_shipment_addtrack.xml} (87%) rename app/code/Magento/{Sales/view/adminhtml/layout/sales_order_shipment_new.xml => Shipping/view/adminhtml/layout/adminhtml_order_shipment_new.xml} (61%) rename app/code/Magento/{Sales/view/adminhtml/layout/sales_order_shipment_addtrack.xml => Shipping/view/adminhtml/layout/adminhtml_order_shipment_removetrack.xml} (87%) rename app/code/Magento/{Sales/view/adminhtml/layout/sales_order_shipment_view.xml => Shipping/view/adminhtml/layout/adminhtml_order_shipment_view.xml} (53%) rename app/code/Magento/{PageCache/view/adminhtml/layout/adminhtml_cache_index.xml => Shipping/view/adminhtml/layout/sales_order_invoice_new.xml} (84%) create mode 100644 app/code/Magento/Shipping/view/adminhtml/layout/sales_order_view.xml rename app/code/Magento/{Sales/view/adminhtml/order/shipment/view/tracking.phtml => Shipping/view/adminhtml/order/Tracking/view.phtml} (97%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml/order}/packaging.js (100%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml/order}/packaging/grid.phtml (100%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml/order}/packaging/packed.phtml (99%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml/order}/packaging/popup.phtml (99%) create mode 100644 app/code/Magento/Shipping/view/adminhtml/order/tracking.phtml create mode 100644 app/code/Magento/Shipping/view/adminhtml/order/view/info.phtml rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml}/view/form.phtml (98%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml}/view/items.phtml (100%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml}/view/items/renderer/configurable.phtml (100%) rename app/code/Magento/{Sales/view/adminhtml/order/shipment => Shipping/view/adminhtml}/view/items/renderer/default.phtml (100%) rename app/code/Magento/{Sales/view/frontend/order/shipment => Shipping/view/frontend}/items.phtml (90%) create mode 100644 app/code/Magento/Shipping/view/frontend/layout/sales_guest_reorder.xml create mode 100644 app/code/Magento/Shipping/view/frontend/layout/sales_guest_shipment.xml create mode 100644 app/code/Magento/Shipping/view/frontend/layout/sales_guest_view.xml create mode 100644 app/code/Magento/Shipping/view/frontend/layout/sales_order_reorder.xml create mode 100644 app/code/Magento/Shipping/view/frontend/layout/sales_order_shipment.xml create mode 100644 app/code/Magento/Shipping/view/frontend/layout/sales_order_view.xml rename app/code/Magento/{Sales => Shipping}/view/frontend/order/shipment.phtml (100%) create mode 100644 app/code/Magento/Shipping/view/frontend/tracking/link.phtml rename dev/tests/integration/{testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/Service/TestProduct.php => framework/Magento/TestFramework/App/Filesystem/DirectoryList.php} (61%) delete mode 100644 dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/etc/service_calls.xml delete mode 100755 dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/First/etc/module.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/First/etc/service_calls.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Last/etc/service_calls.xml delete mode 100755 dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Test/etc/module.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Test/etc/service_calls.xml delete mode 100644 dev/tests/integration/testsuite/Magento/Downloadable/Model/ObserverTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Filesystem/_files/recursively/directory.txt delete mode 100644 dev/tests/integration/testsuite/Magento/Filesystem/_files/recursively/directory/read.txt create mode 100644 dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php rename dev/tests/integration/testsuite/Magento/{Catalog => GroupedProduct}/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php (82%) rename dev/tests/integration/testsuite/Magento/{Catalog => GroupedProduct}/_files/product_grouped.php (86%) rename dev/tests/integration/testsuite/Magento/{Checkout/Block/Multishipping => Multishipping/Block/Checkout}/OverviewTest.php (92%) rename dev/tests/integration/testsuite/Magento/{Checkout/Controller/MultishippingTest.php => Multishipping/Controller/CheckoutTest.php} (91%) delete mode 100644 dev/tests/integration/testsuite/Magento/PageCache/Helper/DataTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/PageCache/Model/ObserverTest.php rename dev/tests/integration/testsuite/Magento/{Sales/Block/Order/Shipment => Shipping/Block}/ItemsTest.php (93%) delete mode 100644 dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/ServiceCallsConfigTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ServiceCallsConfigFilesTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Wishlist/Helper/DataTest.php delete mode 100644 dev/tests/static/framework/Magento/TestFramework/Dependency/TemplateRule.php create mode 100644 dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DbRuleTest.php create mode 100644 dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/LayoutRuleTest.php create mode 100644 dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php rename dev/tests/{integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/etc/module.xml => static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle.xml} (86%) rename dev/tests/{integration/testsuite/Magento/Core/Model/DataService/LayoutTest/layout_update.xml => static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_parent.xml} (86%) create mode 100644 dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_update.xml create mode 100644 dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_reference.xml delete mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/LayoutConfigTest.php delete mode 100644 dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/SystemConfigTest.php rename dev/tests/static/{framework/Magento/TestFramework/Dependency/_files => testsuite/Magento/Test/Integrity/_files/dependency_test}/tables_ce.php (99%) create mode 100644 dev/tests/unit/testsuite/Magento/App/Console/ResponseTest.php rename dev/tests/unit/testsuite/Magento/{ => App}/Filesystem/DirectoryList/VerificationTest.php (66%) create mode 100644 dev/tests/unit/testsuite/Magento/App/FilesystemTest.php rename dev/tests/unit/testsuite/Magento/{Paygate => Authorizenet}/Model/Authorizenet/CardsTest.php (94%) create mode 100644 dev/tests/unit/testsuite/Magento/Backend/Block/Widget/TabTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Bundle/Controller/Adminhtml/Product/Initialization/Helper/Plugin/BundleTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CopyConstructor/BundleTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/AlertsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ViewTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/Plugin/ConfigurableTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/HelperTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopierTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/CompositeTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/CrossSellTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/RelatedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/UpSellTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructorFactoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/GroupedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/LinkTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Product/CopyConstructor/CatalogInventoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Core/Helper/PostDataTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/ConfigTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/GraphTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/InvokerTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/CompositeTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/NavigatorTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/RequestTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/RepositoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/_files/second_service_calls.xml delete mode 100644 dev/tests/unit/testsuite/Magento/Core/Model/DataService/_files/service_calls.xml create mode 100644 dev/tests/unit/testsuite/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/DownloadableTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/CopyConstructor/DownloadableTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/CopyConstructor/_files/expected_data.php create mode 100644 dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProductsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/View/Type/GroupedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/EditTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks/Plugin/GroupedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Helper/Product/Configuration/Plugin/GroupedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/CopyConstructor/GroupedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/Grouped/PriceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/GroupedProduct/Model/ProductTypes/Config/Converter/Plugin/GroupedTest.php create mode 100644 dev/tests/unit/testsuite/Magento/PageCache/Model/App/FrontController/HeaderPluginTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Paypal/Model/Method/AgreementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Shipping/Block/Adminhtml/Order/TrackingTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Shipping/Model/Order/TrackTest.php create mode 100644 lib/Magento/App/Console/Response.php create mode 100644 lib/Magento/App/Filesystem.php create mode 100644 lib/Magento/App/Filesystem/DirectoryList.php rename lib/Magento/{ => App}/Filesystem/DirectoryList/Configuration.php (92%) rename lib/Magento/{ => App}/Filesystem/DirectoryList/Verification.php (86%) create mode 100644 pub/lib/mage/dataPost.js diff --git a/CHANGELOG.md b/CHANGELOG.md index de82dd54de5..d32ee5e749d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +2.0.0.0-dev62 +============= +* Modularity improvements: + * Moved all Grouped Product functionality to newly created module GroupedProduct + * Moved Multishipping functionality to newly created module Multishipping + * Extracted Product duplication behavior from Product model to Product\Copier model + * Replaced event "catalog_model_product_duplicate" with composite Product\Copier model + * Replaced event "catalog_product_prepare_save" with controller product initialization helper that can be customozed via plugins + * Consolidated Authorize.Net functionality in single module Authorizenet + * Eliminated dependency of Sales module on Shipping and Usa modules + * Eliminated dependency of Shipping module on Customer module + * Improved accuracy and quality of Module Dependency Test +* Fixed bugs: + * Fixed an issue when order was sent to PayPal in USD regardless of currency used during order creation + * Fixed an issue with 404 error when clicking any button on a Recurring Billing Profile in the backend + * Fixed an issue with synchronization with Google Shopping on product update caused by missed service property + * Fixed ability to submit order in the backend when Authorize.Net Direct Post is used + * Fixed an issue with notice that _attribute_set column is missing during Import/Export +* Removed the deprecated service-calls and data source functionality +* Request\Response workflow improvements: + * Added Console\Response + * Changed behavior of AppInterface to return ResponseInterface instead of sending it + 2.0.0.0-dev61 ============= * Introduced a new layout block attribute - cacheable @@ -147,6 +170,10 @@ * Fixed date resetting to 1 Jan 1970 after saving a design change in the admin panel in case date format is DD/MM/YY * Fixed CAPTCHA on multi-address checkout flow * Fixed view files population tool + * Fixed DHL functionality of generation shipping labels + * Fixed target rule if it is applied for specific customer segment + * Fixed product importing that cleared price and weight + * Fixed fatal error when a file reference is added to HTML head * GitHub requests: * [#122](https://github.com/magento/magento2/pull/122) -- Added support of federal units of Brazil with 27 states * [#184](https://github.com/magento/magento2/issues/184) -- Removed unused blocks and methods in Magento_Wishlist module diff --git a/app/code/Magento/AdminNotification/Block/Window.php b/app/code/Magento/AdminNotification/Block/Window.php index a05b2427dc7..4568f8177c8 100644 --- a/app/code/Magento/AdminNotification/Block/Window.php +++ b/app/code/Magento/AdminNotification/Block/Window.php @@ -60,6 +60,14 @@ class Window extends \Magento\Backend\Block\Template */ protected $_latestItem; + /** + * The property is used to define content-scope of block. Can be private or public. + * If it isn't defined then application considers it as false. + * + * @var bool + */ + protected $_isScopePrivate; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Backend\Model\Auth\Session $authSession @@ -75,6 +83,7 @@ class Window extends \Magento\Backend\Block\Template parent::__construct($context, $data); $this->_authSession = $authSession; $this->_criticalCollection = $criticalCollection; + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Paygate/Block/Authorizenet/Form/Cc.php b/app/code/Magento/Authorizenet/Block/Authorizenet/Form/Cc.php similarity index 86% rename from app/code/Magento/Paygate/Block/Authorizenet/Form/Cc.php rename to app/code/Magento/Authorizenet/Block/Authorizenet/Form/Cc.php index b8dc87d0de0..e4322a42600 100644 --- a/app/code/Magento/Paygate/Block/Authorizenet/Form/Cc.php +++ b/app/code/Magento/Authorizenet/Block/Authorizenet/Form/Cc.php @@ -19,16 +19,16 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Paygate\Block\Authorizenet\Form; +namespace Magento\Authorizenet\Block\Authorizenet\Form; class Cc extends \Magento\Payment\Block\Form { - protected $_template = 'Magento_Paygate::form/cc.phtml'; + protected $_template = 'Magento_Authorizenet::form/cc.phtml'; /** * Retrieve payment method form html @@ -48,7 +48,7 @@ class Cc extends \Magento\Payment\Block\Form */ public function getCardsBlock() { - return $this->getLayout()->createBlock('Magento\Paygate\Block\Authorizenet\Info\Cc') + return $this->getLayout()->createBlock('Magento\Authorizenet\Block\Authorizenet\Info\Cc') ->setMethod($this->getMethod()) ->setInfo($this->getMethod()->getInfoInstance()) ->setCheckoutProgressBlock(false) @@ -62,7 +62,7 @@ class Cc extends \Magento\Payment\Block\Form */ public function getCancelUrl() { - return $this->getUrl('paygate/authorizenet_payment/cancel'); + return $this->getUrl('authorizenet/authorizenet_payment/cancel'); } /** @@ -72,7 +72,7 @@ class Cc extends \Magento\Payment\Block\Form */ public function getAdminCancelUrl() { - return $this->_urlBuilder->getUrl('adminhtml/paygate_authorizenet_payment/cancel'); + return $this->_urlBuilder->getUrl('adminhtml/authorizenet_payment/cancel'); } /** @@ -107,10 +107,10 @@ class Cc extends \Magento\Payment\Block\Form public function getPartialAuthorizationConfirmationMessage() { $lastActionState = $this->getMethod()->getPartialAuthorizationLastActionState(); - if ($lastActionState == \Magento\Paygate\Model\Authorizenet::PARTIAL_AUTH_LAST_SUCCESS) { + if ($lastActionState == \Magento\Authorizenet\Model\Authorizenet::PARTIAL_AUTH_LAST_SUCCESS) { $this->getMethod()->unsetPartialAuthorizationLastActionState(); return __('You don\'t have enough on your credit card to pay for this purchase. To complete your purchase, click "OK" and add a credit card to use for the balance. Otherwise, you can cancel the purchase and release the partial payment we are holding.'); - } elseif ($lastActionState == \Magento\Paygate\Model\Authorizenet::PARTIAL_AUTH_LAST_DECLINED) { + } elseif ($lastActionState == \Magento\Authorizenet\Model\Authorizenet::PARTIAL_AUTH_LAST_DECLINED) { $this->getMethod()->unsetPartialAuthorizationLastActionState(); return __('Your credit card has been declined. You can click OK to add another credit card to complete your purchase. Or you can cancel this credit transaction and pay a different way.'); } @@ -127,13 +127,13 @@ class Cc extends \Magento\Payment\Block\Form $lastActionState = $this->getMethod()->getPartialAuthorizationLastActionState(); $message = false; switch ($lastActionState) { - case \Magento\Paygate\Model\Authorizenet::PARTIAL_AUTH_ALL_CANCELED: + case \Magento\Authorizenet\Model\Authorizenet::PARTIAL_AUTH_ALL_CANCELED: $message = __('We canceled your payment and released any money we were holding.'); break; - case \Magento\Paygate\Model\Authorizenet::PARTIAL_AUTH_CARDS_LIMIT_EXCEEDED: + case \Magento\Authorizenet\Model\Authorizenet::PARTIAL_AUTH_CARDS_LIMIT_EXCEEDED: $message = __('You can\'t use any more credit cards for this payment, and you don\'t have enough to pay for this purchase. Sorry, but we\'ll have to cancel your transaction.'); break; - case \Magento\Paygate\Model\Authorizenet::PARTIAL_AUTH_DATA_CHANGED: + case \Magento\Authorizenet\Model\Authorizenet::PARTIAL_AUTH_DATA_CHANGED: $message = __('Your order has not been placed, because the contents of the shopping cart and/or your address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process to purchase your cart contents.'); break; } diff --git a/app/code/Magento/Paygate/Block/Authorizenet/Info/Cc.php b/app/code/Magento/Authorizenet/Block/Authorizenet/Info/Cc.php similarity index 93% rename from app/code/Magento/Paygate/Block/Authorizenet/Info/Cc.php rename to app/code/Magento/Authorizenet/Block/Authorizenet/Info/Cc.php index c457f3a3302..c27e8af2f70 100644 --- a/app/code/Magento/Paygate/Block/Authorizenet/Info/Cc.php +++ b/app/code/Magento/Authorizenet/Block/Authorizenet/Info/Cc.php @@ -19,12 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Paygate\Block\Authorizenet\Info; +namespace Magento\Authorizenet\Block\Authorizenet\Info; use Magento\Payment\Block\Info; @@ -37,7 +37,7 @@ class Cc extends \Magento\Payment\Block\Info\Cc */ protected $_isCheckoutProgressBlockFlag = true; - protected $_template = 'Magento_Paygate::info/cc.phtml'; + protected $_template = 'Magento_Authorizenet::info/cc.phtml'; /** * @var \Magento\Core\Helper\Data @@ -67,7 +67,7 @@ class Cc extends \Magento\Payment\Block\Info\Cc */ public function toPdf() { - $this->setTemplate('Magento_Paygate::info/pdf.phtml'); + $this->setTemplate('Magento_Authorizenet::info/pdf.phtml'); return $this->toHtml(); } @@ -90,7 +90,7 @@ class Cc extends \Magento\Payment\Block\Info\Cc * in Previously used card information block * * @param bool $flag - * @return \Magento\Paygate\Block\Authorizenet\Info\Cc + * @return \Magento\Authorizenet\Block\Authorizenet\Info\Cc */ public function setCheckoutProgressBlock($flag) { diff --git a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php index 496b2f8a4ad..6cc99bb9c42 100644 --- a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php @@ -130,18 +130,18 @@ class Payment $session->addCheckoutOrderIncrementId($order->getIncrementId()); $session->setLastOrderIncrementId($order->getIncrementId()); - $requestToPaygate = $payment->getMethodInstance()->generateRequestFromOrder($order); - $requestToPaygate->setControllerActionName($controller); - $requestToPaygate->setOrderSendConfirmation($sendConfirmationFlag); - $requestToPaygate->setStoreId($this->_getOrderCreateModel()->getQuote()->getStoreId()); + $requestToAuthorizenet = $payment->getMethodInstance()->generateRequestFromOrder($order); + $requestToAuthorizenet->setControllerActionName($controller); + $requestToAuthorizenet->setOrderSendConfirmation($sendConfirmationFlag); + $requestToAuthorizenet->setStoreId($this->_getOrderCreateModel()->getQuote()->getStoreId()); $adminUrl = $this->_objectManager->get('Magento\Backend\Model\Url'); if ($adminUrl->useSecretKey()) { - $requestToPaygate->setKey( + $requestToAuthorizenet->setKey( $adminUrl->getSecretKey('adminhtml', 'authorizenet_directpost_payment', 'redirect') ); } - $result['directpost'] = array('fields' => $requestToPaygate->getData()); + $result['directpost'] = array('fields' => $requestToAuthorizenet->getData()); } $result['success'] = 1; diff --git a/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php similarity index 79% rename from app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php rename to app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php index d82663da641..cc02049e6e3 100644 --- a/app/code/Magento/Paygate/Controller/Adminhtml/Paygate/Authorizenet/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Authorize Payment Controller * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Paygate\Controller\Adminhtml\Paygate\Authorizenet; +namespace Magento\Authorizenet\Controller\Adminhtml\Authorizenet; class Payment extends \Magento\Backend\App\Action { @@ -63,7 +63,7 @@ class Payment extends \Magento\Backend\App\Action $result['success'] = false; try { $paymentMethod = $this->_objectManager->get('Magento\Payment\Helper\Data') - ->getMethodInstance(\Magento\Paygate\Model\Authorizenet::METHOD_CODE); + ->getMethodInstance(\Magento\Authorizenet\Model\Authorizenet::METHOD_CODE); if ($paymentMethod) { $paymentMethod->setStore( @@ -75,7 +75,8 @@ class Payment extends \Magento\Backend\App\Action } $result['success'] = true; - $result['update_html'] = $this->_getPaymentMethodsHtml(); + $result['update_html'] = $this->_objectManager->get('Magento\Authorizenet\Helper\Data') + ->getPaymentMethodsHtml($this->_view); } catch (\Magento\Core\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = $e->getMessage(); @@ -87,23 +88,4 @@ class Payment extends \Magento\Backend\App\Action $this->_sessionQuote->getQuote()->getPayment()->save(); $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); } - - /** - * Get payment method step html - * - * @return string - */ - protected function _getPaymentMethodsHtml() - { - $layout = $this->_view->getLayout(); - - $update = $layout->getUpdate(); - $update->load('checkout_onepage_paymentmethod'); - - $layout->generateXml(); - $layout->generateElements(); - - $output = $layout->getOutput(); - return $output; - } } diff --git a/app/code/Magento/Paygate/Controller/Authorizenet/Payment.php b/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php similarity index 75% rename from app/code/Magento/Paygate/Controller/Authorizenet/Payment.php rename to app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php index 171f0b68297..0a86c9b7521 100644 --- a/app/code/Magento/Paygate/Controller/Authorizenet/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php @@ -19,19 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Authorize Payment Controller - * - * @category Magento - * @package Magento_Paygate - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Paygate\Controller\Authorizenet; +namespace Magento\Authorizenet\Controller\Authorizenet; class Payment extends \Magento\App\Action\Action { @@ -63,14 +56,15 @@ class Payment extends \Magento\App\Action\Action $result['success'] = false; try { $paymentMethod = $this->_objectManager->get('Magento\Payment\Helper\Data') - ->getMethodInstance(\Magento\Paygate\Model\Authorizenet::METHOD_CODE); + ->getMethodInstance(\Magento\Authorizenet\Model\Authorizenet::METHOD_CODE); if ($paymentMethod) { $paymentMethod->cancelPartialAuthorization( $this->_session->getQuote()->getPayment() ); } $result['success'] = true; - $result['update_html'] = $this->_getPaymentMethodsHtml(); + $result['update_html'] = $this->_objectManager->get('Magento\Authorizenet\Helper\Data') + ->getPaymentMethodsHtml($this->_view); } catch (\Magento\Core\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = $e->getMessage(); @@ -82,20 +76,4 @@ class Payment extends \Magento\App\Action\Action $this->_session->getQuote()->getPayment()->save(); $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); } - - /** - * Get payment method step html - * - * @return string - */ - protected function _getPaymentMethodsHtml() - { - $layout = $this->_view->getLayout(); - $update = $layout->getUpdate(); - $update->load('checkout_onepage_paymentmethod'); - $layout->generateXml(); - $layout->generateElements(); - $output = $layout->getOutput(); - return $output; - } } diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php index 58910ec62c8..46d327ef1b6 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php @@ -72,11 +72,31 @@ class Payment extends \Magento\App\Action\Action return $this->_objectManager->get('Magento\Authorizenet\Model\Directpost\Session'); } + /** + * Response action. + * Action for Authorize.net SIM Relay Request. + */ + public function backendResponseAction() + { + $this->_responseAction($this->_objectManager->get('Magento\Authorizenet\Helper\Backend')); + } + /** * Response action. * Action for Authorize.net SIM Relay Request. */ public function responseAction() + { + $this->_responseAction($this->_objectManager->get('Magento\Authorizenet\Helper\Data')); + } + + /** + * Response action. + * Action for Authorize.net SIM Relay Request. + * + * @param \Magento\Authorizenet\Helper\HelperInterface $helper + */ + protected function _responseAction(\Magento\Authorizenet\Helper\HelperInterface $helper) { $params = array(); $data = $this->getRequest()->getPost(); @@ -112,8 +132,7 @@ class Payment extends \Magento\App\Action\Action } $result['controller_action_name'] = $data['controller_action_name']; $result['is_secure'] = isset($data['is_secure']) ? $data['is_secure'] : false; - $params['redirect'] = $this->_objectManager->get('Magento\Authorizenet\Helper\HelperInterface') - ->getRedirectIframeUrl($result); + $params['redirect'] = $helper->getRedirectIframeUrl($result); } $this->_coreRegistry->register('authorizenet_directpost_form_params', $params); diff --git a/app/code/Magento/Authorizenet/Helper/Backend.php b/app/code/Magento/Authorizenet/Helper/Backend.php index 0bdf9566c8b..92ba346c82a 100644 --- a/app/code/Magento/Authorizenet/Helper/Backend.php +++ b/app/code/Magento/Authorizenet/Helper/Backend.php @@ -31,6 +31,23 @@ namespace Magento\Authorizenet\Helper; */ class Backend extends Data { + /** + * @param \Magento\App\Helper\Context $context + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Sales\Model\OrderFactory $orderFactory + * @param \Magento\Backend\Model\Url $backendUrl + */ + public function __construct( + \Magento\App\Helper\Context $context, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Sales\Model\OrderFactory $orderFactory, + \Magento\Backend\Model\Url $backendUrl + ) { + parent::__construct($context, $storeManager, $orderFactory); + $this->_urlBuilder = $backendUrl; + } + + /** * Return URL for admin area * @@ -50,7 +67,7 @@ class Backend extends Data */ public function getPlaceOrderAdminUrl() { - return $this->_getUrl('*/authorizenet_directpost_payment/place', array()); + return $this->_getUrl('adminhtml/authorizenet_directpost_payment/place', array()); } /** @@ -78,4 +95,16 @@ class Backend extends Data { return $this->_getUrl('adminhtml/authorizenet_directpost_payment/redirect', $params); } + + /** + * Get direct post rely url + * + * @param null|int|string $storeId + * @return string + */ + public function getRelyUrl($storeId = null) + { + return $this->_storeManager->getDefaultStoreView()->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_LINK) + . 'authorizenet/directpost_payment/backendResponse'; + } } diff --git a/app/code/Magento/Authorizenet/Helper/Data.php b/app/code/Magento/Authorizenet/Helper/Data.php index 77d393f6901..3dbcedd6794 100644 --- a/app/code/Magento/Authorizenet/Helper/Data.php +++ b/app/code/Magento/Authorizenet/Helper/Data.php @@ -178,4 +178,160 @@ class Data extends \Magento\App\Helper\AbstractHelper implements HelperInterface } } } + + /** + * Converts a lot of messages to message + * + * @param array $messages + * @return string + */ + public function convertMessagesToMessage($messages) + { + return implode(' | ', $messages); + } + + /** + * Return message for gateway transaction request + * + * @param \Magento\Payment\Model\Info $payment + * @param string $requestType + * @param string $lastTransactionId + * @param \Magento\Object $card + * @param bool|float $amount + * @param bool|string $exception + * @return bool|string + */ + public function getTransactionMessage( + $payment, + $requestType, + $lastTransactionId, + $card, + $amount = false, + $exception = false + ) { + return $this->getExtendedTransactionMessage( + $payment, $requestType, $lastTransactionId, $card, $amount, $exception + ); + } + + /** + * Return message for gateway transaction request + * + * @param \Magento\Payment\Model\Info $payment + * @param string $requestType + * @param string $lastTransactionId + * @param \Magento\Object $card + * @param bool|float $amount + * @param bool|string $exception + * @param bool|string $additionalMessage + * @return bool|mixed + */ + public function getExtendedTransactionMessage( + $payment, + $requestType, + $lastTransactionId, + $card, + $amount = false, + $exception = false, + $additionalMessage = false + ) { + $operation = $this->_getOperation($requestType); + + if (!$operation) { + return false; + } + + if ($amount) { + $amount = __('amount %1', $this->_formatPrice($payment, $amount)); + } + + if ($exception) { + $result = __('failed'); + } else { + $result = __('successful'); + } + + $card = __('Credit Card: xxxx-%1', $card->getCcLast4()); + + $pattern = '%s %s %s - %s.'; + $texts = array($card, $amount, $operation, $result); + + if (!is_null($lastTransactionId)) { + $pattern .= ' %s.'; + $texts[] = __('Authorize.Net Transaction ID %1', $lastTransactionId); + } + + if ($additionalMessage) { + $pattern .= ' %s.'; + $texts[] = $additionalMessage; + } + $pattern .= ' %s'; + $texts[] = $exception; + + return call_user_func_array('__', array_merge(array($pattern), $texts)); + } + + /** + * Return operation name for request type + * + * @param string $requestType + * @return bool|string + */ + protected function _getOperation($requestType) + { + switch ($requestType) { + case \Magento\Authorizenet\Model\Authorizenet::REQUEST_TYPE_AUTH_ONLY: + return __('authorize'); + case \Magento\Authorizenet\Model\Authorizenet::REQUEST_TYPE_AUTH_CAPTURE: + return __('authorize and capture'); + case \Magento\Authorizenet\Model\Authorizenet::REQUEST_TYPE_PRIOR_AUTH_CAPTURE: + return __('capture'); + case \Magento\Authorizenet\Model\Authorizenet::REQUEST_TYPE_CREDIT: + return __('refund'); + case \Magento\Authorizenet\Model\Authorizenet::REQUEST_TYPE_VOID: + return __('void'); + default: + return false; + } + } + + /** + * Format price with currency sign + * @param \Magento\Payment\Model\Info $payment + * @param float $amount + * @return string + */ + protected function _formatPrice($payment, $amount) + { + return $payment->getOrder()->getBaseCurrency()->formatTxt($amount); + } + + /** + * Get payment method step html + * + * @param \Magento\App\ViewInterface $view + * @return string + */ + public function getPaymentMethodsHtml(\Magento\App\ViewInterface $view) + { + $layout = $view->getLayout(); + $update = $layout->getUpdate(); + $update->load('checkout_onepage_paymentmethod'); + $layout->generateXml(); + $layout->generateElements(); + $output = $layout->getOutput(); + return $output; + } + + /** + * Get direct post rely url + * + * @param null|int|string $storeId + * @return string + */ + public function getRelyUrl($storeId = null) + { + return $this->_storeManager->getStore($storeId)->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_LINK) + . 'authorizenet/directpost_payment/response'; + } } diff --git a/app/code/Magento/Authorizenet/Helper/HelperInterface.php b/app/code/Magento/Authorizenet/Helper/HelperInterface.php index cca99723160..41534265848 100644 --- a/app/code/Magento/Authorizenet/Helper/HelperInterface.php +++ b/app/code/Magento/Authorizenet/Helper/HelperInterface.php @@ -34,7 +34,7 @@ interface HelperInterface /** * Retrieve place order url * - * @param array params + * @param array $params * @return string */ public function getSuccessOrderUrl($params); @@ -42,8 +42,16 @@ interface HelperInterface /** * Retrieve redirect ifrmae url * - * @param array params + * @param array $params * @return string */ public function getRedirectIframeUrl($params); + + /** + * Get direct post rely url + * + * @param null|int|string $storeId + * @return string + */ + public function getRelyUrl($storeId = null); } diff --git a/app/code/Magento/Paygate/Model/Authorizenet.php b/app/code/Magento/Authorizenet/Model/Authorizenet.php similarity index 94% rename from app/code/Magento/Paygate/Model/Authorizenet.php rename to app/code/Magento/Authorizenet/Model/Authorizenet.php index 99c38647a5c..e161544d163 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Paygate\Model; +namespace Magento\Authorizenet\Model; class Authorizenet extends \Magento\Payment\Model\Method\Cc { @@ -86,12 +86,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc /** * Form block type */ - protected $_formBlockType = 'Magento\Paygate\Block\Authorizenet\Form\Cc'; + protected $_formBlockType = 'Magento\Authorizenet\Block\Authorizenet\Form\Cc'; /** * Info block type */ - protected $_infoBlockType = 'Magento\Paygate\Block\Authorizenet\Info\Cc'; + protected $_infoBlockType = 'Magento\Authorizenet\Block\Authorizenet\Info\Cc'; /** * Availability options @@ -151,13 +151,13 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * Key for storing partial authorization last action state in session * @var string */ - protected $_partialAuthorizationLastActionStateSessionKey = 'paygate_authorizenet_last_action_state'; + protected $_partialAuthorizationLastActionStateSessionKey = 'authorizenet_last_action_state'; /** * Key for storing partial authorization checksum in session * @var string */ - protected $_partialAuthorizationChecksumSessionKey = 'paygate_authorizenet_checksum'; + protected $_partialAuthorizationChecksumSessionKey = 'authorizenet_checksum'; /** * Fields for creating place request checksum @@ -184,16 +184,16 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc ); /** - * @var \Magento\Paygate\Model\Authorizenet\Cards + * @var \Magento\Authorizenet\Model\Authorizenet\Cards */ protected $_cardsStorage = null; /** - * Paygate data + * Authorizenet data * - * @var \Magento\Paygate\Helper\Data + * @var \Magento\Authorizenet\Helper\Data */ - protected $_paygateData = null; + protected $_authorizenetData = null; /** * Session @@ -212,21 +212,21 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc /** * Result factory * - * @var \Magento\Paygate\Model\Authorizenet\ResultFactory + * @var \Magento\Authorizenet\Model\Authorizenet\ResultFactory */ protected $_resultFactory; /** * Request factory * - * @var \Magento\Paygate\Model\Authorizenet\RequestFactory + * @var \Magento\Authorizenet\Model\Authorizenet\RequestFactory */ protected $_requestFactory; /** * Cards factory * - * @var \Magento\Paygate\Model\Authorizenet\CardsFactory + * @var \Magento\Authorizenet\Model\Authorizenet\CardsFactory */ protected $_cardsFactory; @@ -239,12 +239,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService - * @param \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory - * @param \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory - * @param \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory + * @param \Magento\Authorizenet\Model\Authorizenet\CardsFactory $cardsFactory + * @param \Magento\Authorizenet\Model\Authorizenet\RequestFactory $requestFactory + * @param \Magento\Authorizenet\Model\Authorizenet\ResultFactory $resultFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Session\SessionManagerInterface $session - * @param \Magento\Paygate\Helper\Data $paygateData + * @param \Magento\Authorizenet\Helper\Data $authorizenetData * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -258,12 +258,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, - \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory, - \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory, - \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory, + \Magento\Authorizenet\Model\Authorizenet\CardsFactory $cardsFactory, + \Magento\Authorizenet\Model\Authorizenet\RequestFactory $requestFactory, + \Magento\Authorizenet\Model\Authorizenet\ResultFactory $resultFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Session\SessionManagerInterface $session, - \Magento\Paygate\Helper\Data $paygateData, + \Magento\Authorizenet\Helper\Data $authorizenetData, array $data = array() ) { $this->_cardsFactory = $cardsFactory; @@ -271,7 +271,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $this->_resultFactory = $resultFactory; $this->_orderFactory = $orderFactory; $this->_session = $session; - $this->_paygateData = $paygateData; + $this->_authorizenetData = $authorizenetData; parent::__construct( $eventManager, $paymentData, @@ -382,7 +382,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * Set partial authorization last action state into session * * @param string $message - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet */ public function setPartialAuthorizationLastActionState($state) { @@ -403,7 +403,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc /** * Unset partial authorization last action state in session * - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet */ public function unsetPartialAuthorizationLastActionState() { @@ -416,7 +416,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Payment\Model\Info $payment * @param decimal $amount - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet */ public function authorize(\Magento\Object $payment, $amount) { @@ -442,7 +442,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Payment\Model\Info $payment * @param decimal $amount - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet */ public function capture(\Magento\Object $payment, $amount) { @@ -465,7 +465,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * Void the payment through gateway * * @param \Magento\Payment\Model\Info $payment - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet */ public function void(\Magento\Object $payment) { @@ -499,7 +499,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * Cancel the payment through gateway * * @param \Magento\Payment\Model\Info $payment - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet */ public function cancel(\Magento\Object $payment) { @@ -511,7 +511,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Payment\Model\Info $payment * @param decimal $amount - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet * @throws \Magento\Core\Exception */ public function refund(\Magento\Object $payment, $requestedAmount) @@ -600,7 +600,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param decimal $amount * @param string $requestType - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet * @throws \Magento\Core\Exception */ protected function _place($payment, $amount, $requestType) @@ -631,7 +631,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $newTransactionType, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $card->getLastTransId()), - $this->_paygateData->getTransactionMessage( + $this->_authorizenetData->getTransactionMessage( $payment, $requestType, $card->getLastTransId(), $card, $amount ) ); @@ -654,7 +654,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $this->_realTransactionIdKey => $card->getLastTransId(), $this->_isTransactionFraud => true ), - $this->_paygateData->getTransactionMessage( + $this->_authorizenetData->getTransactionMessage( $payment, $requestType, $card->getLastTransId(), $card, $amount ) ); @@ -690,7 +690,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param decimal $amount * @param string $requestType - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet */ protected function _partialAuthorization($payment, $amount, $requestType) { @@ -741,7 +741,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $newTransactionType, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $card->getLastTransId()), - $this->_paygateData->getTransactionMessage( + $this->_authorizenetData->getTransactionMessage( $payment, $requestType, $card->getLastTransId(), $card, $card->getProcessedAmount() ) ); @@ -781,7 +781,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Payment\Model\Info $payment * @param decimal $amount - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet */ protected function _preauthorizeCapture($payment, $requestedAmount) { @@ -817,11 +817,6 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $card->setCapturedAmount($cardAmountForCapture); $cardsStorage->updateCard($card); $requestedAmount = $this->_formatAmount($requestedAmount - $cardAmountForCapture); - } else { - /** - * This functional is commented because partial capture is disable. See self::_canCapturePartial. - */ - //$this->_voidCardTransaction($payment, $card); } } @@ -835,9 +830,10 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * Send capture request to gateway for capture authorized transactions of card * * @param \Magento\Payment\Model\Info $payment - * @param decimal $amount + * @param float $amount * @param \Magento\Object $card * @return \Magento\Sales\Model\Order\Payment\Transaction + * @throws \Magento\Core\Exception */ protected function _preauthorizeCaptureCardTransaction($payment, $amount, $card) { @@ -866,7 +862,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc 'parent_transaction_id' => $authTransactionId ), array($this->_realTransactionIdKey => $result->getTransactionId()), - $this->_paygateData->getTransactionMessage( + $this->_authorizenetData->getTransactionMessage( $payment, self::REQUEST_TYPE_PRIOR_AUTH_CAPTURE, $result->getTransactionId(), $card, $amount ) ); @@ -883,7 +879,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc break; } - $exceptionMessage = $this->_paygateData->getTransactionMessage( + $exceptionMessage = $this->_authorizenetData->getTransactionMessage( $payment, self::REQUEST_TYPE_PRIOR_AUTH_CAPTURE, $realAuthTransactionId, $card, $amount, $exceptionMessage ); throw new \Magento\Core\Exception($exceptionMessage); @@ -923,7 +919,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc 'parent_transaction_id' => $authTransactionId ), array($this->_realTransactionIdKey => $result->getTransactionId()), - $this->_paygateData->getTransactionMessage( + $this->_authorizenetData->getTransactionMessage( $payment, self::REQUEST_TYPE_VOID, $result->getTransactionId(), $card ) ); @@ -946,7 +942,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc 'parent_transaction_id' => $authTransactionId ), array(), - $this->_paygateData->getExtendedTransactionMessage( + $this->_authorizenetData->getExtendedTransactionMessage( $payment, self::REQUEST_TYPE_VOID, null, @@ -967,7 +963,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc break; } - $exceptionMessage = $this->_paygateData->getTransactionMessage( + $exceptionMessage = $this->_authorizenetData->getTransactionMessage( $payment, self::REQUEST_TYPE_VOID, $realAuthTransactionId, $card, false, $exceptionMessage ); throw new \Magento\Core\Exception($exceptionMessage); @@ -1034,7 +1030,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc 'parent_transaction_id' => $captureTransactionId ), array($this->_realTransactionIdKey => $result->getTransactionId()), - $this->_paygateData->getTransactionMessage( + $this->_authorizenetData->getTransactionMessage( $payment, self::REQUEST_TYPE_CREDIT, $result->getTransactionId(), $card, $amount ) ); @@ -1050,7 +1046,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc break; } - $exceptionMessage = $this->_paygateData->getTransactionMessage( + $exceptionMessage = $this->_authorizenetData->getTransactionMessage( $payment, self::REQUEST_TYPE_CREDIT, $realCaptureTransactionId, $card, $amount, $exceptionMessage ); throw new \Magento\Core\Exception($exceptionMessage); @@ -1070,7 +1066,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * Return cards storage model * * @param \Magento\Payment\Model\Info $payment - * @return \Magento\Paygate\Model\Authorizenet\Cards + * @return \Magento\Authorizenet\Model\Authorizenet\Cards */ public function getCardsStorage($payment = null) { @@ -1224,7 +1220,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc /** * Return authorize payment request * - * @return \Magento\Paygate\Model\Authorizenet\Request + * @return \Magento\Authorizenet\Model\Authorizenet\Request */ protected function _getRequest() { @@ -1244,7 +1240,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @link http://www.authorize.net/support/AIM_guide.pdf * @param \Magento\Object|\Magento\Payment\Model\Info $payment - * @return \Magento\Paygate\Model\Authorizenet\Request + * @return \Magento\Authorizenet\Model\Authorizenet\Request */ protected function _buildRequest(\Magento\Object $payment) { @@ -1352,8 +1348,8 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc /** * Post request to gateway and return responce * - * @param \Magento\Paygate\Model\Authorizenet\Request $request) - * @return \Magento\Paygate\Model\Authorizenet\Result + * @param \Magento\Authorizenet\Model\Authorizenet\Request $request) + * @return \Magento\Authorizenet\Model\Authorizenet\Result */ protected function _postRequest(\Magento\Object $request) { @@ -1366,9 +1362,8 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $uri = $this->getConfigData('cgi_url'); $client->setUri($uri ? $uri : self::CGI_URL); $client->setConfig(array( - 'maxredirects'=>0, - 'timeout'=>30, - //'ssltransport' => 'tcp', + 'maxredirects' => 0, + 'timeout' => 30, )); foreach ($request->getData() as $key => $value) { $request->setData($key, str_replace(self::RESPONSE_DELIM_CHAR, '', $value)); @@ -1415,8 +1410,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc ->setAccNumber($r[50]) ->setCardType($r[51]) ->setRequestedAmount($r[53]) - ->setBalanceOnCard($r[54]) - ; + ->setBalanceOnCard($r[54]); } else { throw new \Magento\Core\Exception( @@ -1475,7 +1469,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * Reset assigned data in payment info model * * @param \Magento\Payment\Model\Info - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet */ private function _clearAssignedData($payment) { @@ -1488,8 +1482,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc ->setCcExpYear(null) ->setCcSsIssue(null) ->setCcSsStartMonth(null) - ->setCcSsStartYear(null) - ; + ->setCcSsStartYear(null); return $this; } @@ -1580,7 +1573,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc } $copyOrder->save(); } - throw new \Magento\Core\Exception($this->_paygateData->convertMessagesToMessage($messages)); + throw new \Magento\Core\Exception($this->_authorizenetData->convertMessagesToMessage($messages)); } /** @@ -1646,8 +1639,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $response ->setResponseCode((string)$responseXmlDocument->transaction->responseCode) ->setResponseReasonCode((string)$responseXmlDocument->transaction->responseReasonCode) - ->setTransactionStatus((string)$responseXmlDocument->transaction->transactionStatus) - ; + ->setTransactionStatus((string)$responseXmlDocument->transaction->transactionStatus); return $response; } } diff --git a/app/code/Magento/Paygate/Model/Authorizenet/Cards.php b/app/code/Magento/Authorizenet/Model/Authorizenet/Cards.php similarity index 95% rename from app/code/Magento/Paygate/Model/Authorizenet/Cards.php rename to app/code/Magento/Authorizenet/Model/Authorizenet/Cards.php index 522139559a8..0a2a0c71a5d 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet/Cards.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet/Cards.php @@ -19,12 +19,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Paygate\Model\Authorizenet; +namespace Magento\Authorizenet\Model\Authorizenet; class Cards { @@ -52,7 +52,7 @@ class Cards * Set payment instance for storing credit card information and partial authorizations * * @param \Magento\Payment\Model\Info $payment - * @return \Magento\Paygate\Model\Authorizenet\Cards + * @return \Magento\Authorizenet\Model\Authorizenet\Cards */ public function setPayment(\Magento\Payment\Model\Info $payment) { @@ -99,7 +99,7 @@ class Cards * Save data from card object in cards storage * * @param \Magento\Object $card - * @return \Magento\Paygate\Model\Authorizenet\Cards + * @return \Magento\Authorizenet\Model\Authorizenet\Cards */ public function updateCard($card) { @@ -185,7 +185,7 @@ class Cards /** * Remove all cards from payment instance * - * @return \Magento\Paygate\Model\Authorizenet\Cards + * @return \Magento\Authorizenet\Model\Authorizenet\Cards */ public function flushCards() { diff --git a/app/code/Magento/Paygate/Model/Authorizenet/Debug.php b/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php similarity index 60% rename from app/code/Magento/Paygate/Model/Authorizenet/Debug.php rename to app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php index cc956b04386..6ac976c2157 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet/Debug.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php @@ -19,38 +19,38 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * @method \Magento\Paygate\Model\Resource\Authorizenet\Debug _getResource() - * @method \Magento\Paygate\Model\Resource\Authorizenet\Debug getResource() + * @method \Magento\Authorizenet\Model\Resource\Authorizenet\Debug _getResource() + * @method \Magento\Authorizenet\Model\Resource\Authorizenet\Debug getResource() * @method string getRequestBody() - * @method \Magento\Paygate\Model\Authorizenet\Debug setRequestBody(string $value) + * @method \Magento\Authorizenet\Model\Authorizenet\Debug setRequestBody(string $value) * @method string getResponseBody() - * @method \Magento\Paygate\Model\Authorizenet\Debug setResponseBody(string $value) + * @method \Magento\Authorizenet\Model\Authorizenet\Debug setResponseBody(string $value) * @method string getRequestSerialized() - * @method \Magento\Paygate\Model\Authorizenet\Debug setRequestSerialized(string $value) + * @method \Magento\Authorizenet\Model\Authorizenet\Debug setRequestSerialized(string $value) * @method string getResultSerialized() - * @method \Magento\Paygate\Model\Authorizenet\Debug setResultSerialized(string $value) + * @method \Magento\Authorizenet\Model\Authorizenet\Debug setResultSerialized(string $value) * @method string getRequestDump() - * @method \Magento\Paygate\Model\Authorizenet\Debug setRequestDump(string $value) + * @method \Magento\Authorizenet\Model\Authorizenet\Debug setRequestDump(string $value) * @method string getResultDump() - * @method \Magento\Paygate\Model\Authorizenet\Debug setResultDump(string $value) + * @method \Magento\Authorizenet\Model\Authorizenet\Debug setResultDump(string $value) * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Paygate\Model\Authorizenet; +namespace Magento\Authorizenet\Model\Authorizenet; class Debug extends \Magento\Core\Model\AbstractModel { protected function _construct() { - $this->_init('Magento\Paygate\Model\Resource\Authorizenet\Debug'); + $this->_init('Magento\Authorizenet\Model\Resource\Authorizenet\Debug'); } } diff --git a/app/code/Magento/Paygate/Model/Authorizenet/Request.php b/app/code/Magento/Authorizenet/Model/Authorizenet/Request.php similarity index 91% rename from app/code/Magento/Paygate/Model/Authorizenet/Request.php rename to app/code/Magento/Authorizenet/Model/Authorizenet/Request.php index b9bdc4d4920..a0614c0063e 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet/Request.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet/Request.php @@ -19,13 +19,13 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Paygate\Model\Authorizenet; +namespace Magento\Authorizenet\Model\Authorizenet; class Request extends \Magento\Object { diff --git a/app/code/Magento/Paygate/Model/Authorizenet/Result.php b/app/code/Magento/Authorizenet/Model/Authorizenet/Result.php similarity index 91% rename from app/code/Magento/Paygate/Model/Authorizenet/Result.php rename to app/code/Magento/Authorizenet/Model/Authorizenet/Result.php index 4965c5f3f84..d9d078d83e6 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet/Result.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet/Result.php @@ -19,13 +19,13 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Paygate\Model\Authorizenet; +namespace Magento\Authorizenet\Model\Authorizenet; class Result extends \Magento\Object { diff --git a/app/code/Magento/Paygate/Model/Authorizenet/Source/Cctype.php b/app/code/Magento/Authorizenet/Model/Authorizenet/Source/Cctype.php similarity index 90% rename from app/code/Magento/Paygate/Model/Authorizenet/Source/Cctype.php rename to app/code/Magento/Authorizenet/Model/Authorizenet/Source/Cctype.php index c5b47542183..07fee5595a2 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet/Source/Cctype.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet/Source/Cctype.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,10 +28,10 @@ * Authorizenet Payment CC Types Source Model * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Paygate\Model\Authorizenet\Source; +namespace Magento\Authorizenet\Model\Authorizenet\Source; class Cctype extends \Magento\Payment\Model\Source\Cctype { diff --git a/app/code/Magento/Paygate/Model/Authorizenet/Source/PaymentAction.php b/app/code/Magento/Authorizenet/Model/Authorizenet/Source/PaymentAction.php similarity index 83% rename from app/code/Magento/Paygate/Model/Authorizenet/Source/PaymentAction.php rename to app/code/Magento/Authorizenet/Model/Authorizenet/Source/PaymentAction.php index bd4815d608b..51a577d745f 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet/Source/PaymentAction.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet/Source/PaymentAction.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -30,7 +30,7 @@ * * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Paygate\Model\Authorizenet\Source; +namespace Magento\Authorizenet\Model\Authorizenet\Source; class PaymentAction implements \Magento\Core\Model\Option\ArrayInterface { @@ -38,11 +38,11 @@ class PaymentAction implements \Magento\Core\Model\Option\ArrayInterface { return array( array( - 'value' => \Magento\Paygate\Model\Authorizenet::ACTION_AUTHORIZE, + 'value' => \Magento\Authorizenet\Model\Authorizenet::ACTION_AUTHORIZE, 'label' => __('Authorize Only') ), array( - 'value' => \Magento\Paygate\Model\Authorizenet::ACTION_AUTHORIZE_CAPTURE, + 'value' => \Magento\Authorizenet\Model\Authorizenet::ACTION_AUTHORIZE_CAPTURE, 'label' => __('Authorize and Capture') ), ); diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index c92fc25c03d..9cc9f9b879c 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -27,7 +27,7 @@ */ namespace Magento\Authorizenet\Model; -class Directpost extends \Magento\Paygate\Model\Authorizenet +class Directpost extends \Magento\Authorizenet\Model\Authorizenet { protected $_code = 'authorizenet_directpost'; protected $_formBlockType = 'Magento\Authorizenet\Block\Directpost\Form'; @@ -63,6 +63,11 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet */ protected $_response; + /** + * @var \Magento\Authorizenet\Helper\HelperInterface + */ + protected $_helper; + /** * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData @@ -72,16 +77,17 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService - * @param \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory - * @param \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory - * @param \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory + * @param \Magento\Authorizenet\Model\Authorizenet\CardsFactory $cardsFactory + * @param \Magento\Authorizenet\Model\Authorizenet\RequestFactory $requestFactory + * @param \Magento\Authorizenet\Model\Authorizenet\ResultFactory $resultFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Session\SessionManagerInterface $session - * @param \Magento\Paygate\Helper\Data $paygateData + * @param \Magento\Authorizenet\Helper\Data $authorizenetData * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Authorizenet\Model\Directpost\RequestFactory $directRequestFactory * @param \Magento\Authorizenet\Model\Directpost\Response $response + * @param \Magento\Authorizenet\Helper\HelperInterface $helper * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -95,16 +101,17 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, - \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory, - \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory, - \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory, + \Magento\Authorizenet\Model\Authorizenet\CardsFactory $cardsFactory, + \Magento\Authorizenet\Model\Authorizenet\RequestFactory $requestFactory, + \Magento\Authorizenet\Model\Authorizenet\ResultFactory $resultFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Session\SessionManagerInterface $session, - \Magento\Paygate\Helper\Data $paygateData, + \Magento\Authorizenet\Helper\Data $authorizenetData, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Authorizenet\Model\Directpost\RequestFactory $directRequestFactory, \Magento\Authorizenet\Model\Directpost\Response $response, + \Magento\Authorizenet\Helper\HelperInterface $helper, array $data = array() ) { parent::__construct( @@ -121,13 +128,14 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet $resultFactory, $orderFactory, $session, - $paygateData, + $authorizenetData, $data ); $this->_storeManager = $storeManager; $this->_quoteFactory = $quoteFactory; $this->_requestFactory = $directRequestFactory; $this->_response = $response; + $this->_helper = $helper; } /** @@ -145,7 +153,7 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet * * @param \Magento\Object $payment * @param decimal $amount - * @return \Magento\Paygate\Model\Authorizenet + * @return \Magento\Authorizenet\Model\Authorizenet * @throws \Magento\Core\Exception */ public function authorize(\Magento\Object $payment, $amount) @@ -374,8 +382,7 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet if ($storeId == null && $this->getStore()) { $storeId = $this->getStore(); } - return $this->_storeManager->getStore($storeId)->getBaseUrl(\Magento\Core\Model\Store::URL_TYPE_LINK) - . 'authorizenet/directpost_payment/response'; + return $this->_helper->getRelyUrl($storeId); } /** diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Observer.php b/app/code/Magento/Authorizenet/Model/Directpost/Observer.php index 3933a7ce580..bbad9a3f84f 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost/Observer.php +++ b/app/code/Magento/Authorizenet/Model/Directpost/Observer.php @@ -135,11 +135,11 @@ class Observer //if success, then set order to session and add new fields $this->_session->addCheckoutOrderIncrementId($order->getIncrementId()); $this->_session->setLastOrderIncrementId($order->getIncrementId()); - $requestToPaygate = $payment->getMethodInstance()->generateRequestFromOrder($order); - $requestToPaygate->setControllerActionName($request->getControllerName()); - $requestToPaygate->setIsSecure((string)$this->_storeManager->getStore()->isCurrentlySecure()); + $requestToAuthorizenet = $payment->getMethodInstance()->generateRequestFromOrder($order); + $requestToAuthorizenet->setControllerActionName($request->getControllerName()); + $requestToAuthorizenet->setIsSecure((string)$this->_storeManager->getStore()->isCurrentlySecure()); - $result['directpost'] = array('fields' => $requestToPaygate->getData()); + $result['directpost'] = array('fields' => $requestToAuthorizenet->getData()); $response->clearHeader('Location'); $response->setBody($this->_coreData->jsonEncode($result)); diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Request.php b/app/code/Magento/Authorizenet/Model/Directpost/Request.php index 96a3ffc4fe8..b05a22f85c2 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost/Request.php +++ b/app/code/Magento/Authorizenet/Model/Directpost/Request.php @@ -84,7 +84,7 @@ class Request extends \Magento\Object } /** - * Set paygate data to request. + * Set authorizenet data to request. * * @param \Magento\Authorizenet\Model\Directpost $paymentMethod * @return \Magento\Authorizenet\Model\Directpost\Request @@ -99,7 +99,7 @@ class Request extends \Magento\Object $this->setXLogin($paymentMethod->getConfigData('login')) ->setXType('AUTH_ONLY') - ->setXMethod(\Magento\Paygate\Model\Authorizenet::REQUEST_METHOD_CC) + ->setXMethod(\Magento\Authorizenet\Model\Authorizenet::REQUEST_METHOD_CC) ->setXRelayUrl($paymentMethod->getRelayUrl()); $this->_setTransactionKey($paymentMethod->getConfigData('trans_key')); diff --git a/app/code/Magento/Paygate/Model/Resource/Authorizenet/Debug.php b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php similarity index 86% rename from app/code/Magento/Paygate/Model/Resource/Authorizenet/Debug.php rename to app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php index ef1dd33e903..74859b1d65a 100644 --- a/app/code/Magento/Paygate/Model/Resource/Authorizenet/Debug.php +++ b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Resource authorizenet debug model * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Paygate\Model\Resource\Authorizenet; +namespace Magento\Authorizenet\Model\Resource\Authorizenet; class Debug extends \Magento\Core\Model\Resource\Db\AbstractDb { @@ -42,6 +42,6 @@ class Debug extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected function _construct() { - $this->_init('paygate_authorizenet_debug', 'debug_id'); + $this->_init('authorizenet_debug', 'debug_id'); } } diff --git a/app/code/Magento/Paygate/Model/Resource/Authorizenet/Debug/Collection.php b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php similarity index 80% rename from app/code/Magento/Paygate/Model/Resource/Authorizenet/Debug/Collection.php rename to app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php index 314ea1ea16f..4fe8b9a13ae 100644 --- a/app/code/Magento/Paygate/Model/Resource/Authorizenet/Debug/Collection.php +++ b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,10 +29,10 @@ * Resource authorizenet debug collection model * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Paygate\Model\Resource\Authorizenet\Debug; +namespace Magento\Authorizenet\Model\Resource\Authorizenet\Debug; class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection { @@ -42,6 +42,9 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ protected function _construct() { - $this->_init('Magento\Paygate\Model\Authorizenet\Debug', 'Magento\Paygate\Model\Resource\Authorizenet\Debug'); + $this->_init( + 'Magento\Authorizenet\Model\Authorizenet\Debug', + 'Magento\Authorizenet\Model\Resource\Authorizenet\Debug' + ); } } diff --git a/app/code/Magento/Authorizenet/etc/adminhtml/di.xml b/app/code/Magento/Authorizenet/etc/adminhtml/di.xml index 086851f3e2f..141029ad7cd 100644 --- a/app/code/Magento/Authorizenet/etc/adminhtml/di.xml +++ b/app/code/Magento/Authorizenet/etc/adminhtml/di.xml @@ -35,4 +35,9 @@ <instance type="Magento\Backend\Model\Session\Quote" /> </param> </type> + <type name="Magento\Authorizenet\Model\Authorizenet"> + <param name="session"> + <instance type="Magento\Backend\Model\Session\Quote" /> + </param> + </type> </config> diff --git a/app/code/Magento/Authorizenet/etc/adminhtml/system.xml b/app/code/Magento/Authorizenet/etc/adminhtml/system.xml index ba782007e3e..a32dd7a97ce 100644 --- a/app/code/Magento/Authorizenet/etc/adminhtml/system.xml +++ b/app/code/Magento/Authorizenet/etc/adminhtml/system.xml @@ -28,6 +28,112 @@ <config> <system> <section id="payment"> + <group id="authorizenet" translate="label" type="text" sortOrder="34" showInDefault="1" showInWebsite="1" showInStore="1"> + <label>Authorize.net</label> + <comment> + <![CDATA[<a href="http://celinks.magento.com/authorize_netRegistration" target="_blank">Click here to sign up for an Authorize.net account</a>]]> + </comment> + <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Enabled</label> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + </field> + <field id="cctypes" translate="label" type="multiselect" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Credit Card Types</label> + <source_model>Magento\Authorizenet\Model\Authorizenet\Source\Cctype</source_model> + </field> + <field id="useccv" translate="label" type="select" sortOrder="16" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Credit Card Verification</label> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + </field> + <field id="email_customer" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Email Customer</label> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + </field> + <field id="login" translate="label" type="obscure" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>API Login ID</label> + <backend_model>Magento\Backend\Model\Config\Backend\Encrypted</backend_model> + </field> + <field id="merchant_email" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Merchant's Email</label> + <validate>validate-email</validate> + </field> + <field id="order_status" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>New Order Status</label> + <source_model>Magento\Sales\Model\Config\Source\Order\Status\Processing</source_model> + </field> + <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Sort Order</label> + </field> + <field id="test" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Test Mode</label> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + </field> + <field id="debug" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Debug</label> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + </field> + <field id="title" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> + <label>Title</label> + </field> + <field id="trans_key" translate="label" type="obscure" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Transaction Key</label> + <backend_model>Magento\Backend\Model\Config\Backend\Encrypted</backend_model> + </field> + <field id="payment_action" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Payment Action</label> + <source_model>Magento\Authorizenet\Model\Authorizenet\Source\PaymentAction</source_model> + </field> + <field id="cgi_url" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Gateway URL</label> + </field> + <field id="currency" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Accepted Currency</label> + <source_model>Magento\Backend\Model\Config\Source\Currency</source_model> + </field> + <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Payment from Applicable Countries</label> + <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> + </field> + <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Payment from Specific Countries</label> + <source_model>Magento\Directory\Model\Config\Source\Country</source_model> + </field> + <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Minimum Order Total</label> + </field> + <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Maximum Order Total</label> + </field> + <field id="allow_partial_authorization" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0"> + <label>Allow Partial Authorization</label> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + </field> + <field id="heading_3dsecure" translate="label" sortOrder="120" showInDefault="1" showInWebsite="1"> + <label>3D Secure</label> + <frontend_model>Magento\Backend\Block\System\Config\Form\Field\Heading</frontend_model> + </field> + <field id="centinel" translate="label" type="select" sortOrder="125" showInDefault="1" showInWebsite="1"> + <label>3D Secure Card Validation</label> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + </field> + <field id="centinel_is_mode_strict" translate="label comment" type="select" sortOrder="130" showInDefault="1" showInWebsite="1"> + <label>Severe 3D Secure Card Validation</label> + <comment>Severe Validation Removes Chargeback Liability on Merchant</comment> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + <depends> + <field id="centinel">1</field> + </depends> + </field> + <field id="centinel_api_url" translate="label comment" type="text" sortOrder="135" showInDefault="1" showInWebsite="1"> + <label>Centinel API URL</label> + <comment>If you leave this empty, we'll use a default value. The custom URL may be provided by CardinalCommerce agreement.</comment> + <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> + <depends> + <field id="centinel">1</field> + </depends> + </field> + <field id="model"></field> + </group> <group id="authorizenet_directpost" translate="label" type="text" sortOrder="34" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Authorize.net Direct Post</label> <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> @@ -36,7 +142,7 @@ </field> <field id="payment_action" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Payment Action</label> - <source_model>Magento\Paygate\Model\Authorizenet\Source\PaymentAction</source_model> + <source_model>Magento\Authorizenet\Model\Authorizenet\Source\PaymentAction</source_model> </field> <field id="title" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Title</label> @@ -82,7 +188,7 @@ </field> <field id="cctypes" translate="label" type="multiselect" sortOrder="140" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Credit Card Types</label> - <source_model>Magento\Paygate\Model\Authorizenet\Source\Cctype</source_model> + <source_model>Magento\Authorizenet\Model\Authorizenet\Source\Cctype</source_model> </field> <field id="useccv" translate="label" type="select" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0"> <label>Credit Card Verification</label> diff --git a/app/code/Magento/Authorizenet/etc/config.xml b/app/code/Magento/Authorizenet/etc/config.xml index def38c0c098..22052ced24c 100644 --- a/app/code/Magento/Authorizenet/etc/config.xml +++ b/app/code/Magento/Authorizenet/etc/config.xml @@ -28,6 +28,24 @@ <config> <default> <payment> + <authorizenet> + <active>0</active> + <cctypes>AE,VI,MC,DI</cctypes> + <cgi_url>https://secure.authorize.net/gateway/transact.dll</cgi_url> + <debug>0</debug> + <email_customer>0</email_customer> + <login backend_model="Magento\Backend\Model\Config\Backend\Encrypted" /> + <merchant_email /> + <model>Magento\Authorizenet\Model\Authorizenet</model> + <order_status>processing</order_status> + <payment_action>authorize</payment_action> + <test>1</test> + <title>Credit Card (Authorize.net)</title> + <trans_key backend_model="Magento\Backend\Model\Config\Backend\Encrypted" /> + <allowspecific>0</allowspecific> + <currency>USD</currency> + <partial_authorization_checksum_checking>1</partial_authorization_checksum_checking> + </authorizenet> <authorizenet_directpost> <active>0</active> <cctypes>AE,VI,MC,DI</cctypes> diff --git a/app/code/Magento/Authorizenet/etc/frontend/di.xml b/app/code/Magento/Authorizenet/etc/frontend/di.xml index e1e10c10824..1d95c6e9a7c 100644 --- a/app/code/Magento/Authorizenet/etc/frontend/di.xml +++ b/app/code/Magento/Authorizenet/etc/frontend/di.xml @@ -35,4 +35,16 @@ <instance type="Magento\Checkout\Model\Session" /> </param> </type> + <type name="Magento\Core\Model\Url\SecurityInfo"> + <param name="secureUrlList"> + <value> + <authorizenet>/authorizenet/payment</authorizenet> + </value> + </param> + </type> + <type name="Magento\Authorizenet\Model\Authorizenet"> + <param name="session"> + <instance type="Magento\Checkout\Model\Session" /> + </param> + </type> </config> diff --git a/app/code/Magento/Authorizenet/etc/module.xml b/app/code/Magento/Authorizenet/etc/module.xml index 334d684477e..234b9d91e63 100755 --- a/app/code/Magento/Authorizenet/etc/module.xml +++ b/app/code/Magento/Authorizenet/etc/module.xml @@ -26,12 +26,10 @@ <config> <module name="Magento_Authorizenet" version="1.5.0.0" active="true"> <sequence> - <module name="Magento_Paygate"/> <module name="Magento_Sales"/> <module name="Magento_Checkout"/> </sequence> <depends> - <module name="Magento_Paygate"/> <module name="Magento_Sales"/> <module name="Magento_Checkout"/> <module name="Magento_Backend"/> @@ -39,6 +37,7 @@ <module name="Magento_Payment"/> <module name="Magento_Theme"/> <module name="Magento_Centinel"/> + <module name="Magento_Catalog"/> </depends> </module> </config> diff --git a/app/code/Magento/Authorizenet/i18n/de_DE.csv b/app/code/Magento/Authorizenet/i18n/de_DE.csv index 6bbba3e22c7..67ff79e8b55 100644 --- a/app/code/Magento/Authorizenet/i18n/de_DE.csv +++ b/app/code/Magento/Authorizenet/i18n/de_DE.csv @@ -1,40 +1,100 @@ "--Please Select--","--Bitte wählen--" +"3D Secure","3D Secure" +"3D Secure Card Validation","3D Secure-Kartenbestätigung" "API Login ID","API Login ID" +"API Login ID","API Login-ID" "Accepted Currency","Akzeptierte Währung" +"Allow Partial Authorization","Teilweise Autorisierung erlauben" +"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Sind Sie sicher, dass Sie die Zahlung abbrechen möchten? Klicken Sie auf OK, um Ihre Zahlung abzubrechen und den Betrag wieder frei verfügbar zu machen. Klicken Sie auf Abbrechen, um eine andere Kreditkarte anzugeben und mit der Zahlung fortzufahren." +"Authorize Only","Nur genehmigen" +"Authorize and Capture","Genehmigen und erfassen" +"Authorize.Net Transaction ID %s","Authorize.Net Transaktions-ID %s" +"Authorize.net","Genehmigen.net" "Authorize.net Direct Post","Authorize.net Direktpost" +"Cancel","Abbrechen" "Card Verification Number","Kreditkartenprüfnummer" "Card Verification Number Visual Reference","Kartenprüfnummer Sichtmerkmale" +"Centinel API URL","Centinel API-URL" "Close","Schließen" "Credit Card Information","Kreditkarteninformationen" "Credit Card Number","Kreditkartennummer" "Credit Card Type","Kreditkartentyp" "Credit Card Types","Kreditkartentypen" +"Credit Card Types","Arten von Kreditkarten" "Credit Card Verification","Kreditkarten-Verifizierung" +"Credit Card Verification","Überprüfung der Kreditkarte" +"Credit Card: xxxx-%s","Kreditkarte: xxxx-%s" +"Debug","Debug" "Debug","Fehlerbeseitigung" "Email Customer","Kunden-Email" +"Email Customer","Kunden E-Mail" "Enabled","Aktiviert" +"Error in payment gateway.","Fehler beim Payment Gateway." "Expiration Date","Ablaufdatum" "Gateway URL","Gateway URL" +"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Gateway-Aktionen wurden gesperrt, weil der Gateway eine oder mehrere Transaktionen nicht verarbeiten konnte. Bitte loggen Sie sich in Ihren Authorize.Net-Account ein, um dieses Problem manuell zu beheben." +"Gateway error: %s","Fehler des Gateway: %s" +"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Es wird ein Standardwert verwendet, falls das Feld freigelassen wird. Eine benutzerdefinierte URL darf nach der CardinalCommerce-Vereinbarung angegeben werden." +"Invalid amount for authorization.","Ungültiger Betrag um genehmigt zu werden." +"Invalid amount for capture.","Ungültiger Betrag für die Erfassung." +"Invalid amount for partial authorization.","Ungültiger Betrag für die teilweise Autorisierung." +"Invalid amount for refund.","Ungültiger Betrag für eine Rückerstattung." +"Invalid split tenderId ID.","Ungültige gespaltene Angebotsidentität" "Maximum Order Total","Maximale Bestellung Total" +"Maximum Order Total","Höchstsumme der Bestellung" "Merchant MD5","Händler MD5" "Merchant's Email","Händler-Email" +"Merchant's Email","E-Mail des Händlers" +"Minimum Order Total","Mindestsumme der Bestellung" "Minimum Order Total","Minimale Bestellung Total" +"New Order Status","Stand der neuen Bestellung" "New Order Status","Neuer Bestellstatus" "Order saving error: %s","Fehler beim Speichern der Order:" "Payment Action","Zahlungsaktion" +"Payment Action","Zahlungsvorgang" "Payment authorization error.","Fehler bei der Zahlungsermächtigung." "Payment authorization error. Transacion id is empty.","Fehler bei der Zahlungsbestätigung. Transaktions-ID ist leer." +"Payment canceling error.","Fehler bei Zahlungsabbruch." +"Payment capturing error.","Fehler bei Zahlungserfassung." "Payment error. Order was not found.","Zahlungsfehler. Bestellung konnte nicht gefunden werden." "Payment error. Paid amount doesn\'t match the order amount.","Zahlungsfehler. Gezahlter Betrag entspricht nicht dem Rechnungsbetrag." +"Payment from Applicable Countries","Bezahlung aus den entsprechenden Ländern" "Payment from Applicable Countries","Zahlung aus geeigneten Ländern" "Payment from Specific Countries","Zahlung aus spezifischen Ländern" +"Payment from Specific Countries","Bezahlung aus bestimmten Ländern" +"Payment partial authorization error.","Fehler bei teilweiser Autorisierung." +"Payment refunding error.","Fehler bei der Rückerstattung." +"Payment updating error.","Fehler beim Zahlungsupdate." +"Payment voiding error.","Fehler beim Stornieren der Zahlung." "Please, choose payment method","Bitte wählen Sie die Zahlungsmethode" +"Processed Amount","Bearbeiteter Betrag" +"Remaining Balance","Verbleibender Betrag" "Response hash validation failed. Transaction declined.","Überprüfung der Zahlungsfähigkeit fehlgeschlagen. Transaktion abgelehnt." +"Severe 3D Secure Card Validation","Strenge Absicherung der 3D geschützten Karte" +"Severe Validation Removes Chargeback Liability on Merchant","Die bestehende strenge Absicherung entzieht den Verkäufer der Verbindlichkeit Ausgleichsbuchungen nachkommen zu müssen" +"Shopping cart contents and/or address has been changed.","Artikel im Einkaufswagen und/oder die Adresse wurden geändert." +"Sort Order","Sortierreihenfolge" "Sort Order","Sortierfolge" "Test Mode","Testmodus" +"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","Der Betrag auf Ihrer Kreditkarte reicht nicht aus, um den Kauf durchzuführen. Auf den verfügbaren Betrag kann nicht zugegriffen werden. Um den Kauf durchzuführen, klicken Sie bitte auf OK und geben Sie eine weitere Kreditkartennummer an. Um den Kauf abzubrechen und auf den Betrag wieder zugreifen zu können, klicken Sie bitte auf Abbrechen." "The order has been created.","Die Bestellung wurde aufgenommen." +"There was an error canceling transactions. Please contact us or try again later.","Es ist ein Fehler beim Abbruch der Transaktion aufgetreten. Bitte kontaktieren Sie uns oder probieren Sie es später noch einmal." "There was an error processing your order. Please contact us or try again later.","Bei der Bearbeitung Ihrer Bestellung ist ein Fehler aufgetreten. Bitte kontaktieren Sie uns oder versuchen Sie es später noch einmal." "Title","Titel" "Transaction Key","Transaktionsschlüssel" +"Transaction Key","Transaction key" "What is this?","Was ist das?" +"You have reached the maximum number of credit card allowed to be used for the payment.","Sie haben die maximale Anzahl an Kreditkarten erreicht, die Sie für die Bezahlung verwenden dürfen." +"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Sie haben die maximale Anzahl an Kreditkarten erreicht, die Sie für eine Bezahlung verwenden dürfen. Die verfügbaren Beträge auf allen verwendeten Karten reichten nicht aus, um die Bezahlung abschließen zu können. Der Zahlungsprozess wurde abgebrochen und die Beträge sind wieder frei verfügbar." "You will be required to enter your payment details before you place an order.","Bevor Sie eine Bestellung aufgeben können, müssen Sie Ihre Zahlungsdetails angeben." +"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Ihre Kredtikarte wurde abgelehnt. Klicken Sie OK, um eine andere Kreditkarte anzugeben, damit Sie den Zahlungsvorgang abschließen können. Klicken Sie auf Abbrechen, um den verwendeten Betrag wieder verfügbar zu machen und eine andere Zahlungsmethode auszuwählen." +"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Ihre Bestellung wurde nicht aufgegeben, weil Artikel in Ihrem Einkaufswagen und/oder die Adresse geändert wurden. Bereits autorisierte, ausstehende Beträge von Ihrer vorherigen Zahlung sind wieder frei verfügbar. Bitte führen Sie den Zahlungsvorgang noch einmal durch, um Ihre neu hinzugekommenen Artikel zu erfassen." +"Your payment has been cancelled. All authorized amounts have been released.","Ihre Zahlung wurde abgebrochen. Alle autorisierten Beträge sind wieder frei verfügbar." +"amount %s","Betrag %s" +"authorize","Autorisieren" +"authorize and capture","Autorisieren und Erfassen" +"capture","Erfassen" +"failed","fehlgeschlagen" +"refund","Rückerstattung" +"successful","erfolgreich" +"void","ungültig" diff --git a/app/code/Magento/Authorizenet/i18n/en_US.csv b/app/code/Magento/Authorizenet/i18n/en_US.csv index 51350e2a241..a9125d4bedd 100644 --- a/app/code/Magento/Authorizenet/i18n/en_US.csv +++ b/app/code/Magento/Authorizenet/i18n/en_US.csv @@ -1,20 +1,40 @@ "--Please Select--","--Please Select--" +"3D Secure","3D Secure" +"3D Secure Card Validation","3D Secure Card Validation" "API Login ID","API Login ID" "Accepted Currency","Accepted Currency" +"Allow Partial Authorization","Allow Partial Authorization" +"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment." +"Authorize Only","Authorize Only" +"Authorize and Capture","Authorize and Capture" +"Authorize.Net Transaction ID %s","Authorize.Net Transaction ID %s" +"Authorize.net","Authorize.net" "Authorize.net Direct Post","Authorize.net Direct Post" +"Cancel","Cancel" "Card Verification Number","Card Verification Number" "Card Verification Number Visual Reference","Card Verification Number Visual Reference" +"Centinel API URL","Centinel API URL" "Close","Close" "Credit Card Information","Credit Card Information" "Credit Card Number","Credit Card Number" "Credit Card Type","Credit Card Type" "Credit Card Types","Credit Card Types" "Credit Card Verification","Credit Card Verification" +"Credit Card: xxxx-%s","Credit Card: xxxx-%s" "Debug","Debug" "Email Customer","Email Customer" "Enabled","Enabled" +"Error in payment gateway.","Error in payment gateway." "Expiration Date","Expiration Date" "Gateway URL","Gateway URL" +"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s)." +"Gateway error: %s","Gateway error: %s" +"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement." +"Invalid amount for authorization.","Invalid amount for authorization." +"Invalid amount for capture.","Invalid amount for capture." +"Invalid amount for partial authorization.","Invalid amount for partial authorization." +"Invalid amount for refund.","Invalid amount for refund." +"Invalid split tenderId ID.","Invalid split tenderId ID." "Maximum Order Total","Maximum Order Total" "Merchant MD5","Merchant MD5" "Merchant's Email","Merchant's Email" @@ -24,17 +44,43 @@ "Payment Action","Payment Action" "Payment authorization error.","Payment authorization error." "Payment authorization error. Transacion id is empty.","Payment authorization error. Transacion id is empty." +"Payment canceling error.","Payment canceling error." +"Payment capturing error.","Payment capturing error." "Payment error. Order was not found.","Payment error. Order was not found." "Payment error. Paid amount doesn\'t match the order amount.","Payment error. Paid amount doesn\'t match the order amount." "Payment from Applicable Countries","Payment from Applicable Countries" "Payment from Specific Countries","Payment from Specific Countries" +"Payment partial authorization error.","Payment partial authorization error." +"Payment refunding error.","Payment refunding error." +"Payment updating error.","Payment updating error." +"Payment voiding error.","Payment voiding error." "Please, choose payment method","Please, choose payment method" +"Processed Amount","Processed Amount" +"Remaining Balance","Remaining Balance" "Response hash validation failed. Transaction declined.","Response hash validation failed. Transaction declined." +"Severe 3D Secure Card Validation","Severe 3D Secure Card Validation" +"Severe Validation Removes Chargeback Liability on Merchant","Severe Validation Removes Chargeback Liability on Merchant" +"Shopping cart contents and/or address has been changed.","Shopping cart contents and/or address has been changed." "Sort Order","Sort Order" "Test Mode","Test Mode" +"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel." "The order has been created.","The order has been created." +"There was an error canceling transactions. Please contact us or try again later.","There was an error canceling transactions. Please contact us or try again later." "There was an error processing your order. Please contact us or try again later.","There was an error processing your order. Please contact us or try again later." "Title","Title" "Transaction Key","Transaction Key" "What is this?","What is this?" +"You have reached the maximum number of credit card allowed to be used for the payment.","You have reached the maximum number of credit card allowed to be used for the payment." +"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released." "You will be required to enter your payment details before you place an order.","You will be required to enter your payment details before you place an order." +"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method." +"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents." +"Your payment has been cancelled. All authorized amounts have been released.","Your payment has been cancelled. All authorized amounts have been released." +"amount %s","amount %s" +"authorize","authorize" +"authorize and capture","authorize and capture" +"capture","capture" +"failed","failed" +"refund","refund" +"successful","successful" +"void","void" diff --git a/app/code/Magento/Authorizenet/i18n/es_ES.csv b/app/code/Magento/Authorizenet/i18n/es_ES.csv index 0a043dd9693..efd2121126e 100644 --- a/app/code/Magento/Authorizenet/i18n/es_ES.csv +++ b/app/code/Magento/Authorizenet/i18n/es_ES.csv @@ -1,40 +1,99 @@ "--Please Select--","--Por favor, seleccione-" +"3D Secure","3D Secure" +"3D Secure Card Validation","Validación de Tarjeta 3D Secure" +"API Login ID","ID de inicio de sesión en API" "API Login ID","Id. de inicio de sesión de API" +"Accepted Currency","Moneda aceptada" "Accepted Currency","Moneda Aceptada" +"Allow Partial Authorization","Permitir Autorización Parcial" +"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","¿Está seguro de que desea cancelar su pago? Pinche en Aceptar para cancelar el pago y liberar la cantidad retenida. Pinche en ""Cancelar"" para introducir otra tarjeta de crédito y continuar con su pago." +"Authorize Only","Sólo autorizar" +"Authorize and Capture","Autorizar y capturar" +"Authorize.Net Transaction ID %s","Identificación de la Transacción %s Authorize.Net" +"Authorize.net","Authorize.net" "Authorize.net Direct Post","Enlace directo a authorize.net" +"Cancel","Cancelar" "Card Verification Number","Número de Verificación de Tarjeta" "Card Verification Number Visual Reference","Referencia visual del número de verificación de tarjeta" +"Centinel API URL","Centinel API URL" "Close","Cerrar" "Credit Card Information","Información de la tarjeta de crédito" "Credit Card Number","Número de Tarjeta de Crédito" "Credit Card Type","Tipo de Tarjeta de Crédito" "Credit Card Types","Tipos de Tarjeta de Crédito" +"Credit Card Types","Tipos de tarjeta de crédito" "Credit Card Verification","Verificación de Tarjeta de Crédito" +"Credit Card Verification","Verificación de tarjeta de crédito" +"Credit Card: xxxx-%s","Tarjeta de Crédito: xxxx-%s" "Debug","Depurar" "Email Customer","Cliente de correo" +"Email Customer","Enviar mensaje de correo electrónico al cliente" "Enabled","Habilitado" +"Error in payment gateway.","Error en el proceso de pago." "Expiration Date","Fecha de Caducidad" "Gateway URL","URL de la puerta de enlace" +"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Las acciones de Gateway se han bloqueadas ya que gateway no puede completar una o varias transacciones. Por favor, inicie sesión manualmente en su cuenta Authorize.Net para resolver el/los problema/s." +"Gateway error: %s","Error de proceso: %s" +"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Al dejarlo en blanco, se utilizará un valor por defecto. Se puede proporcionar un URL personalizado por el acuerdo CardinalCommerce." +"Invalid amount for authorization.","Monto no válido para la autorización." +"Invalid amount for capture.","Cantidad para retención no válida." +"Invalid amount for partial authorization.","Cantidad de autorización parcial no válida." +"Invalid amount for refund.","Cantidad de reembolso no válida." +"Invalid split tenderId ID.","La identificación tenderId no se puede separar." +"Maximum Order Total","Total máximo de pedido" "Maximum Order Total","Total del pedido máximo" "Merchant MD5","MD5 del comerciante" "Merchant's Email","Email del comerciante" +"Merchant's Email","Correo electrónico del vendedor" +"Minimum Order Total","Total mÃnimo de pedido" "Minimum Order Total","Total del pedido mÃnimo" "New Order Status","Estado de los nuevos pedidos" +"New Order Status","Nuevo estado de pedido" "Order saving error: %s","Error al guardar el pedido: %s" +"Payment Action","Acción de pago" "Payment Action","Acción de Pago" +"Payment authorization error.","Error de autorización de pago." "Payment authorization error.","Error en la autorización de pago." "Payment authorization error. Transacion id is empty.","Error de autorización del pago. El identificador de transacción está vacÃo." +"Payment canceling error.","Error en el pago de cancelación." +"Payment capturing error.","Error en el pago de retención." "Payment error. Order was not found.","Error de pago. No se encontró el pedido." "Payment error. Paid amount doesn\'t match the order amount.","Error de pago. El importe pagado no coincide con el importe del pedido." +"Payment from Applicable Countries","Pago desde paÃses aceptados" "Payment from Applicable Countries","Pago desde paÃses aplicables" "Payment from Specific Countries","Pago desde paÃses especÃficos" +"Payment partial authorization error.","Error en el pago parcial de la autorización." +"Payment refunding error.","Error en el pago de reembolso." +"Payment updating error.","Error de actualización del pago." +"Payment voiding error.","Error en la anulación del pago." "Please, choose payment method","Seleccione un método de pago" +"Processed Amount","Cantidad Procesada" +"Remaining Balance","Saldo Restante" "Response hash validation failed. Transaction declined.","Fallo de validación del hash de respuesta. Se rechazó la transacción." +"Severe 3D Secure Card Validation","Validación de Tarjeta Severe 3D Secure" +"Severe Validation Removes Chargeback Liability on Merchant","La Validación Severe Suprime la Responsabilidad de Cancelación de Cargo del Comerciante" +"Shopping cart contents and/or address has been changed.","El contenido de la cesta de compra y/o la dirección han cambiado." "Sort Order","Orden de selección" +"Sort Order","Ordenar Pedido" "Test Mode","Modo de prueba" +"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","No tiene suficiente dinero en su tarjeta de crédito para completar la compra. El dinero disponible ha sido retenido. Para completar la compra, pulse OK y especifique un número de tarjeta de crédito adicional. Para cancelar la compra y liberar el dinero retenido, pulse Cancelar." "The order has been created.","Se ha creado el pedido." +"There was an error canceling transactions. Please contact us or try again later.","Ha habido un error en la cancelación de las transacciones. Por favor, póngase en contacto con nosotros o inténtelo más tarde de nuevo." "There was an error processing your order. Please contact us or try again later.","Se produjo un error en el proceso de su pedido. Contacte con nosotros o inténtelo más tarde." "Title","TÃtulo" "Transaction Key","Clave de transacción" "What is this?","¿Qué es esto?" +"You have reached the maximum number of credit card allowed to be used for the payment.","Ha alcanzado el máximo permitido por su tarjeta de crédito para efectuar el pago." +"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Ha alcanzado el número máximo de tarjetas de crédito que se pueden usar para un solo pago. El dinero disponible en todas las tarjetas usadas era insuficiente para completar el pago. El pago se ha cancelado y el dinero retenido se ha liberado." "You will be required to enter your payment details before you place an order.","Se le solicitará que introduzca los detalles de pago antes de realizar un pedido." +"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Su tarjeta de crédito se ha rechazado. Pulse OK para especificar otra tarjeta de crédito para completar la compra. Pulse Cancelar para liberar el dinero retenido y seleccionar otra forma de pago." +"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Su orden no ha sido cursada, porque el contenido de la cesta de la compra y/o la dirección se han cambiado. El dinero autorizado en su pago previo, como adelanto, ahora lo tiene disponible. Por favor, revise el proceso de pago para su pedido reciente." +"Your payment has been cancelled. All authorized amounts have been released.","Su pago se ha cancelado. Dispone de todo el dinero que habÃa avanzado." +"amount %s","dinero %s" +"authorize","autorizar" +"authorize and capture","autorizar y capturar" +"capture","capturar" +"failed","error" +"refund","reembolso" +"successful","exitoso" +"void","vacÃo" diff --git a/app/code/Magento/Authorizenet/i18n/fr_FR.csv b/app/code/Magento/Authorizenet/i18n/fr_FR.csv index 4a92cad719a..f5d73e48bde 100644 --- a/app/code/Magento/Authorizenet/i18n/fr_FR.csv +++ b/app/code/Magento/Authorizenet/i18n/fr_FR.csv @@ -1,40 +1,100 @@ "--Please Select--","--Veuillez choisir--" +"3D Secure","Sécurité 3D" +"3D Secure Card Validation","Validation de carte sécurité 3D" +"API Login ID","Identifiant de l'API" "API Login ID","ID de connexion de l'API" +"Accepted Currency","Monnaie acceptée" "Accepted Currency","Devise acceptée" +"Allow Partial Authorization","Permettre autorisation partielle" +"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Etes-vous sûr de vouloir annuler votre paiement ? Cliquez sur OK pour annuler le paiement et débloquer le montant en attente. Cliquez sur Quitter pour entrer une autre carte bancaire et continuer le paiemetn." +"Authorize Only","Autoriser uniquement" +"Authorize and Capture","Autoriser et enregistrer" +"Authorize.Net Transaction ID %s","Identifiant de transaction %s Authorize.Net" +"Authorize.net","Authorize.net" "Authorize.net Direct Post","Enregistrement direct Authorize.net" +"Cancel","Annuler" "Card Verification Number","Numéro de vérification de la carte" "Card Verification Number Visual Reference","Référence visuelle du numéro de vérification de la carte" +"Centinel API URL","URP API Centinel" "Close","Fermer" "Credit Card Information","Renseignements sur la carte de crédit" "Credit Card Number","Numéro de carte de crédit" "Credit Card Type","Type de carte de crédit" "Credit Card Types","Types de cartes de crédit" "Credit Card Verification","Vérification de la carte de crédit" +"Credit Card: xxxx-%s","Carte de crédit : xxxx-%s" "Debug","Déboguer" +"Email Customer","Envoyer un email au client" "Email Customer","Envoyer un courriel au client" +"Enabled","Activé" "Enabled","Actif" +"Error in payment gateway.","Erreur dans le transfert du paiement." "Expiration Date","Date d'expiration" "Gateway URL","URL passerelle" +"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Les actions de passerelle sont verouillées car la passerelle ne peut pas compléter une ou plusieurs transactions. Veuillez vous connecter à Authorize.net pour résoudre manuellement le problème." +"Gateway error: %s","Erreur de la passerelle : %s" +"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Si vide, une valeur par défaut sera utilisée. Une URL personnalisée peut être fournie par CardinalCommerce." +"Invalid amount for authorization.","Montant invalide pour autorisation." +"Invalid amount for capture.","Montant invalide" +"Invalid amount for partial authorization.","Montant invalide pour l'autorisation partielle" +"Invalid amount for refund.","Montant invalide pour un remboursement" +"Invalid split tenderId ID.","Identifiant invalide" "Maximum Order Total","Total maximal de la commande" +"Maximum Order Total","Montant total maximum" "Merchant MD5","MD5 du commerçant" +"Merchant's Email","Email du marchand" "Merchant's Email","Courriel du commerçant" "Minimum Order Total","Total minimal de la commande" +"Minimum Order Total","Montant total minimum" +"New Order Status","Nouveau statut de la commande" "New Order Status","Nouveau statut commande" "Order saving error: %s","Erreur enregistrement commande : %s" "Payment Action","Action de paiement" +"Payment Action","Paiement" "Payment authorization error.","Erreur autorisation de paiement." +"Payment authorization error.","Erreur d'autorisation du paiement." "Payment authorization error. Transacion id is empty.","Erreur d'autorisation de paiement. L'id de transaction est vide." +"Payment canceling error.","Erreur dans l'annulation du paiement." +"Payment capturing error.","Erreur lors de la saisie du paiement" "Payment error. Order was not found.","Erreur de paiement. La commande n'a pas été trouvée." "Payment error. Paid amount doesn\'t match the order amount.","Erreur de paiement. Le montant payé ne correspond pas au montant de la commande." "Payment from Applicable Countries","Paiement depuis les pays applicables" +"Payment from Applicable Countries","Paiement depuis les pays disponibles." "Payment from Specific Countries","Paiement depuis les pays spécifiques" +"Payment partial authorization error.","Erreur de l'autorisation partielle du paiement" +"Payment refunding error.","Erreur de remboursement du paiement" +"Payment updating error.","Erreur lors de la mise à jour du paiement." +"Payment voiding error.","Erreur annulant le paiement" "Please, choose payment method","Veuillez choisir une méthode de paiement" +"Processed Amount","Montant réalisé" +"Remaining Balance","Balance restante" "Response hash validation failed. Transaction declined.","Réponse la validation de hachage a échoué. Transaction refusée." +"Severe 3D Secure Card Validation","Validation de carte sécurité 3D sévère" +"Severe Validation Removes Chargeback Liability on Merchant","Validation sévère supprime le risque de remboursement pour le vendeur" +"Shopping cart contents and/or address has been changed.","Le contenu du panier et/ou l'adresse ont été changés." +"Sort Order","Trier les widgets" "Sort Order","Trier la commande" "Test Mode","Mode test" +"Test Mode","Mode test." +"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","Le montant disponible sur votre carte de crédit est insuffisant pour pouvoir finaliser votre commande. Le montant disponible a été mis en attente. Pour finaliser votre commande, cliquez sur OK et indiquez le numéro d'une autre carte de crédit. Pour annuler la commande et débloquer le montant mis en attente, cliquez sur Annuler." "The order has been created.","La commande a été créée." +"There was an error canceling transactions. Please contact us or try again later.","Une erreur s'est produite lors de l'annulation de transactions. Veuillez nous contacter ou réessayer ultérieurement." "There was an error processing your order. Please contact us or try again later.","Il y a eu une erreur dans le traitement de votre commande. Veuillez nous contacter ou réessayez plus tard." "Title","Titre" +"Transaction Key","Clé de la transaction" "Transaction Key","Clé de transaction" "What is this?","Qu'est-ce que c'est ?" +"You have reached the maximum number of credit card allowed to be used for the payment.","Vous avez atteint le nombre maximum autorisé de cartes de crédit à utiliser pour le paiement." +"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Vous avez atteint le nombre maximum autorisé de cartes de crédits à utiliser pour un paiement. Les montants disponibles sur l'ensemble des cartes de crédit étaient insuffisants pour finaliser le paiement. Le paiement a été annulé et les montants mis en attente débloqués." "You will be required to enter your payment details before you place an order.","Il vous sera demandé de renseigner vos détails de paiement avant de passer une commande." +"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Votre carte de crédit a été refusée. Cliquez sur OK pour indiquer une autre carte de crédit pour finaliser votre paiement. Cliquez sur Annuler pour débloquer le montant mis attente et sélectionner un autre moyen de paiement." +"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Votre commande n'a pas été enregistrée car les contenus du panier et/ou de l'adresse ont été modifiés. Les montants autorisés en attente de votre paiement précédent sont désormais débloqués. Veuillez procéder au paiement pour les contenus de votre dernier panier." +"Your payment has been cancelled. All authorized amounts have been released.","Votre paiement a été annulé. Tous les montants autorisés ont été débloqués." +"amount %s","Montant %s" +"authorize","autoriser" +"authorize and capture","autoriser et saisir" +"capture","saisir" +"failed","échoué" +"refund","remboursement" +"successful","réussi" +"void","vide" diff --git a/app/code/Magento/Authorizenet/i18n/nl_NL.csv b/app/code/Magento/Authorizenet/i18n/nl_NL.csv index 9208f8eeac5..f0317f80d31 100644 --- a/app/code/Magento/Authorizenet/i18n/nl_NL.csv +++ b/app/code/Magento/Authorizenet/i18n/nl_NL.csv @@ -1,40 +1,101 @@ "--Please Select--","--selecteer a.u.b.--" +"3D Secure","3D Secure" +"3D Secure Card Validation","3D Secure Card Validation" +"API Login ID","API Login ID" "API Login ID","API login ID" +"Accepted Currency","Geaccepteerde munteenheid" "Accepted Currency","Geaccepteerde valuta" +"Allow Partial Authorization","Gedeeltelijke autorisatie toestaan" +"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Weet u zeker dat u uw betaling wilt annuleren? Klik op OK om uw betaling te annuleren en het geld vrij te geven. Klik op Cancel om een andere kredietkaart te gebruiken en verder te gaan met uw betaling." +"Authorize Only","Alleen authoriseren" +"Authorize and Capture","Authoriseren en opnemen" +"Authorize.Net Transaction ID %s","Authorize.Net Transactie ID %s" +"Authorize.net","Authorize.net" "Authorize.net Direct Post","Authorize.net directe post" +"Cancel","Annuleren" "Card Verification Number","Kaart verificatie nummer" "Card Verification Number Visual Reference","Kaart verificatie nummer visuele referentie" +"Centinel API URL","Centinel API URL" "Close","sluiten" "Credit Card Information","Creditcard informatie" "Credit Card Number","Creditcardnummer" "Credit Card Type","Creditcardtype" "Credit Card Types","Creditcardtypes" +"Credit Card Types","Types credit card" "Credit Card Verification","Creditcard verificatie" +"Credit Card Verification","Credit Card Verificatie" +"Credit Card: xxxx-%s","Kredietkaart: xxxx-%s" "Debug","Debug" "Email Customer","email klant" +"Email Customer","E-mail Klant" +"Enabled","Aan" "Enabled","Werkzaam gemaakt" +"Error in payment gateway.","Fout in betaling gateway." "Expiration Date","vervaldatum" "Gateway URL","Gateway URL" +"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Gateway acties zijn vergrendeld omdat de gateway een of meerdere transacties niet kan voltooien. Log alstublieft in op uw Authorize.Net account om zelf het problem/de problemen op te lossen." +"Gateway error: %s","Gateway fout: %s" +"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Indien leeg, een standaard waarde kan worden gebruikt. Een aangepaste URL kan worden geleverd volgens de CardinalCommerce overeenkomst" +"Invalid amount for authorization.","Ongeldig bedrag voor autorisatie." +"Invalid amount for capture.","Ongeldige aantal voor vangst." +"Invalid amount for partial authorization.","Ongeldig aantal voor gedeeltelijke autorisatie." +"Invalid amount for refund.","Ongeldige aantal voor teruggave." +"Invalid split tenderId ID.","Ongeldige split tenderld ID." "Maximum Order Total","Maximale bestellingstotalen" +"Maximum Order Total","Maximale Bestelling" "Merchant MD5","Verkoper MD5" "Merchant's Email","Verkoper's email" +"Merchant's Email","Verkopers e-mail" +"Minimum Order Total","Minimale Bestelling" "Minimum Order Total","Minimale bestellingstotalen" +"New Order Status","Nieuwe Status van de Bestelling" "New Order Status","Nieuwe bestellingsstatus" "Order saving error: %s","Bestelling opslaan fout: %s" +"Payment Action","Betaling" "Payment Action","Betalingsactie" +"Payment authorization error.","Fout bij autorisatie betaling." "Payment authorization error.","Betalingsautorisatie fout." "Payment authorization error. Transacion id is empty.","Betalings autorisatie fout. Transactie ID is leeg." +"Payment canceling error.","Probleem met het annuleren van de betaling." +"Payment capturing error.","Fout in het ophalen van de betaling." "Payment error. Order was not found.","Betalingsfout. Bestelling is niet gevonden." "Payment error. Paid amount doesn\'t match the order amount.","Betalingsfout. Betaalde bedrag is niet hetzelfde als bedrag van bestelling." "Payment from Applicable Countries","Betaling vanuit toegestane landen" +"Payment from Applicable Countries","Betaling van Geëigende Landen" +"Payment from Specific Countries","Betaling van Specifieke Landen" "Payment from Specific Countries","Betaling vanuit specifieke landen" +"Payment partial authorization error.","Fout in de gedeeltelijke autorisatie van de betaling." +"Payment refunding error.","Fout in het terugbetalen van de betaling." +"Payment updating error.","Fout bij het bijwerken van de betaling." +"Payment voiding error.","Fout in het vernietigen van de betaling." "Please, choose payment method","Kies a.u.b. de verzendmethode" +"Processed Amount","Verwerkte hoeveelheid" +"Remaining Balance","Resterend balans" "Response hash validation failed. Transaction declined.","Antwoord op hash validatie mislukt. Transactie geweigerd." +"Severe 3D Secure Card Validation","Strenge 3D Secure Card Validation" +"Severe Validation Removes Chargeback Liability on Merchant","Strenge validatie verwijdert terugboekingsaansprakelijkheid voor de handelaar" +"Shopping cart contents and/or address has been changed.","Winkel wagen inhoud en/of adres is gewijzigd." "Sort Order","Sorteer Bestelling" +"Test Mode","Test modus" "Test Mode","Testmode" +"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","U heeft onvoldoende tegoed op uw creditcard om de aankoop te voltooien. Het bedrag is vastgezet. Om de aankoop te voltooien, klik op OK en geef een extra creditcardnummer op. Om de aankoop te annuleren en het geld terug te zetten, klik op Cancel." "The order has been created.","De bestelling is aangemaakt" +"There was an error canceling transactions. Please contact us or try again later.","Er heeft zich een fout voorgedaan tijdens het annuleren van de transacties. Neem contact met ons op of probeer later." "There was an error processing your order. Please contact us or try again later.","Er is een fout opgetreden bij het verwerken van uw bestelling. Contacteer ons a.u.b. of probeert u het later nog eens." "Title","Titel" "Transaction Key","Transactiesleutel" "What is this?","Wat is dit?" +"You have reached the maximum number of credit card allowed to be used for the payment.","Het aantal toegestane creditcards voor deze betaling is bereikt." +"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Het aantal toegestane creditcards voor één betaling is bereikt. Het saldo is nog steeds onvoldoende om de betaling te voltooien. De betaling is geannuleerd en de vastgezette bedragen zijn vrijgegeven." "You will be required to enter your payment details before you place an order.","U zult uw betalingsgegevens moeten invullen alvorens u een bestelling kunt plaatsen." +"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Uw creditcard is geweigerd. Klik op OK om een andere creditcard te gebruiken voor uw betaling. Klik op Cancel om het bedrag vrij te geven en kies een andere betaalmethode." +"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Uw order kan niet worden geplaatst, omdat de inhoud van uw winkelwagentje en/of adres gewijzigd zijn. Geautoriseerde bedragen van uw vorige betaling zijn vrijgegeven. Ga naar het betalingsproces voor de inhoud van uw huidige winkelwagen." +"Your payment has been cancelled. All authorized amounts have been released.","Uw betaling is geannuleerd. Alle geautoriseerde bedragen zijn vrijgegeven." +"amount %s","bedrag %s" +"authorize","autoriseer" +"authorize and capture","autoriseer en vang" +"capture","vang" +"failed","mislukt" +"refund","teruggave" +"successful","succesvol" +"void","ongeldig" diff --git a/app/code/Magento/Authorizenet/i18n/pt_BR.csv b/app/code/Magento/Authorizenet/i18n/pt_BR.csv index 0871f517677..b659f4fb655 100644 --- a/app/code/Magento/Authorizenet/i18n/pt_BR.csv +++ b/app/code/Magento/Authorizenet/i18n/pt_BR.csv @@ -1,20 +1,40 @@ "--Please Select--","--Por Favor, Escolha--" +"3D Secure","3D Secure" +"3D Secure Card Validation","Validação de Cartão 3D Secure" "API Login ID","ID de Login API" "Accepted Currency","Moeda Aceita" +"Allow Partial Authorization","Permitir Autorização Parcial" +"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Tem certeza de que deseja cancelar o seu pagamento? Clique em OK para cancelar o seu pagamento e liberar o montante em espera. Clique em Cancelar para inserir outro cartão de crédito e continuar com o seu pagamento." +"Authorize Only","Somente Autorizar" +"Authorize and Capture","Autorizar e Controlar" +"Authorize.Net Transaction ID %s","ID Transação Authorize.Net %s" +"Authorize.net","Authorize.net" "Authorize.net Direct Post","Postagem Direta da Authorize.net" +"Cancel","Cancelar" "Card Verification Number","Número de Verificação do Cartão" "Card Verification Number Visual Reference","Referência Visual de Número de Verificação do Cartão" +"Centinel API URL","URL Centinel API" "Close","Fechar" "Credit Card Information","Informações do Cartão de Crédito" "Credit Card Number","Número do Cartão de Crédito" "Credit Card Type","Tipo de Cartão de Crédito" "Credit Card Types","Tipos de Cartão de Crédito" "Credit Card Verification","Verificação de Cartão de Crédito" +"Credit Card: xxxx-%s","Cartão de crédito: xxxx-%s" "Debug","Debug" "Email Customer","Enviar Email ao Cliente" "Enabled","Ativado" +"Error in payment gateway.","Erro no portal de pagamento." "Expiration Date","Data de Validade" "Gateway URL","URL do Gateway" +"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Ações de portal são bloqueadas porque o portal não consegue completar uma ou mais das transações. Por favor entre na sua conta Authorize.Net manualmente para resolver o(s) problema(s)." +"Gateway error: %s","Erro do portal: %s" +"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Se vazio, um valor definido será usado. URL personalizado pode ser fornecido por acordo CardinalCommerce." +"Invalid amount for authorization.","Valor inválido para autorização." +"Invalid amount for capture.","Valor inválido para captura." +"Invalid amount for partial authorization.","Valor inválido para autorização parcial." +"Invalid amount for refund.","Valor inválido para reembolso." +"Invalid split tenderId ID.","ID tenderId de divisão inválida." "Maximum Order Total","Total Máximo do Pedido" "Merchant MD5","MD5 Vendedor" "Merchant's Email","Email do Vendedor" @@ -24,17 +44,43 @@ "Payment Action","Ação de Pagamento" "Payment authorization error.","Erro na autorização de pagamento." "Payment authorization error. Transacion id is empty.","Erro de autorização de pagamento. ID de transação está vazio." +"Payment canceling error.","Erro de cancelamento de pagamento." +"Payment capturing error.","Erro de captura de pagamento." "Payment error. Order was not found.","Erro de pagamento. Ordem não foi encontrada." "Payment error. Paid amount doesn\'t match the order amount.","Erro de pagamento. Valor pago não corresponde ao valor da ordem." "Payment from Applicable Countries","Pagamento de PaÃses Aplicáveis" "Payment from Specific Countries","Pagamento de PaÃses EspecÃficos" +"Payment partial authorization error.","Erro de autorização de pagamento parcial." +"Payment refunding error.","Erro de reembolso de pagamento." +"Payment updating error.","Erro de atualização de pagamento." +"Payment voiding error.","Erro de anulamento de pagamento." "Please, choose payment method","Por favor, escolha o método de pagamento" +"Processed Amount","Valor Processado" +"Remaining Balance","Balanço Restante" "Response hash validation failed. Transaction declined.","Validação de resposta de mistura falhou. Transação recusada." +"Severe 3D Secure Card Validation","Validação de Cartão Severe 3D Secure" +"Severe Validation Removes Chargeback Liability on Merchant","Validação Severe Remove a Responsabilidade de Cobrança Retroativa no Comerciante" +"Shopping cart contents and/or address has been changed.","Conteúdo do carrinho de compras e/ou endereço foi alterado." "Sort Order","Classificar pedido" "Test Mode","Modo de Teste" +"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","O valor no seu cartão de crédito é insuficiente para concluir a compra. O montante disponÃvel foi colocado em espera. Para concluir a sua compra, clique em OK e especifique o número do cartão de crédito adicional. Para cancelar a compra e liberar o montante em espera, clique em Cancelar." "The order has been created.","A ordem foi criada." +"There was an error canceling transactions. Please contact us or try again later.","Ocorreu um erro ao cancelar as transações. Por favor entre em contato conosco ou tente novamente mais tarde." "There was an error processing your order. Please contact us or try again later.","Ocorreu um erro ao processar sua ordem. Entre em contato conosco ou tente novamente mais tarde." "Title","TÃtulo" "Transaction Key","Chave de Transação" "What is this?","O que é isso?" +"You have reached the maximum number of credit card allowed to be used for the payment.","Você atingiu o número máximo de cartão de crédito autorizado a ser utilizado para o pagamento." +"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Você atingiu o número máximo de cartões de crédito que pode ser usado para um único pagamento. Os montantes disponÃveis em todos os cartões utilizados foram insuficientes para completar o pagamento. O pagamento foi cancelado e os valores em espera foram liberados." "You will be required to enter your payment details before you place an order.","Você será obrigado a inserir seus detalhes de pagamento antes de colocar uma ordem." +"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Seu cartão de crédito foi recusado. Clique em OK para especificar outro cartão de crédito para concluir a compra. Clique em Cancelar para liberar a quantia em espera e selecione outro método de pagamento." +"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Seu pedido não tenha sido colocado, porque o conteúdo do carrinho de compras e/ou endereço foi alterado. Montantes autorizados a partir do seu pagamento anterior que ficaram pendentes são agora liberados. Por favor siga através do processo de compra para o seu conteúdo recente do carrinho." +"Your payment has been cancelled. All authorized amounts have been released.","O seu pagamento foi cancelado. Todos os valores autorizados foram liberados." +"amount %s","valor %s" +"authorize","autorizar" +"authorize and capture","autorizar e capturar" +"capture","capturar" +"failed","fracassado" +"refund","reembolso" +"successful","bem sucedido" +"void","vazio" diff --git a/app/code/Magento/Authorizenet/i18n/zh_CN.csv b/app/code/Magento/Authorizenet/i18n/zh_CN.csv index 04e844cba81..3de95843437 100644 --- a/app/code/Magento/Authorizenet/i18n/zh_CN.csv +++ b/app/code/Magento/Authorizenet/i18n/zh_CN.csv @@ -1,20 +1,40 @@ "--Please Select--","-- 请选择 --" +"3D Secure","3D 安全" +"3D Secure Card Validation","3D 安全信用å¡éªŒè¯" "API Login ID","API 登录 ID" "Accepted Currency","接å—的汇率" +"Allow Partial Authorization","å…许部分身份验è¯" +"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","您是å¦ç¡®å®šè¦å–消支付?å•击确定å¯å–消您的支付,并释放å 用的é¢åº¦ã€‚å•击喿¶ˆå¯è¾“入其他信用å¡ï¼Œå¹¶ç»§ç»è¿›è¡Œæ”¯ä»˜ã€‚" +"Authorize Only","仅供授æƒ" +"Authorize and Capture","授æƒå’Œæ•获" +"Authorize.Net Transaction ID %s","Authorize.Net 交易 ID %s" +"Authorize.net","Authorize.net" "Authorize.net Direct Post","Authorize.net 直接å‘表" +"Cancel","å–æ¶ˆ" "Card Verification Number","å¡ç‰‡éªŒè¯å·ç " "Card Verification Number Visual Reference","信用å¡éªŒè¯å·ç 视觉å‚考" +"Centinel API URL","Centinel API URL" "Close","å…³é—" "Credit Card Information","信用å¡ä¿¡æ¯" "Credit Card Number","信用å¡å·ç " "Credit Card Type","信用å¡ç±»åž‹" "Credit Card Types","信用å¡ç±»åž‹" "Credit Card Verification","信用å¡éªŒè¯" +"Credit Card: xxxx-%s","信用å¡ï¼šxxxx-%s" "Debug","调试" "Email Customer","å‘é€ç”µå邮件给客户" "Enabled","å·²å¯ç”¨" +"Error in payment gateway.","支付网关出错。" "Expiration Date","过期日期" "Gateway URL","网关 URL" +"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","网关æ“作被é”å®šï¼Œå› ä¸ºç½‘å…³æ— æ³•å®Œæˆä¸€ä¸ªæˆ–多个交易。请登录到您的 Authorize.Net 叿ˆ·å¹¶æ‰‹å·¥è§£å†³è¯¥é—®é¢˜ã€‚" +"Gateway error: %s","网关错误:%s" +"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","如果为空,则会使用默认值。自定义URLå¯é€šè¿‡ CardinalCommerce åè®®æä¾›ã€‚" +"Invalid amount for authorization.","授æƒçš„é¢åº¦æ— 效。" +"Invalid amount for capture.","获å–çš„é¢åº¦æ— 效。" +"Invalid amount for partial authorization.","éƒ¨åˆ†èº«ä»½éªŒè¯æ— 效。" +"Invalid amount for refund.","退款é¢åº¦æ— 效。" +"Invalid split tenderId ID.","拆分的 tenderId ID æ— æ•ˆã€‚" "Maximum Order Total","æœ€å¤§è®¢å•æ€»æ•°" "Merchant MD5","商家 MD5" "Merchant's Email","商家电å邮件" @@ -24,17 +44,43 @@ "Payment Action","支付æ“作" "Payment authorization error.","支付授æƒé”™è¯¯ã€‚" "Payment authorization error. Transacion id is empty.","支付授æƒå‡ºé”™ã€‚交易编å·ä¸ºç©ºã€‚" +"Payment canceling error.","å–æ¶ˆæ”¯ä»˜è¿‡ç¨‹å‡ºé”™ã€‚" +"Payment capturing error.","支付æ•获出错。" "Payment error. Order was not found.","æ”¯ä»˜å‡ºé”™ï¼Œè®¢å•æœªæ‰¾åˆ°ã€‚" "Payment error. Paid amount doesn\'t match the order amount.","支付错误。付款金é¢ä¸Žè®¢å•金é¢ä¸åŒ¹é…。" "Payment from Applicable Countries","ä»Žå¯æŽ¥å—的国家支付" "Payment from Specific Countries","从指定的国家支付" +"Payment partial authorization error.","支付的部分身份验è¯å‡ºé”™ã€‚" +"Payment refunding error.","支付的退款出错。" +"Payment updating error.","支付更新错误。" +"Payment voiding error.","支付的作废出错。" "Please, choose payment method","请选择支付方å¼" +"Processed Amount","处ç†çš„é¢åº¦" +"Remaining Balance","剩下的余é¢" "Response hash validation failed. Transaction declined.","å“应哈希验è¯å¤±è´¥ã€‚交易被拒ç»ã€‚" +"Severe 3D Secure Card Validation","æä¾› 3D 安全信用å¡éªŒè¯" +"Severe Validation Removes Chargeback Liability on Merchant","æ£å¼éªŒè¯å°†æ’¤é”€é“¶è¡Œçš„退款责任" +"Shopping cart contents and/or address has been changed.","è´ç‰©è½¦å†…容和/或地å€å·²è¢«æ›´æ”¹ã€‚" "Sort Order","排åºé¡ºåº" "Test Mode","测试模å¼" +"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","您信用å¡çš„ä½™é¢ä¸è¶³ä»¥å®Œæˆæœ¬æ¬¡è´ä¹°ã€‚å¯ç”¨ä½™é¢å·²ç»è¢«æš‚æŒ‚ã€‚ä¸ºå®Œæˆæ‚¨çš„è´ä¹°ï¼Œè¯·ç‚¹å‡»ç¡®å®šå¹¶æä¾›å¦ä¸€ä¸ªä¿¡ç”¨å¡å·ç 。è¦å–消è´ä¹°å¹¶é€€å›žæš‚挂的余é¢ï¼Œè¯·ç‚¹å‡»å–消。" "The order has been created.","订å•已创建。" +"There was an error canceling transactions. Please contact us or try again later.","å–æ¶ˆäº¤æ˜“æ—¶é‡åˆ°äº†é”™è¯¯ã€‚请è”系我们或ç¨å€™é‡è¯•。" "There was an error processing your order. Please contact us or try again later.","å¤„ç†æ‚¨çš„è®¢å•æ—¶é‡åˆ°äº†é”™è¯¯ã€‚请è”系我们,或ç¨åŽå†è¯•。" "Title","æ ‡é¢˜" "Transaction Key","交易密钥" "What is this?","这是什么?" +"You have reached the maximum number of credit card allowed to be used for the payment.","您已ç»è¾¾åˆ°äº†å¯ç”¨äºŽäº¤æ˜“çš„ä¿¡ç”¨å¡æ•°é‡æœ€å¤§å€¼ã€‚" +"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","您已ç»è¾¾åˆ°äº†ä¸€æ¬¡æ”¯ä»˜å¯ä½¿ç”¨ä¿¡ç”¨å¡æ•°é‡çš„æœ€å¤§å€¼ã€‚所有用过å¡ç‰‡çš„å¯ç”¨é¢åº¦éƒ½ä¸è¶³ä»¥å®Œæˆæ”¯ä»˜ã€‚ä»˜æ¬¾å·²è¢«å–æ¶ˆï¼Œæš‚挂的é¢åº¦å·²ç»è¢«è¿”还。" "You will be required to enter your payment details before you place an order.","您将需è¦è¾“入您的支付详情,éšåŽæ‰èƒ½ä¸‹å•。" +"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","您的信用å¡è¢«æ‹’ç»ã€‚点击确定以指定å¦ä¸€å¼ å¯å®Œæˆæ¤æ¬¡äº¤æ˜“的信用å¡ã€‚ç‚¹å‡»å–æ¶ˆä»¥è¿”还被暂挂的é¢åº¦ï¼Œå¹¶é€‰æ‹©å…¶ä»–支付方å¼ã€‚" +"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","您的订å•åˆ›å»ºä¸æˆåŠŸï¼Œå› ä¸ºè´ç‰©è½¦çš„内容和/或地å€å·²ç»æœ‰å˜åŠ¨ã€‚æ‚¨çš„ä¸Šæ¬¡æ”¯ä»˜ä¸é€šè¿‡é¢„授æƒè¢«æš‚挂的é¢åº¦å·²ç»è¿”还。请为è´ç‰©è½¦ä¸çš„æ–°å†…容釿–°æ‰§è¡Œä»˜æ¬¾æµç¨‹ã€‚" +"Your payment has been cancelled. All authorized amounts have been released.","æ‚¨çš„ä»˜æ¬¾å·²è¢«å–æ¶ˆã€‚所有授æƒçš„é¢åº¦å·²ç»è¢«è¿”还。" +"amount %s","é¢åº¦ %s" +"authorize","授æƒ" +"authorize and capture","授æƒå’ŒèŽ·å–" +"capture","获å–" +"failed","失败" +"refund","退款" +"successful","æˆåŠŸ" +"void","é¿å…" diff --git a/app/code/Magento/Paygate/view/adminhtml/form/cc.phtml b/app/code/Magento/Authorizenet/view/adminhtml/form/cc.phtml similarity index 100% rename from app/code/Magento/Paygate/view/adminhtml/form/cc.phtml rename to app/code/Magento/Authorizenet/view/adminhtml/form/cc.phtml diff --git a/app/code/Magento/Paygate/view/adminhtml/info/cc.phtml b/app/code/Magento/Authorizenet/view/adminhtml/info/cc.phtml similarity index 100% rename from app/code/Magento/Paygate/view/adminhtml/info/cc.phtml rename to app/code/Magento/Authorizenet/view/adminhtml/info/cc.phtml diff --git a/app/code/Magento/Paygate/view/adminhtml/info/pdf.phtml b/app/code/Magento/Authorizenet/view/adminhtml/info/pdf.phtml similarity index 100% rename from app/code/Magento/Paygate/view/adminhtml/info/pdf.phtml rename to app/code/Magento/Authorizenet/view/adminhtml/info/pdf.phtml diff --git a/app/code/Magento/Paygate/view/frontend/paygate-authenticate.js b/app/code/Magento/Authorizenet/view/frontend/authorizenet-authenticate.js similarity index 98% rename from app/code/Magento/Paygate/view/frontend/paygate-authenticate.js rename to app/code/Magento/Authorizenet/view/frontend/authorizenet-authenticate.js index a0b03feac31..b2e92269cda 100644 --- a/app/code/Magento/Paygate/view/frontend/paygate-authenticate.js +++ b/app/code/Magento/Authorizenet/view/frontend/authorizenet-authenticate.js @@ -25,7 +25,7 @@ /*jshint browser:true jquery:true*/ (function($, window) { "use strict"; - $.widget('mage.paygateAuthenticate', { + $.widget('mage.authorizenetAuthenticate', { options : { cancelButtonSelector: 'button[name="cancel"]', partialAuthorizationConfirmationMessage: '', diff --git a/app/code/Magento/Paygate/view/frontend/form/cc.phtml b/app/code/Magento/Authorizenet/view/frontend/form/cc.phtml similarity index 94% rename from app/code/Magento/Paygate/view/frontend/form/cc.phtml rename to app/code/Magento/Authorizenet/view/frontend/form/cc.phtml index 03e313db541..9b11bceb92d 100644 --- a/app/code/Magento/Paygate/view/frontend/form/cc.phtml +++ b/app/code/Magento/Authorizenet/view/frontend/form/cc.phtml @@ -42,8 +42,8 @@ <script type="text/javascript"> (function ($) { - head.js("<?php echo $this->getViewFileUrl('Magento_Paygate::paygate-authenticate.js') ?>", function () { - $('[data-container="release-amounts"]').paygateAuthenticate({ + head.js("<?php echo $this->getViewFileUrl('Magento_Authorizenet::authorizenet-authenticate.js') ?>", function () { + $('[data-container="release-amounts"]').authorizenetAuthenticate({ partialAuthorizationConfirmationMessage: '<?php echo $this->getPartialAuthorizationConfirmationMessage()?>', cancelConfirmationMessage: '<?php echo $this->getCancelConfirmationMessage() ?>', cancelUrl: '<?php echo $this->getCancelUrl() ?>' diff --git a/app/code/Magento/Paygate/view/frontend/info/cc.phtml b/app/code/Magento/Authorizenet/view/frontend/info/cc.phtml similarity index 100% rename from app/code/Magento/Paygate/view/frontend/info/cc.phtml rename to app/code/Magento/Authorizenet/view/frontend/info/cc.phtml diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_supergroup.xml b/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_backendresponse.xml similarity index 87% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_supergroup.xml rename to app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_backendresponse.xml index a41f695b23a..dc02c8411ed 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_supergroup.xml +++ b/app/code/Magento/Authorizenet/view/frontend/layout/authorizenet_directpost_payment_backendresponse.xml @@ -24,6 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="catalog_product_grouped"/> - <container output="1" name="catalog.product.edit.tab.super.grid.container" label="grid"/> + <block class="Magento\Authorizenet\Block\Directpost\Iframe" name="iframe" output="1" template="directpost/iframe.phtml"/> </layout> diff --git a/app/code/Magento/Authz/etc/module.xml b/app/code/Magento/Authz/etc/module.xml index 956f67273df..f2e3eefbc76 100644 --- a/app/code/Magento/Authz/etc/module.xml +++ b/app/code/Magento/Authz/etc/module.xml @@ -29,6 +29,8 @@ <module name="Magento_Core"/> <!--TODO: Dependency on Magento_User is temporary and should be eliminated when ACL is made global--> <module name="Magento_User"/> + <module name="Magento_Backend"/> + <module name="Magento_Service"/> </depends> </module> </config> diff --git a/app/code/Magento/Backend/App/Response/Http/FileFactory.php b/app/code/Magento/Backend/App/Response/Http/FileFactory.php index 1d316913622..077620a3f8e 100644 --- a/app/code/Magento/Backend/App/Response/Http/FileFactory.php +++ b/app/code/Magento/Backend/App/Response/Http/FileFactory.php @@ -57,7 +57,7 @@ class FileFactory extends \Magento\App\Response\Http\FileFactory /** * @param \Magento\App\ResponseInterface $response - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Backend\Model\Auth $auth * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\Backend\Model\Session $session @@ -66,7 +66,7 @@ class FileFactory extends \Magento\App\Response\Http\FileFactory */ public function __construct( \Magento\App\ResponseInterface $response, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Backend\Model\Auth $auth, \Magento\Backend\Model\Url $backendUrl, \Magento\Backend\Model\Session $session, @@ -112,7 +112,7 @@ class FileFactory extends \Magento\App\Response\Http\FileFactory public function create( $fileName, $content, - $baseDir = \Magento\Filesystem::ROOT, + $baseDir = \Magento\App\Filesystem::ROOT_DIR, $contentType = 'application/octet-stream', $contentLength = null ) { diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index ef34465c7a4..175726a7634 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -70,7 +70,7 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool * @param \Magento\App\State $appState @@ -103,7 +103,7 @@ class Context extends \Magento\View\Element\Template\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Core\Model\LocaleInterface $locale, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, \Magento\App\State $appState, diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Export.php b/app/code/Magento/Backend/Block/Widget/Grid/Export.php index 44eb90a1b63..d597dc13a9b 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Export.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Export.php @@ -96,7 +96,7 @@ class Export $this->addExportType($type['urlPath'], $type['label']); } } - $this->_directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->_directory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); } /** diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Extended.php b/app/code/Magento/Backend/Block/Widget/Grid/Extended.php index c4359df59f9..504e0c61b78 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Extended.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Extended.php @@ -192,7 +192,7 @@ class Extended parent::_construct(); $this->_emptyText = __('We couldn\'t find any records.'); - $this->_directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->_directory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); } /** diff --git a/app/code/Magento/Backend/Block/Widget/Tab.php b/app/code/Magento/Backend/Block/Widget/Tab.php new file mode 100644 index 00000000000..66fa9d45b56 --- /dev/null +++ b/app/code/Magento/Backend/Block/Widget/Tab.php @@ -0,0 +1,86 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backend\Block\Widget; + +use Magento\Backend\Block\Widget\Tab\TabInterface; + +class Tab extends \Magento\Backend\Block\Template implements TabInterface +{ + /** + * Return Tab label + * + * @return string + */ + public function getTabLabel() + { + return $this->getLabel(); + } + + /** + * Return Tab title + * + * @return string + */ + public function getTabTitle() + { + return $this->getTitle(); + } + + /** + * Can show tab in tabs + * + * @return boolean + */ + public function canShowTab() + { + return $this->hasCanShow() ? (bool) $this->getCanShow() : true; + } + + /** + * Tab is hidden + * + * @return boolean + */ + public function isHidden() + { + return $this->hasIsHidden() ? (bool) $this->getIsHidden() : false; + } + + /** + * @return string + */ + public function getTabClass() + { + return $this->getClass(); + } + + /** + * @return string + */ + public function getTabUrl() + { + return $this->hasData('url') ? $this->getData('url') : '#'; + } +} diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php index f52eeafb162..abf9bba0b9e 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config.php @@ -132,6 +132,6 @@ class Config extends \Magento\Backend\Controller\Adminhtml\System\AbstractConfig } $gridBlock->setWebsiteId($website->getId())->setConditionName($conditionName); $content = $gridBlock->getCsvFile(); - return $this->_fileFactory->create($fileName, $content, \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php index 1d9cf8260b5..a8f3b5e48af 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php @@ -475,7 +475,8 @@ class Store extends \Magento\Backend\App\Action ->setTime(time()) ->setType('db') ->setPath( - $this->_objectManager->get('Magento\Filesystem')->getPath(\Magento\Filesystem::VAR_DIR) . '/backups' + $this->_objectManager->get('Magento\App\Filesystem') + ->getPath(\Magento\App\Filesystem::VAR_DIR) . '/backups' ); $backupDb->createBackup($backup); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php index 064e34d94bc..cf9238ae955 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php @@ -46,7 +46,7 @@ class Robots extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Config $config - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -56,7 +56,7 @@ class Robots extends \Magento\Core\Model\Config\Value \Magento\Core\Model\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Config $config, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -70,7 +70,7 @@ class Robots extends \Magento\Core\Model\Config\Value $resourceCollection, $data ); - $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $this->_file = 'robots.txt'; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/File.php b/app/code/Magento/Backend/Model/Config/Backend/File.php index ac1fc5e4080..3c9a6ea9717 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/File.php +++ b/app/code/Magento/Backend/Model/Config/Backend/File.php @@ -46,7 +46,7 @@ class File extends \Magento\Core\Model\Config\Value protected $_maxFileSize = 0; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -67,7 +67,7 @@ class File extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory * @param \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -79,7 +79,7 @@ class File extends \Magento\Core\Model\Config\Value \Magento\Core\Model\Config $config, \Magento\Core\Model\File\UploaderFactory $uploaderFactory, \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -87,7 +87,7 @@ class File extends \Magento\Core\Model\Config\Value $this->_uploaderFactory = $uploaderFactory; $this->_requestData = $requestData; $this->_filesystem = $filesystem; - $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } @@ -147,7 +147,7 @@ class File extends \Magento\Core\Model\Config\Value */ public function validateMaxSize($filePath) { - $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::SYS_TMP); + $directory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::SYS_TMP_DIR); if ( $this->_maxFileSize > 0 && $directory->stat($directory->getRelativePath($filePath))['size'] > ($this->_maxFileSize * 1024) diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/Field.php b/app/code/Magento/Backend/Model/Config/Structure/Element/Field.php index a03b41595f3..2a39df68ba7 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/Field.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/Field.php @@ -30,17 +30,6 @@ namespace Magento\Backend\Model\Config\Structure\Element; class Field extends \Magento\Backend\Model\Config\Structure\AbstractElement { - - /** - * Default 'value' field for service option - */ - const DEFAULT_VALUE_FIELD = 'id'; - - /** - * Default 'label' field for service option - */ - const DEFAULT_LABEL_FIELD = 'name'; - /** * Default value for useEmptyValueOption for service option */ @@ -80,20 +69,12 @@ class Field */ protected $_blockFactory; - /** - * dataservice graph - * - * @var \Magento\Core\Model\DataService\Graph - */ - protected $_dataServiceGraph; - /** * @param \Magento\Core\Model\App $application * @param \Magento\Backend\Model\Config\BackendFactory $backendFactory * @param \Magento\Backend\Model\Config\SourceFactory $sourceFactory * @param \Magento\Backend\Model\Config\CommentFactory $commentFactory * @param \Magento\View\Element\BlockFactory $blockFactory - * @param \Magento\Core\Model\DataService\Graph $dataServiceGraph, * @param \Magento\Backend\Model\Config\Structure\Element\Dependency\Mapper $dependencyMapper */ public function __construct( @@ -102,7 +83,6 @@ class Field \Magento\Backend\Model\Config\SourceFactory $sourceFactory, \Magento\Backend\Model\Config\CommentFactory $commentFactory, \Magento\View\Element\BlockFactory $blockFactory, - \Magento\Core\Model\DataService\Graph $dataServiceGraph, \Magento\Backend\Model\Config\Structure\Element\Dependency\Mapper $dependencyMapper ) { parent::__construct($application); @@ -110,7 +90,6 @@ class Field $this->_sourceFactory = $sourceFactory; $this->_commentFactory = $commentFactory; $this->_blockFactory = $blockFactory; - $this->_dataServiceGraph = $dataServiceGraph; $this->_dependencyMapper = $dependencyMapper; } @@ -386,12 +365,11 @@ class Field */ public function hasOptions() { - return isset($this->_data['source_model']) || isset($this->_data['options']) - || isset($this->_data['source_service']); + return isset($this->_data['source_model']) || isset($this->_data['options']); } /** - * Retrieve static options, source service options or source model option list + * Retrieve static options or source model option list * * @return array */ @@ -401,10 +379,6 @@ class Field $sourceModel = $this->_data['source_model']; $optionArray = $this->_getOptionsFromSourceModel($sourceModel); return $optionArray; - } else if (isset($this->_data['source_service'])) { - $sourceService = $this->_data['source_service']; - $options = $this->_getOptionsFromService($sourceService); - return $options; } else if (isset($this->_data['options']) && isset($this->_data['options']['option'])) { $options = $this->_data['options']['option']; $options = $this->_getStaticOptions($options); @@ -428,40 +402,6 @@ class Field return $options; } - /** - * Retrieve the options list from the specified service call. - * - * @param array $sourceService - * @return array - */ - protected function _getOptionsFromService($sourceService) - { - $valueField = self::DEFAULT_VALUE_FIELD; - $labelField = self::DEFAULT_LABEL_FIELD; - $inclEmptyValOption = self::DEFAULT_INCLUDE_EMPTY_VALUE_OPTION; - $serviceCall = $sourceService['service_call']; - if (isset($sourceService['idField'])) { - $valueField = $sourceService['idField']; - } - if (isset($sourceService['labelField'])) { - $labelField = $sourceService['labelField']; - } - if (isset($sourceService['includeEmptyValueOption'])) { - $inclEmptyValOption = $sourceService['includeEmptyValueOption']; - } - $dataCollection = $this->_dataServiceGraph->get($serviceCall); - $options = array(); - if ($inclEmptyValOption) { - $options[] = array('value' => '', 'label' => '-- Please Select --'); - } - foreach ($dataCollection as $dataItem) { - $options[] = array( - 'value' => $dataItem[$valueField], - 'label' => $this->_translateLabel($dataItem[$labelField]) - ); - } - return $options; - } /** * Translate a label diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index c424210532c..9794c6bfc6c 100755 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -37,6 +37,19 @@ <module name="Magento_Sendfriend"/> <module name="Magento_Theme"/> <module name="Magento_Weee"/> + <module name="Magento_Reports"/> + <module name="Magento_CatalogSearch"/> + <module name="Magento_Sales"/> + <module name="Magento_Catalog"/> + <module name="Magento_User"/> + <module name="Magento_Usa"/> + <module name="Magento_Cms"/> + <module name="Magento_Shipping"/> + <module name="Magento_Backup"/> + <module name="Magento_Email"/> + <module name="Magento_Customer"/> + <module name="Magento_Tax"/> + <module name="Magento_Checkout"/> </depends> </module> </config> diff --git a/app/code/Magento/Backend/etc/system.xsd b/app/code/Magento/Backend/etc/system.xsd index b6b69f04814..741109c59c9 100644 --- a/app/code/Magento/Backend/etc/system.xsd +++ b/app/code/Magento/Backend/etc/system.xsd @@ -234,7 +234,6 @@ <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> - <xs:attribute name="service_call" type="xs:string" use="required" /> <xs:attribute name="idField" type="xs:string" use="optional" /> <xs:attribute name="labelField" type="xs:string" use="optional" /> <xs:attribute name="includeEmptyValueOption" type="xs:boolean" use="optional" /> diff --git a/app/code/Magento/Backend/etc/system_file.xsd b/app/code/Magento/Backend/etc/system_file.xsd index dd5f9b9e0a0..7ebb5091947 100644 --- a/app/code/Magento/Backend/etc/system_file.xsd +++ b/app/code/Magento/Backend/etc/system_file.xsd @@ -235,7 +235,6 @@ <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> - <xs:attribute name="service_call" type="xs:string" use="required" /> <xs:attribute name="idField" type="xs:string" use="optional" /> <xs:attribute name="labelField" type="xs:string" use="optional" /> <xs:attribute name="includeEmptyValueOption" type="xs:boolean" use="optional" /> diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index.php b/app/code/Magento/Backup/Controller/Adminhtml/Index.php index 7eaac4b66cd..a9ba1fd09d4 100644 --- a/app/code/Magento/Backup/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Backup/Controller/Adminhtml/Index.php @@ -159,7 +159,7 @@ class Index extends \Magento\Backend\App\Action } if ($type != \Magento\Backup\Factory::TYPE_DB) { - $backupManager->setRootDir($this->_objectManager->get('Magento\Filesystem')->getPath()) + $backupManager->setRootDir($this->_objectManager->get('Magento\App\Filesystem')->getPath()) ->addIgnorePaths($helper->getBackupIgnorePaths()); } @@ -215,7 +215,7 @@ class Index extends \Magento\Backend\App\Action $response = $this->_fileFactory->create( $fileName, null, - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/octet-stream', $backup->getSize() ); @@ -296,7 +296,7 @@ class Index extends \Magento\Backend\App\Action if ($type != \Magento\Backup\Factory::TYPE_DB) { - $backupManager->setRootDir($this->_objectManager->get('Magento\Filesystem')->getPath()) + $backupManager->setRootDir($this->_objectManager->get('Magento\App\Filesystem')->getPath()) ->addIgnorePaths($helper->getRollbackIgnorePaths()); if ($this->getRequest()->getParam('use_ftp', false)) { diff --git a/app/code/Magento/Backup/Helper/Data.php b/app/code/Magento/Backup/Helper/Data.php index 6b850783a95..be43df0f45c 100644 --- a/app/code/Magento/Backup/Helper/Data.php +++ b/app/code/Magento/Backup/Helper/Data.php @@ -30,7 +30,7 @@ namespace Magento\Backup\Helper; class Data extends \Magento\App\Helper\AbstractHelper { /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -55,14 +55,14 @@ class Data extends \Magento\App\Helper\AbstractHelper * Construct * * @param \Magento\App\Helper\Context $context - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\AuthorizationInterface $authorization * @param \Magento\App\Cache\TypeListInterface $cacheTypeList * @param \Magento\Index\Model\Resource\Process\CollectionFactory $processFactory */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\AuthorizationInterface $authorization, \Magento\App\Cache\TypeListInterface $cacheTypeList, \Magento\Index\Model\Resource\Process\CollectionFactory $processFactory @@ -121,7 +121,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getBackupsDir() { - return $this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR) . '/backups'; + return $this->_filesystem->getPath(\Magento\App\Filesystem::VAR_DIR) . '/backups'; } /** @@ -185,12 +185,12 @@ class Data extends \Magento\App\Helper\AbstractHelper '.git', '.svn', 'maintenance.flag', - $this->_filesystem->getPath(\Magento\Filesystem::SESSION), - $this->_filesystem->getPath(\Magento\Filesystem::CACHE), - $this->_filesystem->getPath(\Magento\Filesystem::LOG), - $this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR) . '/full_page_cache', - $this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR) . '/locks', - $this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR) . '/report', + $this->_filesystem->getPath(\Magento\App\Filesystem::SESSION_DIR), + $this->_filesystem->getPath(\Magento\App\Filesystem::CACHE_DIR), + $this->_filesystem->getPath(\Magento\App\Filesystem::LOG_DIR), + $this->_filesystem->getPath(\Magento\App\Filesystem::VAR_DIR) . '/full_page_cache', + $this->_filesystem->getPath(\Magento\App\Filesystem::VAR_DIR) . '/locks', + $this->_filesystem->getPath(\Magento\App\Filesystem::VAR_DIR) . '/report', ); } @@ -205,12 +205,12 @@ class Data extends \Magento\App\Helper\AbstractHelper '.svn', '.git', 'maintenance.flag', - $this->_filesystem->getPath(\Magento\Filesystem::SESSION), - $this->_filesystem->getPath(\Magento\Filesystem::LOG), - $this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR) . '/locks', - $this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR) . '/report', - $this->_filesystem->getPath(\Magento\Filesystem::ROOT) . '/errors', - $this->_filesystem->getPath(\Magento\Filesystem::ROOT) . '/index.php', + $this->_filesystem->getPath(\Magento\App\Filesystem::SESSION_DIR), + $this->_filesystem->getPath(\Magento\App\Filesystem::LOG_DIR), + $this->_filesystem->getPath(\Magento\App\Filesystem::VAR_DIR) . '/locks', + $this->_filesystem->getPath(\Magento\App\Filesystem::VAR_DIR) . '/report', + $this->_filesystem->getPath(\Magento\App\Filesystem::ROOT_DIR) . '/errors', + $this->_filesystem->getPath(\Magento\App\Filesystem::ROOT_DIR) . '/index.php', ); } @@ -223,7 +223,7 @@ class Data extends \Magento\App\Helper\AbstractHelper { $maintenanceFlagFile = $this->getMaintenanceFlagFilePath(); $result = $this->_filesystem - ->getDirectoryWrite(\Magento\Filesystem::ROOT) + ->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR) ->writeFile($maintenanceFlagFile, 'maintenance'); return $result !== false; @@ -235,7 +235,7 @@ class Data extends \Magento\App\Helper\AbstractHelper public function turnOffMaintenanceMode() { $maintenanceFlagFile = $this->getMaintenanceFlagFilePath(); - $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT)->delete($maintenanceFlagFile); + $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR)->delete($maintenanceFlagFile); } /** diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index 2228acd835c..78faadd67b1 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -54,7 +54,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa protected $_stream = null; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -92,7 +92,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param array $data */ public function __construct( @@ -100,14 +100,14 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa \Magento\Core\Model\LocaleInterface $locale, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, $data = array() ) { $this->_encryptor = $encryptor; parent::__construct($data); $this->_filesystem = $filesystem; - $this->varDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->varDirectory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $this->_helper = $helper; $this->_locale = $locale; $this->_backendAuthSession = $authSession; @@ -306,11 +306,11 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa try { /** @var \Magento\Filesystem\Directory\WriteInterface $varDirectory */ - $varDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $varDirectory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $this->_stream = $varDirectory->openFile( $this->_getFilePath(), $mode, - \Magento\Filesystem::WRAPPER_CONTENT_ZLIB + \Magento\App\Filesystem::WRAPPER_CONTENT_ZLIB ); } catch (\Magento\Filesystem\FilesystemException $e) { @@ -400,7 +400,7 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa } /** @var \Magento\Filesystem\Directory\ReadInterface $zlibDirectory */ - $zlibDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ZLIB); + $zlibDirectory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::WRAPPER_CONTENT_ZLIB); $zlibDirectory = $zlibDirectory->readFile($this->_getFilePath()); echo $zlibDirectory; diff --git a/app/code/Magento/Backup/Model/Fs/Collection.php b/app/code/Magento/Backup/Model/Fs/Collection.php index 713d8319a3b..b26159bb68d 100644 --- a/app/code/Magento/Backup/Model/Fs/Collection.php +++ b/app/code/Magento/Backup/Model/Fs/Collection.php @@ -58,13 +58,13 @@ class Collection extends \Magento\Data\Collection\Filesystem /** * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Backup\Helper\Data $backupData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Backup\Model\Backup $backup */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Backup\Helper\Data $backupData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Backup\Model\Backup $backup ) { $this->_backupData = $backupData; @@ -72,7 +72,7 @@ class Collection extends \Magento\Data\Collection\Filesystem $this->_filesystem = $filesystem; $this->_backup = $backup; - $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $this->_hideBackupsForApache(); diff --git a/app/code/Magento/Backup/Model/Observer.php b/app/code/Magento/Backup/Model/Observer.php index ef8fe44f22e..c48ad2d8a7c 100644 --- a/app/code/Magento/Backup/Model/Observer.php +++ b/app/code/Magento/Backup/Model/Observer.php @@ -75,7 +75,7 @@ class Observer /** * Filesystem facade * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -89,7 +89,7 @@ class Observer * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Logger $logger * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Backup\Factory $backupFactory */ public function __construct( @@ -97,7 +97,7 @@ class Observer \Magento\Core\Model\Registry $coreRegistry, \Magento\Logger $logger, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Backup\Factory $backupFactory ) { $this->_backupData = $backupData; @@ -135,7 +135,7 @@ class Observer $this->_coreRegistry->register('backup_manager', $backupManager); if ($type != \Magento\Backup\Factory::TYPE_DB) { - $backupManager->setRootDir($this->_filesystem->getPath(\Magento\Filesystem::ROOT)) + $backupManager->setRootDir($this->_filesystem->getPath(\Magento\App\Filesystem::ROOT_DIR)) ->addIgnorePaths($this->_backupData->getBackupIgnorePaths()); } diff --git a/app/code/Magento/Backup/etc/module.xml b/app/code/Magento/Backup/etc/module.xml index 39c2cedac18..3f3d40ce2f5 100755 --- a/app/code/Magento/Backup/etc/module.xml +++ b/app/code/Magento/Backup/etc/module.xml @@ -33,6 +33,7 @@ <module name="Magento_Backend"/> <module name="Magento_Cron"/> <module name="Magento_Index"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php index 201d3ed2ae1..1c8bf217c85 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php @@ -85,6 +85,7 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -105,7 +106,8 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView \Magento\Bundle\Model\Product\PriceFactory $productPrice, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_catalogProduct = $catalogProduct; $this->_productPrice = $productPrice; @@ -124,7 +126,8 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView $layoutHelper, $imageHelper, $arrayUtils, - $data + $data, + $priceBlockTypes ); } diff --git a/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php b/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php index 62dbb4da2f1..07321e031c3 100644 --- a/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php +++ b/app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php @@ -68,6 +68,7 @@ class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer parent::__construct( $context, $productConfig, $checkoutSession, $imageHelper, $urlHelper, $messageManager, $data ); + $this->_isScopePrivate = true; } protected function _construct() diff --git a/app/code/Magento/Bundle/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Bundle.php b/app/code/Magento/Bundle/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Bundle.php new file mode 100644 index 00000000000..859fd69cf39 --- /dev/null +++ b/app/code/Magento/Bundle/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Bundle.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin; + +class Bundle +{ + /** + * @var \Magento\App\RequestInterface + */ + protected $request; + + /** + * @param \Magento\App\RequestInterface $request + */ + public function __construct(\Magento\App\RequestInterface $request) + { + $this->request = $request; + } + + /** + * Setting Bundle Items Data to product for father processing + * + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\Catalog\Model\Product + */ + public function afterInitialize(\Magento\Catalog\Model\Product $product) + { + if (($items = $this->request->getPost('bundle_options')) && !$product->getCompositeReadonly()) { + $product->setBundleOptionsData($items); + } + + if (($selections = $this->request->getPost('bundle_selections')) && !$product->getCompositeReadonly()) { + $product->setBundleSelectionsData($selections); + } + + if ($product->getPriceType() == '0' && !$product->getOptionsReadonly()) { + $product->setCanSaveCustomOptions(true); + if ($customOptions = $product->getProductOptions()) { + foreach (array_keys($customOptions) as $key) { + $customOptions[$key]['is_delete'] = 1; + } + $product->setProductOptions($customOptions); + } + } + + $product->setCanSaveBundleSelections( + (bool)$this->request->getPost('affect_bundle_product_selections') && !$product->getCompositeReadonly() + ); + + return $product; + } +} diff --git a/app/code/Magento/Bundle/Model/Observer.php b/app/code/Magento/Bundle/Model/Observer.php index 7cc187027ad..e36b1b54e2d 100644 --- a/app/code/Magento/Bundle/Model/Observer.php +++ b/app/code/Magento/Bundle/Model/Observer.php @@ -85,42 +85,6 @@ class Observer $this->_productVisibility = $productVisibility; } - /** - * Setting Bundle Items Data to product for father processing - * - * @param \Magento\Object $observer - * @return \Magento\Bundle\Model\Observer - */ - public function prepareProductSave($observer) - { - $request = $observer->getEvent()->getRequest(); - $product = $observer->getEvent()->getProduct(); - - if (($items = $request->getPost('bundle_options')) && !$product->getCompositeReadonly()) { - $product->setBundleOptionsData($items); - } - - if (($selections = $request->getPost('bundle_selections')) && !$product->getCompositeReadonly()) { - $product->setBundleSelectionsData($selections); - } - - if ($product->getPriceType() == '0' && !$product->getOptionsReadonly()) { - $product->setCanSaveCustomOptions(true); - if ($customOptions = $product->getProductOptions()) { - foreach (array_keys($customOptions) as $key) { - $customOptions[$key]['is_delete'] = 1; - } - $product->setProductOptions($customOptions); - } - } - - $product->setCanSaveBundleSelections( - (bool)$request->getPost('affect_bundle_product_selections') && !$product->getCompositeReadonly() - ); - - return $this; - } - /** * Append bundles in upsell list for current product * @@ -213,63 +177,6 @@ class Observer return $this; } - /** - * duplicating bundle options and selections - * - * @param \Magento\Object $observer - * @return \Magento\Bundle\Model\Observer - */ - public function duplicateProduct($observer) - { - $product = $observer->getEvent()->getCurrentProduct(); - - if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { - //do nothing if not bundle - return $this; - } - - $newProduct = $observer->getEvent()->getNewProduct(); - - $product->getTypeInstance()->setStoreFilter($product->getStoreId(), $product); - $optionCollection = $product->getTypeInstance()->getOptionsCollection($product); - $selectionCollection = $product->getTypeInstance()->getSelectionsCollection( - $product->getTypeInstance()->getOptionsIds($product), - $product - ); - $optionCollection->appendSelections($selectionCollection); - - $optionRawData = array(); - $selectionRawData = array(); - - $i = 0; - foreach ($optionCollection as $option) { - $optionRawData[$i] = array( - 'required' => $option->getData('required'), - 'position' => $option->getData('position'), - 'type' => $option->getData('type'), - 'title' => $option->getData('title')?$option->getData('title'):$option->getData('default_title'), - 'delete' => '' - ); - foreach ($option->getSelections() as $selection) { - $selectionRawData[$i][] = array( - 'product_id' => $selection->getProductId(), - 'position' => $selection->getPosition(), - 'is_default' => $selection->getIsDefault(), - 'selection_price_type' => $selection->getSelectionPriceType(), - 'selection_price_value' => $selection->getSelectionPriceValue(), - 'selection_qty' => $selection->getSelectionQty(), - 'selection_can_change_qty' => $selection->getSelectionCanChangeQty(), - 'delete' => '' - ); - } - $i++; - } - - $newProduct->setBundleOptionsData($optionRawData); - $newProduct->setBundleSelectionsData($selectionRawData); - return $this; - } - /** * Setting attribute tab block for bundle * diff --git a/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php b/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php new file mode 100644 index 00000000000..9c277187d7a --- /dev/null +++ b/app/code/Magento/Bundle/Model/Product/CopyConstructor/Bundle.php @@ -0,0 +1,80 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Bundle\Model\Product\CopyConstructor; + +class Bundle implements \Magento\Catalog\Model\Product\CopyConstructorInterface +{ + /** + * Duplicating bundle options and selections + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $duplicate + */ + public function build(\Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate) + { + if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE) { + //do nothing if not bundle + return; + } + + $product->getTypeInstance()->setStoreFilter($product->getStoreId(), $product); + $optionCollection = $product->getTypeInstance()->getOptionsCollection($product); + $selectionCollection = $product->getTypeInstance()->getSelectionsCollection( + $product->getTypeInstance()->getOptionsIds($product), + $product + ); + $optionCollection->appendSelections($selectionCollection); + + $optionRawData = array(); + $selectionRawData = array(); + + $i = 0; + foreach ($optionCollection as $option) { + $optionRawData[$i] = array( + 'required' => $option->getData('required'), + 'position' => $option->getData('position'), + 'type' => $option->getData('type'), + 'title' => $option->getData('title')?$option->getData('title'):$option->getData('default_title'), + 'delete' => '' + ); + foreach ($option->getSelections() as $selection) { + $selectionRawData[$i][] = array( + 'product_id' => $selection->getProductId(), + 'position' => $selection->getPosition(), + 'is_default' => $selection->getIsDefault(), + 'selection_price_type' => $selection->getSelectionPriceType(), + 'selection_price_value' => $selection->getSelectionPriceValue(), + 'selection_qty' => $selection->getSelectionQty(), + 'selection_can_change_qty' => $selection->getSelectionCanChangeQty(), + 'delete' => '' + ); + } + $i++; + } + + $duplicate->setBundleOptionsData($optionRawData); + $duplicate->setBundleSelectionsData($selectionRawData); + } +} diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index 9cd6dbd46bd..f0a39119339 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -150,7 +150,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Logger $logger * @param \Magento\Catalog\Helper\Product $catalogProduct @@ -174,7 +174,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\Data $coreData, \Magento\Core\Helper\File\Storage\Database $fileStorageDb, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, \Magento\Logger $logger, \Magento\Catalog\Helper\Product $catalogProduct, diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php index fc4f53a20c2..de78c696d2a 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -46,7 +46,7 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -56,7 +56,7 @@ class Creditmemo extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractIte \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php index b39c73345cd..c465a5f5c29 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php @@ -44,7 +44,7 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Stdlib\String $coreString * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -54,7 +54,7 @@ class Invoice extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Stdlib\String $coreString, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php index a033f08d37f..f2ef29591a7 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php @@ -44,7 +44,7 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -54,7 +54,7 @@ class Shipment extends \Magento\Bundle\Model\Sales\Order\Pdf\Items\AbstractItems \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, diff --git a/app/code/Magento/Bundle/etc/adminhtml/di.xml b/app/code/Magento/Bundle/etc/adminhtml/di.xml index 8b0224e543d..47e2e147f44 100644 --- a/app/code/Magento/Bundle/etc/adminhtml/di.xml +++ b/app/code/Magento/Bundle/etc/adminhtml/di.xml @@ -27,4 +27,14 @@ <type name="Magento\Sales\Model\Convert\Quote"> <plugin name="append_bundle_data_to_order" type="Magento\Bundle\Model\Plugin\QuoteItem"/> </type> + <type name="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper"> + <plugin name="Bundle" type="Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Bundle" sortOrder="60" /> + </type> + <type name="Magento\Catalog\Model\Product\CopyConstructor\Composite"> + <param name="constructors"> + <value> + <bundle>Magento\Bundle\Model\Product\CopyConstructor\Bundle</bundle> + </value> + </param> + </type> </config> diff --git a/app/code/Magento/Bundle/etc/adminhtml/events.xml b/app/code/Magento/Bundle/etc/adminhtml/events.xml index fb84653e17a..0e681b6b3fc 100644 --- a/app/code/Magento/Bundle/etc/adminhtml/events.xml +++ b/app/code/Magento/Bundle/etc/adminhtml/events.xml @@ -24,12 +24,6 @@ */ --> <config> - <event name="catalog_product_prepare_save"> - <observer name="bundle_observer" instance="Magento\Bundle\Model\Observer" method="prepareProductSave" /> - </event> - <event name="catalog_model_product_duplicate"> - <observer name="bundle_observer" instance="Magento\Bundle\Model\Observer" method="duplicateProduct" /> - </event> <event name="catalog_product_edit_action"> <observer name="bundle_observer" instance="Magento\Bundle\Model\Observer" method="setAttributeTabBlock" /> </event> diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index e0b4f5e9c69..f137dc77683 100755 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -42,6 +42,8 @@ <module name="Magento_Weee"/> <module name="Magento_GiftMessage"/> <module name="Magento_Theme"/> + <module name="Magento_Wishlist"/> + <module name="Magento_Multishipping" type="soft"/> </depends> </module> </config> diff --git a/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php index 82084e14742..014e7bd641c 100644 --- a/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php +++ b/app/code/Magento/Bundle/sql/bundle_setup/mysql4-upgrade-1.6.0.0-1.6.0.0.1.php @@ -31,7 +31,7 @@ $installer = $this; $installFile = __DIR__ . '/upgrade-1.6.0.0-1.6.0.0.1.php'; /** @var \Magento\Filesystem\Directory\Read $modulesDirectory */ -$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\Filesystem::MODULES); +$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); if ($modulesDirectory->isExist($modulesDirectory->getRelativePath($installFile))) { include $installFile; diff --git a/app/code/Magento/Bundle/view/frontend/catalog/product/price.phtml b/app/code/Magento/Bundle/view/frontend/catalog/product/price.phtml index 7d34ee58299..a4c350439d2 100644 --- a/app/code/Magento/Bundle/view/frontend/catalog/product/price.phtml +++ b/app/code/Magento/Bundle/view/frontend/catalog/product/price.phtml @@ -29,25 +29,27 @@ <?php $_id = $_product->getId() ?> <?php $_weeeTaxAmount = 0; ?> +<?php /** @var $weeeHelper \Magento\Weee\Helper\Data */ ?> +<?php $weeeHelper = $this->helper('Magento\Weee\Helper\Data'); ?> <?php if ($_product->getPriceType() == 1) { - $_weeeTaxAmount = $this->helper('Magento\Weee\Helper\Data')->getAmount($_product); + $_weeeTaxAmount = $weeeHelper->getAmount($_product); $_weeeTaxAmountInclTaxes = $_weeeTaxAmount; - if ($this->helper('Magento\Weee\Helper\Data')->isTaxable()) { - $_attributes = $this->helper('Magento\Weee\Helper\Data')->getProductWeeeAttributesForRenderer($_product, null, null, null, true); - $_weeeTaxAmountInclTaxes = $this->helper('Magento\Weee\Helper\Data')->getAmountInclTaxes($_attributes); + if ($weeeHelper->isTaxable()) { + $_attributes = $weeeHelper->getProductWeeeAttributesForRenderer($_product, null, null, null, true); + $_weeeTaxAmountInclTaxes = $weeeHelper->getAmountInclTaxes($_attributes); } - if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(0, 1, 4))) { + if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, array(0, 1, 4))) { $_minimalPriceTax += $_weeeTaxAmount; $_minimalPriceInclTax += $_weeeTaxAmountInclTaxes; } - if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, 2)) { + if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 2)) { $_minimalPriceInclTax += $_weeeTaxAmountInclTaxes; } - if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(1, 2, 4))) { - $_weeeTaxAttributes = $this->helper('Magento\Weee\Helper\Data')->getProductWeeeAttributesForDisplay($_product); + if ($weeeHelper->typeOfDisplay($_product, array(1, 2, 4))) { + $_weeeTaxAttributes = $weeeHelper->getProductWeeeAttributesForDisplay($_product); } } ?> @@ -61,10 +63,10 @@ if ($_product->getPriceType() == 1) { <span class="label"><?php echo __('Excl. Tax:') ?></span> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> </span> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 1, 4))): ?> + <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $weeeHelper->typeOfDisplay($_product, array(2, 1, 4))): ?> <span class="weee">(<small> <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 4))): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, array(2, 4))): ?> <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> <?php else: ?> <?php $amount = $_weeeTaxAttribute->getAmount(); ?> @@ -82,10 +84,10 @@ if ($_product->getPriceType() == 1) { </span> <?php else: ?> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 1, 4))): ?> + <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $weeeHelper->typeOfDisplay($_product, array(2, 1, 4))): ?> <span class="weee">(<small> <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 4))): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, array(2, 4))): ?> <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> <?php else: ?> <?php $amount = $_weeeTaxAttribute->getAmount(); ?> @@ -97,7 +99,7 @@ if ($_product->getPriceType() == 1) { <?php endforeach; ?> </small>)</span> <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceInclTax) ?> <?php endif; ?> <?php endif; ?> @@ -111,10 +113,10 @@ if ($_product->getPriceType() == 1) { <span class="label"><?php echo __('Excl. Tax:') ?></span> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> </span> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 1, 4))): ?> + <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $weeeHelper->typeOfDisplay($_product, array(2, 1, 4))): ?> <span class="weee">(<small> <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 4))): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, array(2, 4))): ?> <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> <?php else: ?> <?php $amount = $_weeeTaxAttribute->getAmount(); ?> @@ -132,10 +134,10 @@ if ($_product->getPriceType() == 1) { </span> <?php else: ?> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 1, 4))): ?> + <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $weeeHelper->typeOfDisplay($_product, array(2, 1, 4))): ?> <span class="weee">(<small> <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 4))): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, array(2, 4))): ?> <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> <?php else: ?> <?php $amount = $_weeeTaxAttribute->getAmount(); ?> @@ -147,18 +149,18 @@ if ($_product->getPriceType() == 1) { <?php endforeach; ?> </small>)</span> <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceInclTax) ?> <?php endif; ?> <?php endif; ?> </p> <?php if ($_product->getPriceType() == 1) { - if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(0, 1, 4))) { + if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, array(0, 1, 4))) { $_maximalPriceTax += $_weeeTaxAmount; $_maximalPriceInclTax += $_weeeTaxAmountInclTaxes; } - if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, 2)) { + if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 2)) { $_maximalPriceInclTax += $_weeeTaxAmountInclTaxes; } } @@ -170,10 +172,10 @@ if ($_product->getPriceType() == 1) { <span class="label"><?php echo __('Excl. Tax:') ?></span> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_maximalPriceTax) ?> </span> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 1, 4))): ?> + <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $weeeHelper->typeOfDisplay($_product, array(2, 1, 4))): ?> <span class="weee">(<small> <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 4))): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, array(2, 4))): ?> <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> <?php else: ?> <?php $amount = $_weeeTaxAttribute->getAmount(); ?> @@ -191,10 +193,10 @@ if ($_product->getPriceType() == 1) { </span> <?php else: ?> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_maximalPriceTax) ?> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 1, 4))): ?> + <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $weeeHelper->typeOfDisplay($_product, array(2, 1, 4))): ?> <span class="weee">(<small> <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 4))): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, array(2, 4))): ?> <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> <?php else: ?> <?php $amount = $_weeeTaxAttribute->getAmount(); ?> @@ -206,7 +208,7 @@ if ($_product->getPriceType() == 1) { <?php endforeach; ?> </small>)</span> <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_maximalPriceInclTax) ?> <?php endif; ?> <?php endif; ?> @@ -217,10 +219,10 @@ if ($_product->getPriceType() == 1) { <span class="label"><?php echo __('Excl. Tax:') ?></span> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> </span> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 1, 4))): ?> + <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $weeeHelper->typeOfDisplay($_product, array(2, 1, 4))): ?> <span class="weee">(<small> <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 4))): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, array(2, 4))): ?> <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> <?php else: ?> <?php $amount = $_weeeTaxAttribute->getAmount(); ?> @@ -238,10 +240,10 @@ if ($_product->getPriceType() == 1) { </span> <?php else: ?> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceTax) ?> - <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 1, 4))): ?> + <?php if ($_weeeTaxAmount && $_product->getPriceType() == 1 && $weeeHelper->typeOfDisplay($_product, array(2, 1, 4))): ?> <span class="weee">(<small> <?php $_weeeSeparator = ''; foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(2, 4))): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, array(2, 4))): ?> <?php $amount = $_weeeTaxAttribute->getAmount()+$_weeeTaxAttribute->getTaxAmount(); ?> <?php else: ?> <?php $amount = $_weeeTaxAttribute->getAmount(); ?> @@ -253,7 +255,7 @@ if ($_product->getPriceType() == 1) { <?php endforeach; ?> </small>)</span> <?php endif; ?> - <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?> + <?php if ($weeeHelper->typeOfDisplay($_product, 2) && $_weeeTaxAmount): ?> <?php echo $this->helper('Magento\Core\Helper\Data')->currency($_minimalPriceInclTax) ?> <?php endif; ?> <?php endif; ?> diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_multishipping_addresses.xml b/app/code/Magento/Bundle/view/frontend/layout/multishipping_checkout_addresses.xml similarity index 94% rename from app/code/Magento/Bundle/view/frontend/layout/checkout_multishipping_addresses.xml rename to app/code/Magento/Bundle/view/frontend/layout/multishipping_checkout_addresses.xml index 2a93f33838c..784a79eab62 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/checkout_multishipping_addresses.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/multishipping_checkout_addresses.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="checkout_addresses"> - <block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Checkout::multishipping/item/default.phtml" cacheable="false"/> + <block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> </referenceBlock> </layout> diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_multishipping_overview.xml b/app/code/Magento/Bundle/view/frontend/layout/multishipping_checkout_overview.xml similarity index 94% rename from app/code/Magento/Bundle/view/frontend/layout/checkout_multishipping_overview.xml rename to app/code/Magento/Bundle/view/frontend/layout/multishipping_checkout_overview.xml index 47a9dde9343..3c03cba7a92 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/checkout_multishipping_overview.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/multishipping_checkout_overview.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="checkout_overview"> - <block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Checkout::multishipping/item/default.phtml" cacheable="false"/> + <block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> </referenceBlock> </layout> diff --git a/app/code/Magento/Bundle/view/frontend/layout/checkout_multishipping_shipping.xml b/app/code/Magento/Bundle/view/frontend/layout/multishipping_checkout_shipping.xml similarity index 91% rename from app/code/Magento/Bundle/view/frontend/layout/checkout_multishipping_shipping.xml rename to app/code/Magento/Bundle/view/frontend/layout/multishipping_checkout_shipping.xml index b9f98da4bce..91de6ad0931 100644 --- a/app/code/Magento/Bundle/view/frontend/layout/checkout_multishipping_shipping.xml +++ b/app/code/Magento/Bundle/view/frontend/layout/multishipping_checkout_shipping.xml @@ -25,9 +25,9 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="checkout_shipping"> - <block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Checkout::multishipping/item/default.phtml" cacheable="false"/> + <block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> </referenceBlock> <referenceBlock name="checkout_billing_items"> - <block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Checkout::multishipping/item/default.phtml" cacheable="false"/> + <block class="Magento\Bundle\Block\Checkout\Cart\Item\Renderer" as="bundle" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> </referenceBlock> </layout> diff --git a/app/code/Magento/Captcha/Helper/Adminhtml/Data.php b/app/code/Magento/Captcha/Helper/Adminhtml/Data.php index 686cf59347a..4c94651463a 100644 --- a/app/code/Magento/Captcha/Helper/Adminhtml/Data.php +++ b/app/code/Magento/Captcha/Helper/Adminhtml/Data.php @@ -44,7 +44,7 @@ class Data extends \Magento\Captcha\Helper\Data * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Model\StoreManager $storeManager * @param \Magento\Core\Model\Config $config - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Captcha\Model\CaptchaFactory $factory * @param \Magento\Backend\App\ConfigInterface $backendConfig */ @@ -52,7 +52,7 @@ class Data extends \Magento\Captcha\Helper\Data \Magento\App\Helper\Context $context, \Magento\Core\Model\StoreManager $storeManager, \Magento\Core\Model\Config $config, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Captcha\Model\CaptchaFactory $factory, \Magento\Backend\App\ConfigInterface $backendConfig ) { diff --git a/app/code/Magento/Captcha/Helper/Data.php b/app/code/Magento/Captcha/Helper/Data.php index c8de8b21702..60738374319 100644 --- a/app/code/Magento/Captcha/Helper/Data.php +++ b/app/code/Magento/Captcha/Helper/Data.php @@ -68,7 +68,7 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_config; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -86,14 +86,14 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Config $config - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Captcha\Model\CaptchaFactory $factory */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Config $config, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Captcha\Model\CaptchaFactory $factory ) { $this->_storeManager = $storeManager; @@ -150,7 +150,7 @@ class Data extends \Magento\App\Helper\AbstractHelper $fontsConfig = $this->_config->getValue(\Magento\Captcha\Helper\Data::XML_PATH_CAPTCHA_FONTS, 'default'); $fonts = array(); if ($fontsConfig) { - $libDir = $this->_filesystem->getPath(\Magento\Filesystem::LIB); + $libDir = $this->_filesystem->getPath(\Magento\App\Filesystem::LIB_DIR); foreach ($fontsConfig as $fontName => $fontConfig) { $fonts[$fontName] = array( 'label' => $fontConfig['label'], @@ -169,7 +169,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getImgDir($website = null) { - $mediaDir = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDir = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $captchaDir = '/captcha/' . $this->_getWebsiteCode($website); $mediaDir->create($captchaDir); $mediaDir->changePermissions($captchaDir, 0775); @@ -196,7 +196,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function getImgUrl($website = null) { - return $this->_storeManager->getStore()->getBaseUrl(\Magento\Filesystem::MEDIA) . 'captcha' + return $this->_storeManager->getStore()->getBaseUrl(\Magento\App\Filesystem::MEDIA_DIR) . 'captcha' . '/' . $this->_getWebsiteCode($website) . '/'; } } diff --git a/app/code/Magento/Captcha/Model/Cron.php b/app/code/Magento/Captcha/Model/Cron.php index 5b15e6c0883..4c225607f5a 100644 --- a/app/code/Magento/Captcha/Model/Cron.php +++ b/app/code/Magento/Captcha/Model/Cron.php @@ -64,20 +64,20 @@ class Cron * @param Resource\LogFactory $resLogFactory * @param \Magento\Captcha\Helper\Data $helper * @param \Magento\Captcha\Helper\Adminhtml\Data $adminHelper - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\StoreManager $storeManager */ public function __construct( \Magento\Captcha\Model\Resource\LogFactory $resLogFactory, \Magento\Captcha\Helper\Data $helper, \Magento\Captcha\Helper\Adminhtml\Data $adminHelper, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\StoreManager $storeManager ) { $this->_resLogFactory = $resLogFactory; $this->_helper = $helper; $this->_adminHelper = $adminHelper; - $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_storeManager = $storeManager; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php index af9ceafc56d..3502ccac77d 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit.php @@ -216,11 +216,6 @@ class Edit extends \Magento\Backend\Block\Widget return $setId; } - public function getIsGrouped() - { - return $this->getProduct()->isGrouped(); - } - public function getDuplicateUrl() { return $this->getUrl('catalog/*/duplicate', array('_current'=>true)); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php index 0145f6d499d..8d89f26d3f3 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Alerts.php @@ -35,7 +35,7 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; -class Alerts extends \Magento\Backend\Block\Template +class Alerts extends \Magento\Backend\Block\Widget\Tab { protected $_template = 'catalog/product/tab/alert.phtml'; @@ -75,4 +75,16 @@ class Alerts extends \Magento\Backend\Block\Template { return $this->getChildHtml('accordion'); } + + /** + * Tab is hidden + * + * @return boolean + */ + public function canShowTab() + { + $alertPriceAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_price'); + $alertStockAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_stock'); + return ($alertPriceAllow || $alertStockAllow) && parent::canShowTab(); + } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php index 88c438fca68..f722228288b 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php @@ -187,6 +187,7 @@ class Attributes extends \Magento\Catalog\Block\Adminhtml\Form $element = $form->getElement($attribute); if ($element) { $element->setReadonly(true, true); + $element->lock(); } } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php index 9d13fc6266b..07cf853b47e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php @@ -192,13 +192,9 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs * @see \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs\Configurable * @see \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tabs */ - if (!$product->isGrouped()) { - $this->addTab('customer_options', array( - 'label' => __('Custom Options'), - 'url' => $this->getUrl('catalog/*/options', array('_current' => true)), - 'class' => 'ajax', - 'group_code' => self::ADVANCED_TAB_GROUP_CODE, - )); + if ($this->getChildBlock('customer_options')) { + $this->addTab('customer_options', 'customer_options'); + $this->getChildBlock('customer_options')->setGroupCode(self::ADVANCED_TAB_GROUP_CODE); } $this->addTab('related', array( @@ -227,22 +223,14 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs unset($advancedGroups['design']); } - $alertPriceAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_price'); - $alertStockAllow = $this->_storeConfig->getConfig('catalog/productalert/allow_stock'); - if (($alertPriceAllow || $alertStockAllow) && !$product->isGrouped()) { - $this->addTab('product-alerts', array( - 'label' => __('Product Alerts'), - 'content' => $this->_translateHtml($this->getLayout() - ->createBlock('Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts', 'admin.alerts.products') - ->toHtml() - ), - 'group_code' => self::ADVANCED_TAB_GROUP_CODE, - )); + if ($this->getChildBlock('product-alerts')) { + $this->addTab('product-alerts', 'product-alerts'); + $this->getChildBlock('product-alerts')->setGroupCode(self::ADVANCED_TAB_GROUP_CODE); } if ($this->getRequest()->getParam('id')) { if ($this->_catalogData->isModuleEnabled('Magento_Review')) { - if ($this->_authorization->isAllowed('Magento_Review::reviews_all')){ + if ($this->_authorization->isAllowed('Magento_Review::reviews_all')) { $this->addTab('product-reviews', array( 'label' => __('Product Reviews'), 'url' => $this->getUrl('catalog/*/reviews', array('_current' => true)), diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs/Grouped.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs/Grouped.php deleted file mode 100644 index dc163d837b9..00000000000 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs/Grouped.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Adminhtml - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * admin edit tabs for grouped product - * - * @category Magento - * @package Magento_Adminhtml - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs; - -class Grouped extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs -{ - protected function _prepareLayout() - { - parent::_prepareLayout(); - - $this->addTab('super', array( - 'label' => __('Associated Products'), - 'url' => $this->getUrl('catalog/*/superGroup', array('_current'=>true)), - 'class' => 'ajax', - )); - } -} diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php index d31f24941ce..9723c5e870f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php @@ -129,10 +129,11 @@ class Category extends \Magento\Data\Form\Element\Multiselect $button = $this->_layout ->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( - 'id' => 'add_category_button', - 'label' => $newCategoryCaption, - 'title' => $newCategoryCaption, - 'onclick' => 'jQuery("#new-category").dialog("open")' + 'id' => 'add_category_button', + 'label' => $newCategoryCaption, + 'title' => $newCategoryCaption, + 'onclick' => 'jQuery("#new-category").dialog("open")', + 'disabled' => $this->getDisabled(), )); $return = <<<HTML <input id="{$htmlId}-suggest" placeholder="$suggestPlaceholder" /> diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php index 2ba69644787..07a5f4e7bc5 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php @@ -84,6 +84,9 @@ class Weight extends \Magento\Data\Form\Element\Text if (!$this->getForm()->getDataObject()->getTypeInstance()->hasWeight()) { $this->_virtual->setChecked('checked'); } + if ($this->getDisabled()) { + $this->_virtual->setDisabled($this->getDisabled()); + } return '<div class="fields-group-2"><div class="field"><div class="addon"><div class="control">' . parent::getElementHtml() . '<label class="addafter" for="' diff --git a/app/code/Magento/Catalog/Block/Navigation.php b/app/code/Magento/Catalog/Block/Navigation.php index 7dc27bd4b8a..5a5e88638f6 100644 --- a/app/code/Magento/Catalog/Block/Navigation.php +++ b/app/code/Magento/Catalog/Block/Navigation.php @@ -119,6 +119,7 @@ class Navigation extends \Magento\View\Element\Template $this->_registry = $registry; $this->_categoryInstance = $categoryFactory->create(); parent::__construct($context, $data); + $this->_isScopePrivate = true; } protected function _construct() diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index 5959c5a1e51..89e1ea3bd99 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -112,7 +112,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template /** * @var \Magento\Math\Random */ - protected $mathRandom; + protected $_mathRandom; /** * @var \Magento\Checkout\Helper\Cart @@ -152,6 +152,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template * @param \Magento\Theme\Helper\Layout $layoutHelper * @param \Magento\Catalog\Helper\Image $imageHelper * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -167,7 +168,8 @@ abstract class AbstractProduct extends \Magento\View\Element\Template \Magento\Catalog\Helper\Product\Compare $compareProduct, \Magento\Theme\Helper\Layout $layoutHelper, \Magento\Catalog\Helper\Image $imageHelper, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_imageHelper = $imageHelper; $this->_layoutHelper = $layoutHelper; @@ -178,7 +180,8 @@ abstract class AbstractProduct extends \Magento\View\Element\Template $this->_coreRegistry = $registry; $this->_taxData = $taxData; $this->_catalogData = $catalogData; - $this->mathRandom = $mathRandom; + $this->_mathRandom = $mathRandom; + $this->_priceBlockTypes = $priceBlockTypes; parent::__construct($context, $data); } @@ -229,25 +232,24 @@ abstract class AbstractProduct extends \Magento\View\Element\Template } /** - * Enter description here... + * Retrieve add to wishlist params * * @param \Magento\Catalog\Model\Product $product * @return string */ - public function getAddToWishlistUrl($product) + public function getAddToWishlistParams($product) { - return $this->_wishlistHelper->getAddUrl($product); + return $this->_wishlistHelper->getAddParams($product); } /** * Retrieve Add Product to Compare Products List URL * - * @param \Magento\Catalog\Model\Product $product * @return string */ - public function getAddToCompareUrl($product) + public function getAddToCompareUrl() { - return $this->_compareProduct->getAddUrl($product); + return $this->_compareProduct->getAddUrl(); } /** @@ -427,7 +429,6 @@ abstract class AbstractProduct extends \Magento\View\Element\Template return $this->_getPriceBlock($product->getTypeId()) ->setTemplate($this->getTierPriceTemplate()) ->setProduct($product) - ->setInGrouped($product->isGrouped()) ->toHtml(); } @@ -832,6 +833,6 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ public function getRandomString($length, $chars = null) { - return $this->mathRandom->getRandomString($length, $chars); + return $this->_mathRandom->getRandomString($length, $chars); } } diff --git a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php index e691e676fca..468469635ec 100644 --- a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php +++ b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php @@ -127,6 +127,7 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -147,7 +148,8 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_wishlistHelper = $wishlistHelper; $this->_coreData = $coreData; @@ -167,26 +169,26 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } /** - * Retrieve url for adding product to wishlist with params + * Get add to wishlist params * * @param \Magento\Catalog\Model\Product $product - * @return string + * @return array */ - public function getAddToWishlistUrl($product) + public function getAddToWishlistParams($product) { $continueUrl = $this->_coreData->urlEncode($this->getUrl('customer/account')); $urlParamName = \Magento\App\Action\Action::PARAM_NAME_URL_ENCODED; - $params = array( - $urlParamName => $continueUrl - ); + $continueUrlParams = array($urlParamName => $continueUrl); - return $this->_wishlistHelper->getAddUrlWithParams($product, $params); + return $this->_wishlistHelper->getAddParams($product, $continueUrlParams); } /** diff --git a/app/code/Magento/Catalog/Block/Product/Gallery.php b/app/code/Magento/Catalog/Block/Product/Gallery.php index cb2d461d41c..70657a25cbd 100644 --- a/app/code/Magento/Catalog/Block/Product/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/Gallery.php @@ -108,7 +108,7 @@ class Gallery extends \Magento\View\Element\Template { $file = $this->getCurrentImage()->getPath(); - if ($this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA)->isFile($file)) { + if ($this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR)->isFile($file)) { $size = getimagesize($file); if (isset($size[0])) { if ($size[0] > 600) { diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php index 02832eacf0c..2d14fe67088 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -79,6 +79,7 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer $catalogLayer * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -96,7 +97,8 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer $catalogLayer, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_categoryFactory = $categoryFactory; $this->_catalogLayer = $catalogLayer; @@ -112,7 +114,8 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); } diff --git a/app/code/Magento/Catalog/Block/Product/NewProduct.php b/app/code/Magento/Catalog/Block/Product/NewProduct.php index df802b2ace7..298044570e2 100644 --- a/app/code/Magento/Catalog/Block/Product/NewProduct.php +++ b/app/code/Magento/Catalog/Block/Product/NewProduct.php @@ -82,6 +82,7 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Customer\Model\Session $customerSession * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -100,7 +101,8 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Customer\Model\Session $customerSession, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_productCollectionFactory = $productCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; @@ -117,8 +119,10 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Catalog/Block/Product/Price/Template.php b/app/code/Magento/Catalog/Block/Product/Price/Template.php index 2464bbc1da5..b7541aadd67 100644 --- a/app/code/Magento/Catalog/Block/Product/Price/Template.php +++ b/app/code/Magento/Catalog/Block/Product/Price/Template.php @@ -43,6 +43,20 @@ class Template extends \Magento\View\Element\AbstractBlock */ protected $_priceBlockTypes = array(); + /** + * @param \Magento\View\Element\Context $context + * @param array $priceBlockTypes + * @param array $data + */ + public function __construct( + \Magento\View\Element\Context $context, + array $priceBlockTypes = array(), + array $data = array() + ) { + $this->_priceBlockTypes = $priceBlockTypes; + parent::__construct($context, $data); + } + /** * Retrieve array of Price Block Types * diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php index c20de66e4ff..efb01480736 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php @@ -58,6 +58,7 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -77,7 +78,8 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_layerFactory = $layerFactory; $this->_productCollectionFactory = $productCollectionFactory; @@ -95,7 +97,8 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct $imageHelper, $categoryFactory, $catalogLayer, - $data + $data, + $priceBlockTypes ); } diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php index 922f75417a7..af628b10090 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php @@ -64,6 +64,7 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -83,7 +84,8 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_layerFactory = $layerFactory; $this->_productCollectionFactory = $productCollectionFactory; @@ -101,7 +103,8 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct $imageHelper, $categoryFactory, $catalogLayer, - $data + $data, + $priceBlockTypes ); } diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php index 829fbd47f33..da7bc90343e 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -79,6 +79,7 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -97,7 +98,8 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_checkoutCart = $checkoutCart; $this->_catalogProductVisibility = $catalogProductVisibility; @@ -114,8 +116,10 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } protected function _prepareData() diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php index 9dc656ec0f5..f6b4b4c47ce 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php @@ -172,6 +172,7 @@ class Toolbar extends \Magento\View\Element\Template $this->_catalogSession = $catalogSession; $this->_catalogConfig = $catalogConfig; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index c0a71ef56ba..f62188a8e1f 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -85,6 +85,7 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -103,7 +104,8 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_checkoutCart = $checkoutCart; $this->_catalogProductVisibility = $catalogProductVisibility; @@ -120,8 +122,10 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } protected function _prepareData() diff --git a/app/code/Magento/Catalog/Block/Product/Send.php b/app/code/Magento/Catalog/Block/Product/Send.php index 1d7d6bf745d..6b9c1a6197d 100644 --- a/app/code/Magento/Catalog/Block/Product/Send.php +++ b/app/code/Magento/Catalog/Block/Product/Send.php @@ -57,6 +57,7 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Customer\Model\Session $customerSession * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -73,7 +74,8 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Theme\Helper\Layout $layoutHelper, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_customerSession = $customerSession; parent::__construct( @@ -88,8 +90,10 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index 811fb9842c5..37a8d9a19f7 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -74,6 +74,11 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct */ protected $_productHelper; + /** + * @var \Magento\Catalog\Model\ProductTypes\ConfigInterface + */ + protected $productTypeConfig; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Catalog\Model\Config $catalogConfig @@ -92,8 +97,10 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Stdlib\String $string * @param \Magento\Catalog\Helper\Product $productHelper + * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig * @param array $data - * + * @param array $priceBlockTypes + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -114,13 +121,16 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Stdlib\String $string, \Magento\Catalog\Helper\Product $productHelper, - array $data = array() + \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, + array $data = array(), + array $priceBlockTypes = array() ) { $this->_productHelper = $productHelper; $this->_coreData = $coreData; $this->_jsonEncoder = $jsonEncoder; $this->_productFactory = $productFactory; $this->_taxCalculation = $taxCalculation; + $this->productTypeConfig = $productTypeConfig; $this->string = $string; parent::__construct( $context, @@ -134,7 +144,8 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); } @@ -157,7 +168,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $currentCategory = $this->_coreRegistry->registry('current_category'); if ($keyword) { $headBlock->setKeywords($keyword); - } elseif($currentCategory) { + } elseif ($currentCategory) { $headBlock->setKeywords($product->getName()); } $description = $product->getMetaDescription(); @@ -374,4 +385,14 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct { return $this->getProduct()->getOptionsContainer() == 'container1' ? 'container1' : 'container2'; } + + /** + * Check whether quantity field should be rendered + * + * @return bool + */ + public function shouldRenderQuantity() + { + return !$this->productTypeConfig->isProductSet($this->getProduct()->getTypeId()); + } } diff --git a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php index 6eaf77fd5a5..e56062c6f64 100644 --- a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php +++ b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php @@ -54,6 +54,7 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -70,7 +71,8 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu \Magento\Theme\Helper\Layout $layoutHelper, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Stdlib\ArrayUtils $arrayUtils, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->arrayUtils = $arrayUtils; parent::__construct( @@ -85,11 +87,11 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); } - /** * Retrieve product * diff --git a/app/code/Magento/Catalog/Block/Product/View/Type/Configurable.php b/app/code/Magento/Catalog/Block/Product/View/Type/Configurable.php index b834b6e7c1b..01ddde2fefe 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/Catalog/Block/Product/View/Type/Configurable.php @@ -57,13 +57,6 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView */ protected $_catalogProduct = null; - /** - * Tax calculation - * - * @var \Magento\Tax\Model\Calculation - */ - protected $_taxCalculation; - /** * @var \Magento\Json\EncoderInterface */ @@ -74,6 +67,11 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView */ protected $_imageHelper; + /** + * @var \Magento\Catalog\Helper\Product\Price + */ + protected $priceHelper; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Catalog\Model\Config $catalogConfig @@ -88,9 +86,10 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Json\EncoderInterface $jsonEncoder - * @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Catalog\Helper\Product $catalogProduct + * @param \Magento\Catalog\Helper\Product\Price $priceHelper * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -108,14 +107,15 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView \Magento\Catalog\Helper\Image $imageHelper, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Json\EncoderInterface $jsonEncoder, - \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Catalog\Helper\Product $catalogProduct, - array $data = array() + \Magento\Catalog\Helper\Product\Price $priceHelper, + array $data = array(), + array $priceBlockTypes = array() ) { $this->_imageHelper = $imageHelper; - $this->_taxCalculation = $taxCalculation; $this->_catalogProduct = $catalogProduct; $this->_jsonEncoder = $jsonEncoder; + $this->priceHelper = $priceHelper; parent::__construct( $context, $catalogConfig, @@ -129,8 +129,10 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView $layoutHelper, $imageHelper, $arrayUtils, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } /** @@ -217,10 +219,11 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView $store = $this->getCurrentStore(); $taxHelper = $this->_taxData; $currentProduct = $this->getProduct(); + $preConfiguredValues = null; - $preconfiguredFlag = $currentProduct->hasPreconfiguredValues(); - if ($preconfiguredFlag) { - $preconfiguredValues = $currentProduct->getPreconfiguredValues(); + $preConfiguredFlag = $currentProduct->hasPreconfiguredValues(); + if ($preConfiguredFlag) { + $preConfiguredValues = $currentProduct->getPreconfiguredValues(); $defaultValues = array(); } @@ -264,7 +267,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView $prices = $attribute->getPrices(); if (is_array($prices)) { foreach ($prices as $value) { - if(!$this->_validateAttributeValue($attributeId, $value, $options)) { + if (!$this->_validateAttributeValue($attributeId, $value, $options)) { continue; } $currentProduct->setConfigurablePrice( @@ -294,37 +297,37 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView } } /** - * Prepare formated values for options choose + * Prepare formatted values for options choose */ foreach ($optionPrices as $optionPrice) { foreach ($optionPrices as $additional) { $this->_preparePrice(abs($additional-$optionPrice)); } } - if($this->_validateAttributeInfo($info)) { + if ($this->_validateAttributeInfo($info)) { $attributes[$attributeId] = $info; } // Add attribute default value (if set) - if ($preconfiguredFlag) { - $configValue = $preconfiguredValues->getData('super_attribute/' . $attributeId); + if ($preConfiguredFlag) { + $configValue = $preConfiguredValues->getData('super_attribute/' . $attributeId); if ($configValue) { $defaultValues[$attributeId] = $configValue; } } } - if (!$this->_taxCalculation->getCustomer() && $this->_coreRegistry->registry('current_customer')) { - $this->_taxCalculation->setCustomer($this->_coreRegistry->registry('current_customer')); + if (!$this->priceHelper->getCustomer() && $this->_coreRegistry->registry('current_customer')) { + $this->priceHelper->setCustomer($this->_coreRegistry->registry('current_customer')); } - $_request = $this->_taxCalculation->getRateRequest(false, false, false); + $_request = $this->priceHelper->getRateRequest(false, false, false); $_request->setProductClassId($currentProduct->getTaxClassId()); - $defaultTax = $this->_taxCalculation->getRate($_request); + $defaultTax = $this->priceHelper->getRate($_request); - $_request = $this->_taxCalculation->getRateRequest(); + $_request = $this->priceHelper->getRateRequest(); $_request->setProductClassId($currentProduct->getTaxClassId()); - $currentTax = $this->_taxCalculation->getRate($_request); + $currentTax = $this->priceHelper->getRate($_request); $taxConfig = array( 'includeTax' => $taxHelper->priceIncludesTax(), @@ -346,7 +349,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView 'images' => $options['images'], ); - if ($preconfiguredFlag && !empty($defaultValues)) { + if ($preConfiguredFlag && !empty($defaultValues)) { $config['defaultValues'] = $defaultValues; } @@ -365,7 +368,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView */ protected function _validateAttributeValue($attributeId, &$value, &$options) { - if(isset($options[$attributeId][$value['value_index']])) { + if (isset($options[$attributeId][$value['value_index']])) { return true; } @@ -380,7 +383,7 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView */ protected function _validateAttributeInfo(&$info) { - if(count($info['options']) > 0) { + if (count($info['options']) > 0) { return true; } return false; diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php index 414a417476c..9200887cd11 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php @@ -37,11 +37,6 @@ use Magento\Backend\App\Action; class Product extends \Magento\Backend\App\Action { - /** - * The greatest value which could be stored in CatalogInventory Qty field - */ - const MAX_QTY_VALUE = 99999999.9999; - /** * Array of actions which can be processed without secret key validation * @@ -54,7 +49,7 @@ class Product extends \Magento\Backend\App\Action * * @var \Magento\Core\Model\Registry */ - protected $_coreRegistry = null; + protected $registry = null; /** * @var \Magento\Core\Filter\Date @@ -62,17 +57,41 @@ class Product extends \Magento\Backend\App\Action protected $_dateFilter; /** - * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Core\Model\Registry $coreRegistry + * @var Product\Initialization\Helper + */ + protected $initializationHelper; + + /** + * @var Product\Initialization\StockDataFilter + */ + protected $stockFilter; + + /** + * @var \Magento\Catalog\Model\Product\Copier + */ + protected $productCopier; + + /** + * @param Action\Context $context + * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Filter\Date $dateFilter + * @param Product\Initialization\Helper $initializationHelper + * @param Product\Initialization\StockDataFilter $stockFilter + * @param \Magento\Catalog\Model\Product\Copier $productCopier */ public function __construct( \Magento\Backend\App\Action\Context $context, - \Magento\Core\Model\Registry $coreRegistry, - \Magento\Core\Filter\Date $dateFilter + \Magento\Core\Model\Registry $registry, + \Magento\Core\Filter\Date $dateFilter, + \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper, + \Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter $stockFilter, + \Magento\Catalog\Model\Product\Copier $productCopier ) { - $this->_coreRegistry = $coreRegistry; + $this->stockFilter = $stockFilter; + $this->initializationHelper = $initializationHelper; + $this->registry = $registry; $this->_dateFilter = $dateFilter; + $this->productCopier = $productCopier; parent::__construct($context); } @@ -160,8 +179,8 @@ class Product extends \Magento\Backend\App\Action ->setWebsiteIds($configProduct->getWebsiteIds()); } - $this->_coreRegistry->register('product', $product); - $this->_coreRegistry->register('current_product', $product); + $this->registry->register('product', $product); + $this->registry->register('current_product', $product); $this->_objectManager->get('Magento\Cms\Model\Wysiwyg\Config')->setStoreId( $this->getRequest()->getParam('store') ); @@ -181,7 +200,8 @@ class Product extends \Magento\Backend\App\Action \Magento\Backend\Block\Widget\Grid $gridBlock, $productsArray ) { - return $this->_view->getLayout()->createBlock('Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Ajax\Serializer') + return $this->_view->getLayout() + ->createBlock('Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Ajax\Serializer') ->setGridBlock($gridBlock) ->setProducts($productsArray) ->setInputElementName($inputName); @@ -225,7 +245,8 @@ class Product extends \Magento\Backend\App\Action $productData = $this->getRequest()->getPost('product'); if ($productData) { - $this->_filterStockData($productData['stock_data']); + $stockData = isset($productData['stock_data']) ? $productData['stock_data'] : array(); + $productData['stock_data'] = $this->stockFilter->filter($stockData); $product->addData($productData); } @@ -378,7 +399,7 @@ class Product extends \Magento\Backend\App\Action public function generateVariationsAction() { $this->_saveAttributeOptions(); - $this->_initProductSave($this->_initProduct()); + $this->initializationHelper->initialize($this->_initProduct()); $this->_view->loadLayout(); $this->_view->renderLayout(); } @@ -526,26 +547,6 @@ class Product extends \Magento\Backend\App\Action $this->_view->renderLayout(); } - /** - * Get associated grouped products grid - */ - public function superGroupAction() - { - $this->_initProduct(); - $this->_view->loadLayout(false); - $this->_view->renderLayout(); - } - - /** - * Get associated grouped products grid popup - */ - public function superGroupPopupAction() - { - $this->_initProduct(); - $this->_view->loadLayout(false); - $this->_view->renderLayout(); - } - /** * Get product reviews grid * @@ -555,7 +556,7 @@ class Product extends \Magento\Backend\App\Action $this->_initProduct(); $this->_view->loadLayout(); $this->_view->getLayout()->getBlock('admin.product.reviews') - ->setProductId($this->_coreRegistry->registry('product')->getId()) + ->setProductId($this->registry->registry('product')->getId()) ->setUseAjax(true); $this->_view->renderLayout(); } @@ -700,155 +701,6 @@ class Product extends \Magento\Backend\App\Action return $validationResult; } - /** - * Initialize product before saving - * - * @param $product \Magento\Catalog\Model\Product - * @return \Magento\Catalog\Model\Product - */ - protected function _initProductSave($product) - { - $productData = $this->getRequest()->getPost('product'); - if ($productData) { - $this->_filterStockData($productData['stock_data']); - } - - foreach (array('category_ids', 'website_ids') as $field) { - if (!isset($productData[$field])) { - $productData[$field] = array(); - } - } - - $wasLockedMedia = false; - if ($product->isLockedAttribute('media')) { - $product->unlockAttribute('media'); - $wasLockedMedia = true; - } - - $product->addData($productData); - - if ($wasLockedMedia) { - $product->lockAttribute('media'); - } - - if ($this->_objectManager->get('Magento\Core\Model\StoreManagerInterface')->hasSingleStore()) { - $product->setWebsiteIds( - array( - $this->_objectManager->get('Magento\Core\Model\StoreManagerInterface') - ->getStore(true)->getWebsite()->getId() - ) - ); - } - - /** - * Create Permanent Redirect for old URL key - */ - // && $product->getOrigData('url_key') != $product->getData('url_key') - if ($product->getId() && isset($productData['url_key_create_redirect'])) { - $product->setData('save_rewrites_history', (bool)$productData['url_key_create_redirect']); - } - - /** - * Check "Use Default Value" checkboxes values - */ - $useDefaults = $this->getRequest()->getPost('use_default'); - if ($useDefaults) { - foreach ($useDefaults as $attributeCode) { - $product->setData($attributeCode, false); - } - } - - /** - * Init product links data (related, upsell, crosssel) - */ - $links = $this->getRequest()->getPost('links'); - if (isset($links['related']) && !$product->getRelatedReadonly()) { - $product->setRelatedLinkData( - $this->_objectManager->get('Magento\Backend\Helper\Js')->decodeGridSerializedInput($links['related']) - ); - } - if (isset($links['upsell']) && !$product->getUpsellReadonly()) { - $product->setUpSellLinkData( - $this->_objectManager->get('Magento\Backend\Helper\Js')->decodeGridSerializedInput($links['upsell']) - ); - } - if (isset($links['crosssell']) && !$product->getCrosssellReadonly()) { - $product->setCrossSellLinkData($this->_objectManager->get('Magento\Backend\Helper\Js') - ->decodeGridSerializedInput($links['crosssell'])); - } - - if (isset($links['grouped']) && !$product->getGroupedReadonly()) { - $product->setGroupedLinkData((array)$links['grouped']); - } - - /** - * Initialize data for configurable product - */ - - $attributes = $this->getRequest()->getParam('attributes'); - if (!empty($attributes)) { - $this->_objectManager->get('Magento\Catalog\Model\Product\Type\Configurable') - ->setUsedProductAttributeIds($attributes, $product); - - $product->setNewVariationsAttributeSetId($this->getRequest()->getPost('new-variations-attribute-set-id')); - $associatedProductIds = $this->getRequest()->getPost('associated_product_ids', array()); - if ($this->getRequest()->getActionName() != 'generateVariations') { - $generatedProductIds = $this->_objectManager->get('Magento\Catalog\Model\Product\Type\Configurable') - ->generateSimpleProducts($product, $this->getRequest()->getPost('variations-matrix', array())); - $associatedProductIds = array_merge($associatedProductIds, $generatedProductIds); - } - $product->setAssociatedProductIds(array_filter($associatedProductIds)); - - $product->setCanSaveConfigurableAttributes( - (bool)$this->getRequest()->getPost('affect_configurable_product_attributes') - ); - } - - /** - * Initialize product options - */ - if (isset($productData['options']) && !$product->getOptionsReadonly()) { - $product->setProductOptions($productData['options']); - } - - $product->setCanSaveCustomOptions( - (bool)$this->getRequest()->getPost('affect_product_custom_options') - && !$product->getOptionsReadonly() - ); - - $this->_eventManager->dispatch( - 'catalog_product_prepare_save', - array('product' => $product, 'request' => $this->getRequest()) - ); - - return $product; - } - - /** - * Filter product stock data - * - * @param array $stockData - */ - protected function _filterStockData(&$stockData) - { - if (!isset($stockData['use_config_manage_stock'])) { - $stockData['use_config_manage_stock'] = 0; - } - if ($stockData['use_config_manage_stock'] == 1 && !isset($stockData['manage_stock'])) { - $stockData['manage_stock'] = $this->_objectManager->get('Magento\Core\Model\StoreManager')->getStore() - ->getConfig(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK); - } - if (isset($stockData['qty']) && (float)$stockData['qty'] > self::MAX_QTY_VALUE) { - $stockData['qty'] = self::MAX_QTY_VALUE; - } - if (isset($stockData['min_qty']) && (int)$stockData['min_qty'] < 0) { - $stockData['min_qty'] = 0; - } - if (!isset($stockData['is_decimal_divided']) || $stockData['is_qty_decimal'] == 0) { - $stockData['is_decimal_divided'] = 0; - } - } - /** * Save product action */ @@ -861,9 +713,7 @@ class Product extends \Magento\Backend\App\Action $data = $this->getRequest()->getPost(); if ($data) { - $this->_filterStockData($data['product']['stock_data']); - - $product = $this->_initProductSave($this->_initProduct()); + $product = $this->initializationHelper->initialize($this->_initProduct()); $this->_eventManager->dispatch( 'catalog_product_transition_product_type', array('product' => $product, 'request' => $this->getRequest()) @@ -907,7 +757,7 @@ class Product extends \Magento\Backend\App\Action ); if ($redirectBack === 'duplicate') { - $newProduct = $product->duplicate(); + $newProduct = $this->productCopier->copy($product); $this->messageManager->addSuccess(__('You duplicated the product.')); } @@ -959,7 +809,7 @@ class Product extends \Magento\Backend\App\Action { $product = $this->_initProduct(); try { - $newProduct = $product->duplicate(); + $newProduct = $this->productCopier->copy($product); $this->messageManager->addSuccess(__('You duplicated the product.')); $this->_redirect('catalog/*/edit', array('_current'=>true, 'id'=>$newProduct->getId())); } catch (\Exception $e) { @@ -1121,7 +971,7 @@ class Product extends \Magento\Backend\App\Action */ public function customOptionsAction() { - $this->_coreRegistry->register('import_option_products', $this->getRequest()->getPost('products')); + $this->registry->register('import_option_products', $this->getRequest()->getPost('products')); $this->_view->loadLayout(); $this->_view->renderLayout(); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery.php index 447bd5f236e..aabc2d330b9 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery.php @@ -46,7 +46,7 @@ class Gallery extends \Magento\Backend\App\Action $uploader->setAllowRenameFiles(true); $uploader->setFilesDispersion(true); /** @var \Magento\Filesystem\Directory\Read $mediaDirectory */ - $mediaDirectory = $this->_objectManager->get('Magento\Filesystem')->getDirectoryRead(\Magento\Filesystem::MEDIA); + $mediaDirectory = $this->_objectManager->get('Magento\App\Filesystem')->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); $config = $this->_objectManager->get('Magento\Catalog\Model\Product\Media\Config'); $result = $uploader->save($mediaDirectory->getAbsolutePath($config->getBaseTmpMediaPath())); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php new file mode 100644 index 00000000000..2ddfb3c2548 --- /dev/null +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php @@ -0,0 +1,145 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization; + +class Helper +{ + /** + * @var \Magento\App\RequestInterface + */ + protected $request; + + /** + * @var \Magento\Backend\Helper\Js + */ + protected $jsHelper; + + /** + * @var \Magento\Core\Model\StoreManagerInterface + */ + protected $storeManager; + + /** + * @var StockDataFilter + */ + protected $stockFilter; + + /** + * @var Helper\ProductLinks + */ + protected $productLinks; + + /** + * @param \Magento\App\RequestInterface $request + * @param \Magento\Backend\Helper\Js $jsHelper + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param StockDataFilter $stockFilter + * @param Helper\ProductLinks $productLinks + */ + public function __construct( + \Magento\App\RequestInterface $request, + \Magento\Backend\Helper\Js $jsHelper, + \Magento\Core\Model\StoreManagerInterface $storeManager, + StockDataFilter $stockFilter, + Helper\ProductLinks $productLinks + ) { + $this->request = $request; + $this->jsHelper = $jsHelper; + $this->storeManager = $storeManager; + $this->stockFilter = $stockFilter; + $this->productLinks = $productLinks; + } + + /** + * Initialize product before saving + * + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\Catalog\Model\Product + */ + public function initialize(\Magento\Catalog\Model\Product $product) + { + $productData = $this->request->getPost('product'); + + if ($productData) { + $stockData = isset($productData['stock_data']) ? $productData['stock_data'] : array(); + $productData['stock_data'] = $this->stockFilter->filter($stockData); + } + + foreach (array('category_ids', 'website_ids') as $field) { + if (!isset($productData[$field])) { + $productData[$field] = array(); + } + } + + $wasLockedMedia = false; + if ($product->isLockedAttribute('media')) { + $product->unlockAttribute('media'); + $wasLockedMedia = true; + } + + $product->addData($productData); + + if ($wasLockedMedia) { + $product->lockAttribute('media'); + } + + if ($this->storeManager->hasSingleStore()) { + $product->setWebsiteIds(array($this->storeManager->getStore(true)->getWebsite()->getId())); + } + + /** + * Create Permanent Redirect for old URL key + */ + if ($product->getId() && isset($productData['url_key_create_redirect'])) { + $product->setData('save_rewrites_history', (bool)$productData['url_key_create_redirect']); + } + + /** + * Check "Use Default Value" checkboxes values + */ + $useDefaults = $this->request->getPost('use_default'); + if ($useDefaults) { + foreach ($useDefaults as $attributeCode) { + $product->setData($attributeCode, false); + } + } + + $product = $this->productLinks->initializeLinks($product); + + /** + * Initialize product options + */ + if (isset($productData['options']) && !$product->getOptionsReadonly()) { + $product->setProductOptions($productData['options']); + } + + $product->setCanSaveCustomOptions( + (bool)$this->request->getPost('affect_product_custom_options') + && !$product->getOptionsReadonly() + ); + + return $product; + } +} diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php new file mode 100644 index 00000000000..8e56f81f9e8 --- /dev/null +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php @@ -0,0 +1,69 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Plugin; + +class Configurable +{ + /** + * @param \Magento\Catalog\Model\Product\Type\Configurable $productType + * @param \Magento\App\RequestInterface $request + */ + public function __construct( + \Magento\Catalog\Model\Product\Type\Configurable $productType, + \Magento\App\RequestInterface $request + ) { + $this->productType = $productType; + $this->request = $request; + } + + /** + * Initialize data for configurable product + * + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\Catalog\Model\Product + */ + public function afterInitialize(\Magento\Catalog\Model\Product $product) + { + $attributes = $this->request->getParam('attributes'); + if (!empty($attributes)) { + $this->productType->setUsedProductAttributeIds($attributes, $product); + + $product->setNewVariationsAttributeSetId($this->request->getPost('new-variations-attribute-set-id')); + $associatedProductIds = $this->request->getPost('associated_product_ids', array()); + if ($this->request->getActionName() != 'generateVariations') { + $generatedProductIds = $this->productType + ->generateSimpleProducts($product, $this->request->getPost('variations-matrix', array())); + $associatedProductIds = array_merge($associatedProductIds, $generatedProductIds); + } + $product->setAssociatedProductIds(array_filter($associatedProductIds)); + + $product->setCanSaveConfigurableAttributes( + (bool)$this->request->getPost('affect_configurable_product_attributes') + ); + } + + return $product; + } +} diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks.php new file mode 100644 index 00000000000..18bbb62ea95 --- /dev/null +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks.php @@ -0,0 +1,73 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper; + +class ProductLinks +{ + /** + * @var \Magento\App\RequestInterface + */ + protected $request; + + /** + * @var \Magento\Backend\Helper\Js + */ + protected $jsHelper; + + /** + * @param \Magento\App\RequestInterface $request + * @param \Magento\Backend\Helper\Js $jsHelper + */ + public function __construct(\Magento\App\RequestInterface $request, \Magento\Backend\Helper\Js $jsHelper) + { + $this->request = $request; + $this->jsHelper = $jsHelper; + } + + /** + * Init product links data (related, upsell, crosssel) + * + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\Catalog\Model\Product + */ + public function initializeLinks(\Magento\Catalog\Model\Product $product) + { + $links = $this->request->getPost('links'); + + if (isset($links['related']) && !$product->getRelatedReadonly()) { + $product->setRelatedLinkData($this->jsHelper->decodeGridSerializedInput($links['related'])); + } + + if (isset($links['upsell']) && !$product->getUpsellReadonly()) { + $product->setUpSellLinkData($this->jsHelper->decodeGridSerializedInput($links['upsell'])); + } + + if (isset($links['crosssell']) && !$product->getCrosssellReadonly()) { + $product->setCrossSellLinkData($this->jsHelper->decodeGridSerializedInput($links['crosssell'])); + } + + return $product; + } +} diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php new file mode 100644 index 00000000000..843c0aa34e2 --- /dev/null +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilter.php @@ -0,0 +1,77 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization; + +class StockDataFilter +{ + /** + * The greatest value which could be stored in CatalogInventory Qty field + */ + const MAX_QTY_VALUE = 99999999.9999; + + /** + * @var \Magento\Core\Model\StoreManagerInterface + */ + protected $storeManager; + + /** + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + */ + public function __construct(\Magento\Core\Model\StoreManagerInterface $storeManager) + { + $this->storeManager = $storeManager; + } + + /** + * Filter stock data + * + * @param array $stockData + * @return array + */ + public function filter(array $stockData) + { + if (!isset($stockData['use_config_manage_stock'])) { + $stockData['use_config_manage_stock'] = 0; + } + + if ($stockData['use_config_manage_stock'] == 1 && !isset($stockData['manage_stock'])) { + $stockData['manage_stock'] = $this->storeManager->getStore() + ->getConfig(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK); + } + if (isset($stockData['qty']) && (float)$stockData['qty'] > self::MAX_QTY_VALUE) { + $stockData['qty'] = self::MAX_QTY_VALUE; + } + + if (isset($stockData['min_qty']) && (int)$stockData['min_qty'] < 0) { + $stockData['min_qty'] = 0; + } + + if (!isset($stockData['is_decimal_divided']) || $stockData['is_qty_decimal'] == 0) { + $stockData['is_decimal_divided'] = 0; + } + + return $stockData; + } +} diff --git a/app/code/Magento/Catalog/Helper/Product/Compare.php b/app/code/Magento/Catalog/Helper/Product/Compare.php index c76f8a8a86c..b2f6b968aae 100644 --- a/app/code/Magento/Catalog/Helper/Product/Compare.php +++ b/app/code/Magento/Catalog/Helper/Product/Compare.php @@ -101,6 +101,16 @@ class Compare extends \Magento\Core\Helper\Url */ protected $_formKey; + /** + * @var \Magento\Wishlist\Helper\Data + */ + protected $_wishlistHelper; + + /** + * @var \Magento\Core\Helper\Data + */ + protected $_coreHelper; + /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -110,6 +120,8 @@ class Compare extends \Magento\Core\Helper\Url * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Session $catalogSession * @param \Magento\Data\Form\FormKey $formKey + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Core\Helper\PostData $coreHelper */ public function __construct( \Magento\App\Helper\Context $context, @@ -119,7 +131,9 @@ class Compare extends \Magento\Core\Helper\Url \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Session $catalogSession, - \Magento\Data\Form\FormKey $formKey + \Magento\Data\Form\FormKey $formKey, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Core\Helper\PostData $coreHelper ) { $this->_itemCollectionFactory = $itemCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; @@ -127,6 +141,8 @@ class Compare extends \Magento\Core\Helper\Url $this->_customerSession = $customerSession; $this->_catalogSession = $catalogSession; $this->_formKey = $formKey; + $this->_wishlistHelper = $wishlistHelper; + $this->_coreHelper = $coreHelper; parent::__construct($context, $storeManager); } @@ -154,44 +170,38 @@ class Compare extends \Magento\Core\Helper\Url * Get parameters used for build add product to compare list urls * * @param \Magento\Catalog\Model\Product $product - * @return array + * @return string */ - protected function _getUrlParams($product) + public function getPostDataParams($product) { - return array( - 'product' => $product->getId(), - \Magento\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl(), - 'form_key' => $this->_formKey->getFormKey(), - ); + return $this->_coreHelper->getPostData($this->getAddUrl(), ['product' => $product->getId()]); } /** - * Retrieve url for adding product to conpare list + * Retrieve url for adding product to compare list * - * @param \Magento\Catalog\Model\Product $product * @return string */ - public function getAddUrl($product) + public function getAddUrl() { - return $this->_getUrl('catalog/product_compare/add', $this->_getUrlParams($product)); + return $this->_getUrl('catalog/product_compare/add'); } /** - * Retrieve add to wishlist url + * Retrieve add to wishlist params * * @param \Magento\Catalog\Model\Product $product * @return string */ - public function getAddToWishlistUrl($product) + public function getAddToWishlistParams($product) { $beforeCompareUrl = $this->_catalogSession->getBeforeCompareUrl(); - $params = array( - 'product'=>$product->getId(), + $encodedUrl = array( \Magento\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl) ); - return $this->_getUrl('wishlist/index/add', $params); + return $this->_wishlistHelper->getAddParams($product, $encodedUrl); } /** @@ -204,7 +214,7 @@ class Compare extends \Magento\Core\Helper\Url { $beforeCompareUrl = $this->_catalogSession->getBeforeCompareUrl(); $params = array( - 'product'=>$product->getId(), + 'product' => $product->getId(), \Magento\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl($beforeCompareUrl) ); @@ -214,16 +224,22 @@ class Compare extends \Magento\Core\Helper\Url /** * Retrieve remove item from compare list url * - * @param $item * @return string */ - public function getRemoveUrl($item) + public function getRemoveUrl() { - $params = array( - 'product'=>$item->getId(), - \Magento\App\Action\Action::PARAM_NAME_URL_ENCODED => $this->getEncodedUrl() - ); - return $this->_getUrl('catalog/product_compare/remove', $params); + return $this->_getUrl('catalog/product_compare/remove'); + } + + /** + * Get parameters to remove products from compare list + * + * @param \Magento\Catalog\Model\Product $product + * @return string + */ + public function getPostDataRemove($product) + { + return $this->_coreHelper->getPostData($this->getRemoveUrl(), ['product' => $product->getId()]); } /** diff --git a/app/code/Magento/Catalog/Helper/Product/Configuration.php b/app/code/Magento/Catalog/Helper/Product/Configuration.php index 4b8698ba86f..1d76313ee47 100644 --- a/app/code/Magento/Catalog/Helper/Product/Configuration.php +++ b/app/code/Magento/Catalog/Helper/Product/Configuration.php @@ -157,51 +157,6 @@ class Configuration extends \Magento\App\Helper\AbstractHelper return array_merge($attributes, $this->getCustomOptions($item)); } - /** - * Retrieves configuration options for grouped product - * - * @param \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface $item - * @return array - * @throws \Magento\Core\Exception - */ - public function getGroupedOptions(\Magento\Catalog\Model\Product\Configuration\Item\ItemInterface $item) - { - $product = $item->getProduct(); - $typeId = $product->getTypeId(); - if ($typeId != \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE) { - throw new \Magento\Core\Exception(__('The product type to extract configurable options is incorrect.')); - } - - $options = array(); - /** - * @var \Magento\Catalog\Model\Product\Type\Grouped - */ - $typeInstance = $product->getTypeInstance(); - $associatedProducts = $typeInstance->getAssociatedProducts($product); - - if ($associatedProducts) { - foreach ($associatedProducts as $associatedProduct) { - $qty = $item->getOptionByCode('associated_product_' . $associatedProduct->getId()); - $option = array( - 'label' => $associatedProduct->getName(), - 'value' => ($qty && $qty->getValue()) ? $qty->getValue() : 0 - ); - - $options[] = $option; - } - } - - $options = array_merge($options, $this->getCustomOptions($item)); - $isUnConfigured = true; - foreach ($options as &$option) { - if ($option['value']) { - $isUnConfigured = false; - break; - } - } - return $isUnConfigured ? array() : $options; - } - /** * Retrieves product options list * @@ -211,13 +166,8 @@ class Configuration extends \Magento\App\Helper\AbstractHelper public function getOptions(\Magento\Catalog\Model\Product\Configuration\Item\ItemInterface $item) { $typeId = $item->getProduct()->getTypeId(); - switch ($typeId) { - case \Magento\Catalog\Model\Product\Type\Configurable::TYPE_CODE: - return $this->getConfigurableOptions($item); - case \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE: - return $this->getGroupedOptions($item); - default: - break; + if ($typeId == \Magento\Catalog\Model\Product\Type\Configurable::TYPE_CODE) { + return $this->getConfigurableOptions($item); } return $this->getCustomOptions($item); } diff --git a/app/code/Magento/Catalog/Helper/Product/Options.php b/app/code/Magento/Catalog/Helper/Product/Options.php index 314090e9655..522ee1a0d46 100644 --- a/app/code/Magento/Catalog/Helper/Product/Options.php +++ b/app/code/Magento/Catalog/Helper/Product/Options.php @@ -43,12 +43,12 @@ class Options extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ - public function __construct(\Magento\App\Helper\Context $context, \Magento\Filesystem $filesystem) + public function __construct(\Magento\App\Helper\Context $context, \Magento\App\Filesystem $filesystem) { parent::__construct($context); - $this->directory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->directory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); } /** diff --git a/app/code/Magento/Catalog/Helper/Product/Price.php b/app/code/Magento/Catalog/Helper/Product/Price.php new file mode 100644 index 00000000000..3cbedaa549f --- /dev/null +++ b/app/code/Magento/Catalog/Helper/Product/Price.php @@ -0,0 +1,152 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + + +/** + * Collection of tax module calls + * + * @category Magento + * @package Magento_Catalog + * @author Magento Core Team <core@magentocommerce.com> + */ +namespace Magento\Catalog\Helper\Product; + +class Price extends \Magento\App\Helper\AbstractHelper +{ + /** + * @var \Magento\Tax\Helper\Data + */ + protected $taxData; + + /** + * @var \Magento\Tax\Model\Calculation + */ + protected $taxCalculation; + + /** + * @param \Magento\Tax\Helper\Data $taxData + * @param \Magento\Tax\Model\Calculation $taxCalculation + */ + public function __construct( + \Magento\Tax\Helper\Data $taxData, + \Magento\Tax\Model\Calculation $taxCalculation + ) { + $this->taxData = $taxData; + $this->taxCalculation = $taxCalculation; + } + + /** + * Get product price with all tax settings processing + * + * @param $_product + * @param $_minimalPriceValue + * @param null $includingTax + * @return float + */ + public function getPrice($_product, $_minimalPriceValue, $includingTax = null) + { + return $this->taxData->getPrice($_product, $_minimalPriceValue, $includingTax); + } + + /** + * Check if we have display in catalog prices including and excluding tax + * + * @return bool + */ + public function displayBothPrices() + { + return $this->taxData->displayBothPrices(); + } + + /** + * Check if we have display in catalog prices including tax + * + * @return bool + */ + public function displayPriceIncludingTax() + { + return $this->taxData->displayPriceIncludingTax(); + } + + /** + * Check if product prices on input include tax + * + * @return bool + */ + public function priceIncludesTax() + { + return $this->taxData->priceIncludesTax(); + } + + /** + * Get customer object + * + * @return bool|\Magento\Customer\Model\Customer + */ + public function getCustomer() + { + return $this->taxCalculation->getCustomer(); + } + + /** + * Specify customer object which can be used for rate calculation + * + * @param \Magento\Customer\Model\Customer $customer + * @return $this + */ + public function setCustomer(\Magento\Customer\Model\Customer $customer) + { + $this->taxCalculation->setCustomer($customer); + return $this; + } + + /** + * Get request object with information necessary for getting tax rate + * + * @param null|bool|\Magento\Object $shippingAddress + * @param null|bool||\Magento\Object $billingAddress + * @param null|int $customerTaxClass + * @param null|int $store + * @return \Magento\Object + */ + public function getRateRequest( + $shippingAddress = null, + $billingAddress = null, + $customerTaxClass = null, + $store = null + ) { + return $this->taxCalculation->getRateRequest($shippingAddress, $billingAddress, $customerTaxClass, $store); + } + + /** + * Get calculation tax rate by specific request + * + * @param \Magento\Object $request + * @return float + */ + public function getRate($request) + { + return $this->taxCalculation->getRate($request); + } +} diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php index 2123d7d56cf..e51f59299af 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Image.php @@ -44,7 +44,7 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend /** * Filesystem facade * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -59,12 +59,12 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Construct * * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory */ public function __construct( \Magento\Logger $logger, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory ) { $this->_filesystem = $filesystem; @@ -94,7 +94,7 @@ class Image extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend return $this; } - $path = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA)->getAbsolutePath('catalog/category/'); + $path = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR)->getAbsolutePath('catalog/category/'); try { /** @var $uploader \Magento\Core\Model\File\Uploader */ diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index c1516b3bf3d..3eafc73268b 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -205,15 +205,10 @@ class Product extends \Magento\Catalog\Model\AbstractModel */ protected $_itemOptionFactory; - /** - * @var \Magento\App\State - */ - protected $_appState; - /** * Filesystem facade * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -239,7 +234,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel * @param Resource\Product $resource * @param Resource\Product\Collection $resourceCollection * @param \Magento\Data\CollectionFactory $collectionFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -266,7 +261,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel \Magento\Catalog\Model\Resource\Product $resource, \Magento\Catalog\Model\Resource\Product\Collection $resourceCollection, \Magento\Data\CollectionFactory $collectionFactory, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, array $data = array() ) { $this->_itemOptionFactory = $itemOptionFactory; @@ -1070,23 +1065,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel $collection->joinAttributes(); return $collection; } - - /** - * Retrieve collection grouped link - * - * @return \Magento\Catalog\Model\Resource\Product\Link\Collection - */ - public function getGroupedLinkCollection() - { - $collection = $this->getLinkInstance()->useGroupedLinks() - ->getLinkCollection(); - $collection->setProduct($this); - $collection->addLinkTypeIdFilter(); - $collection->addProductIdFilter(); - $collection->joinAttributes(); - return $collection; - } - /******************************************************************************* ** Media API */ @@ -1116,7 +1094,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel */ public function getMediaGalleryImages() { - $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + $directory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); if(!$this->hasData('media_gallery_images') && is_array($this->getMediaGallery('images'))) { $images = $this->_collectionFactory->create(); foreach ($this->getMediaGallery('images') as $image) { @@ -1166,137 +1144,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel return $this->_catalogProductMediaConfig; } - /** - * Create duplicate - * - * @return \Magento\Catalog\Model\Product - */ - public function duplicate() - { - $this->getWebsiteIds(); - $this->getCategoryIds(); - - /* @var $newProduct \Magento\Catalog\Model\Product */ - $newProduct = $this->_productFactory->create()->setData($this->getData()) - ->setIsDuplicate(true) - ->setOriginalId($this->getId()) - ->setStatus(\Magento\Catalog\Model\Product\Status::STATUS_DISABLED) - ->setCreatedAt(null) - ->setUpdatedAt(null) - ->setId(null) - ->setStoreId(\Magento\Core\Model\Store::DEFAULT_STORE_ID); - - $this->_eventManager->dispatch( - 'catalog_model_product_duplicate', - array('current_product' => $this, 'new_product' => $newProduct) - ); - - /* Prepare Related*/ - $data = array(); - $this->getLinkInstance()->useRelatedLinks(); - $attributes = array(); - foreach ($this->getLinkInstance()->getAttributes() as $_attribute) { - if (isset($_attribute['code'])) { - $attributes[] = $_attribute['code']; - } - } - foreach ($this->getRelatedLinkCollection() as $_link) { - $data[$_link->getLinkedProductId()] = $_link->toArray($attributes); - } - $newProduct->setRelatedLinkData($data); - - /* Prepare UpSell*/ - $data = array(); - $this->getLinkInstance()->useUpSellLinks(); - $attributes = array(); - foreach ($this->getLinkInstance()->getAttributes() as $_attribute) { - if (isset($_attribute['code'])) { - $attributes[] = $_attribute['code']; - } - } - foreach ($this->getUpSellLinkCollection() as $_link) { - $data[$_link->getLinkedProductId()] = $_link->toArray($attributes); - } - $newProduct->setUpSellLinkData($data); - - /* Prepare Cross Sell */ - $data = array(); - $this->getLinkInstance()->useCrossSellLinks(); - $attributes = array(); - foreach ($this->getLinkInstance()->getAttributes() as $_attribute) { - if (isset($_attribute['code'])) { - $attributes[] = $_attribute['code']; - } - } - foreach ($this->getCrossSellLinkCollection() as $_link) { - $data[$_link->getLinkedProductId()] = $_link->toArray($attributes); - } - $newProduct->setCrossSellLinkData($data); - - /* Prepare Grouped */ - $data = array(); - $this->getLinkInstance()->useGroupedLinks(); - $attributes = array(); - foreach ($this->getLinkInstance()->getAttributes() as $_attribute) { - if (isset($_attribute['code'])) { - $attributes[] = $_attribute['code']; - } - } - foreach ($this->getGroupedLinkCollection() as $_link) { - $data[$_link->getLinkedProductId()] = $_link->toArray($attributes); - } - $newProduct->setGroupedLinkData($data); - - $newProduct->save(); - - $this->getOptionInstance()->duplicate($this->getId(), $newProduct->getId()); - $this->getResource()->duplicate($this->getId(), $newProduct->getId()); - - // TODO - duplicate product on all stores of the websites it is associated with - /*if ($storeIds = $this->getWebsiteIds()) { - foreach ($storeIds as $storeId) { - $this->setStoreId($storeId) - ->load($this->getId()); - - $newProduct->setData($this->getData()) - ->setSku(null) - ->setStatus(\Magento\Catalog\Model\Product\Status::STATUS_DISABLED) - ->setId($newId) - ->save(); - } - }*/ - return $newProduct; - } - - /** - * Is product grouped - * - * @return bool - */ - public function isSuperGroup() - { - return $this->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_GROUPED; - } - - /** - * Alias for isConfigurable() - * - * @return bool - */ - public function isSuperConfig() - { - return $this->isConfigurable(); - } - /** - * Check is product grouped - * - * @return bool - */ - public function isGrouped() - { - return $this->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_GROUPED; - } - /** * Check is product configurable * @@ -1307,16 +1154,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel return $this->getTypeId() == \Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE; } - /** - * Whether product configurable or grouped - * - * @return bool - */ - public function isSuper() - { - return $this->isConfigurable() || $this->isGrouped(); - } - /** * Returns visible status IDs in catalog * @@ -1487,7 +1324,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel /** * Get attribute text by its code * - * @param $attributeCode Code of the attribute + * @param string $attributeCode Code of the attribute * @return string */ public function getAttributeText($attributeCode) @@ -1880,9 +1717,9 @@ class Product extends \Magento\Catalog\Model\AbstractModel } /** - * Returns system reserved attribute codes + * Returns system reserved attribute codes * - * @return array Reserved attribute names + * @return array Reserved attribute names */ public function getReservedAttributes() { @@ -1905,10 +1742,10 @@ class Product extends \Magento\Catalog\Model\AbstractModel } /** - * Check whether attribute reserved or not + * Check whether attribute reserved or not * - * @param \Magento\Catalog\Model\Entity\Attribute $attribute Attribute model object - * @return boolean + * @param \Magento\Catalog\Model\Entity\Attribute $attribute Attribute model object + * @return boolean */ public function isReservedAttribute ($attribute) { @@ -2019,12 +1856,12 @@ class Product extends \Magento\Catalog\Model\AbstractModel */ public function getPreconfiguredValues() { - $preconfiguredValues = $this->getData('preconfigured_values'); - if (!$preconfiguredValues) { - $preconfiguredValues = new \Magento\Object(); + $preConfiguredValues = $this->getData('preconfigured_values'); + if (!$preConfiguredValues) { + $preConfiguredValues = new \Magento\Object(); } - return $preconfiguredValues; + return $preConfiguredValues; } /** @@ -2062,8 +1899,8 @@ class Product extends \Magento\Catalog\Model\AbstractModel */ protected function _clearData() { - foreach ($this->_data as $data){ - if (is_object($data) && method_exists($data, 'reset')){ + foreach ($this->_data as $data) { + if (is_object($data) && method_exists($data, 'reset')) { $data->reset(); } } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php index 234bbcd5827..95affc66f28 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php @@ -91,7 +91,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Catalog\Model\Product\Media\Config $mediaConfig - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $resourceProductAttribute */ public function __construct( @@ -101,7 +101,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend \Magento\Core\Helper\File\Storage\Database $fileStorageDb, \Magento\Core\Helper\Data $coreData, \Magento\Catalog\Model\Product\Media\Config $mediaConfig, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $resourceProductAttribute ) { $this->_productFactory = $productFactory; @@ -110,7 +110,7 @@ class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $this->_coreData = $coreData; $this->_resourceModel = $resourceProductAttribute; $this->_mediaConfig = $mediaConfig; - $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_mediaDirectory->create($this->_mediaConfig->getBaseMediaPath()); $this->_mediaDirectory->create($this->_mediaConfig->getBaseTmpMediaPath()); diff --git a/app/code/Magento/Catalog/Model/Product/Copier.php b/app/code/Magento/Catalog/Model/Product/Copier.php new file mode 100644 index 00000000000..759701f8e3f --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Copier.php @@ -0,0 +1,81 @@ +<?php +/** + * Catalog product copier. Creates product duplicate + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Product; + +class Copier +{ + /** + * @var CopyConstructorInterface + */ + protected $copyConstructor; + + /** + * @var \Magento\Catalog\Model\ProductFactory + */ + protected $productFactory; + + /** + * @param CopyConstructorInterface $copyConstructor + * @param \Magento\Catalog\Model\ProductFactory $productFactory + */ + public function __construct( + CopyConstructorInterface $copyConstructor, + \Magento\Catalog\Model\ProductFactory $productFactory + ) { + $this->productFactory = $productFactory; + $this->copyConstructor = $copyConstructor; + } + + /** + * Create product duplicate + * + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\Catalog\Model\Product + */ + public function copy(\Magento\Catalog\Model\Product $product) + { + $product->getWebsiteIds(); + $product->getCategoryIds(); + + $duplicate = $this->productFactory->create(); + $duplicate->setData($product->getData()); + $duplicate->setIsDuplicate(true); + $duplicate->setOriginalId($product->getId()); + $duplicate->setStatus(\Magento\Catalog\Model\Product\Status::STATUS_DISABLED); + $duplicate->setCreatedAt(null); + $duplicate->setUpdatedAt(null); + $duplicate->setId(null); + $duplicate->setStoreId(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + + $this->copyConstructor->build($product, $duplicate); + $duplicate->save(); + + $product->getOptionInstance()->duplicate($product->getId(), $duplicate->getId()); + $product->getResource()->duplicate($product->getId(), $duplicate->getId()); + return $duplicate; + } +} diff --git a/app/code/Magento/Catalog/Model/Product/CopyConstructor/Composite.php b/app/code/Magento/Catalog/Model/Product/CopyConstructor/Composite.php new file mode 100644 index 00000000000..d52fedd25ac --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/CopyConstructor/Composite.php @@ -0,0 +1,60 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Product\CopyConstructor; + +use Magento\Catalog\Model\Product\CopyConstructorInterface; +use Magento\Catalog\Model\Product\CopyConstructorFactory; + +class Composite implements CopyConstructorInterface +{ + /** + * @var CopyConstructorInterface[] + */ + protected $constructors; + + /** + * @param CopyConstructorFactory $factory + * @param array $constructors + */ + public function __construct(CopyConstructorFactory $factory, array $constructors = array()) + { + foreach ($constructors as $instance) { + $this->constructors[] = $factory->create($instance); + } + } + + /** + * Build product duplicate + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $duplicate + */ + public function build(\Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate) + { + foreach ($this->constructors as $constructor) { + $constructor->build($product, $duplicate); + } + } +} diff --git a/app/code/Magento/Catalog/Model/Product/CopyConstructor/CrossSell.php b/app/code/Magento/Catalog/Model/Product/CopyConstructor/CrossSell.php new file mode 100644 index 00000000000..fa2ca0dcaaa --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/CopyConstructor/CrossSell.php @@ -0,0 +1,52 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Product\CopyConstructor; + +class CrossSell implements \Magento\Catalog\Model\Product\CopyConstructorInterface +{ + /** + * Build product links + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $duplicate + */ + public function build(\Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate) + { + $data = array(); + $attributes = array(); + $link = $product->getLinkInstance(); + $link->useCrossSellLinks(); + foreach ($link->getAttributes() as $attribute) { + if (isset($attribute['code'])) { + $attributes[] = $attribute['code']; + } + } + /** @var \Magento\Catalog\Model\Product\Link $link */ + foreach ($product->getCrossSellLinkCollection() as $link) { + $data[$link->getLinkedProductId()] = $link->toArray($attributes); + } + $duplicate->setCrossSellLinkData($data); + } +} diff --git a/app/code/Magento/Catalog/Model/Product/CopyConstructor/Related.php b/app/code/Magento/Catalog/Model/Product/CopyConstructor/Related.php new file mode 100644 index 00000000000..a5c31177e02 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/CopyConstructor/Related.php @@ -0,0 +1,53 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Product\CopyConstructor; + +class Related implements \Magento\Catalog\Model\Product\CopyConstructorInterface +{ + /** + * Build product links + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $duplicate + */ + public function build(\Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate) + { + $data = array(); + $attributes = array(); + + $link = $product->getLinkInstance(); + $link->useRelatedLinks(); + foreach ($link->getAttributes() as $attribute) { + if (isset($attribute['code'])) { + $attributes[] = $attribute['code']; + } + } + /** @var \Magento\Catalog\Model\Product\Link $link */ + foreach ($product->getRelatedLinkCollection() as $link) { + $data[$link->getLinkedProductId()] = $link->toArray($attributes); + } + $duplicate->setRelatedLinkData($data); + } +} diff --git a/app/code/Magento/Catalog/Model/Product/CopyConstructor/UpSell.php b/app/code/Magento/Catalog/Model/Product/CopyConstructor/UpSell.php new file mode 100644 index 00000000000..0408c85c32c --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/CopyConstructor/UpSell.php @@ -0,0 +1,52 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Product\CopyConstructor; + +class UpSell implements \Magento\Catalog\Model\Product\CopyConstructorInterface +{ + /** + * Build product links + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $duplicate + */ + public function build(\Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate) + { + $data = array(); + $link = $product->getLinkInstance(); + $link->useUpSellLinks(); + $attributes = array(); + foreach ($link->getAttributes() as $attribute) { + if (isset($attribute['code'])) { + $attributes[] = $attribute['code']; + } + } + /** @var \Magento\Catalog\Model\Product\Link $link */ + foreach ($product->getUpSellLinkCollection() as $link) { + $data[$link->getLinkedProductId()] = $link->toArray($attributes); + } + $duplicate->setUpSellLinkData($data); + } +} diff --git a/app/code/Magento/Sales/Model/ResourceFactory.php b/app/code/Magento/Catalog/Model/Product/CopyConstructorFactory.php similarity index 60% rename from app/code/Magento/Sales/Model/ResourceFactory.php rename to app/code/Magento/Catalog/Model/Product/CopyConstructorFactory.php index 6a72ad61d16..f2be9544ceb 100644 --- a/app/code/Magento/Sales/Model/ResourceFactory.php +++ b/app/code/Magento/Catalog/Model/Product/CopyConstructorFactory.php @@ -18,45 +18,43 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Sales * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Factory class for \Magento\Core\Model\Resource\Db\AbstractDb - */ -namespace Magento\Sales\Model; +namespace Magento\Catalog\Model\Product; -class ResourceFactory +class CopyConstructorFactory { /** - * Object Manager instance - * * @var \Magento\ObjectManager */ - protected $_objectManager = null; + protected $objectManager; /** - * Factory constructor - * * @param \Magento\ObjectManager $objectManager */ public function __construct(\Magento\ObjectManager $objectManager) { - $this->_objectManager = $objectManager; + $this->objectManager = $objectManager; } /** - * Create class instance with specified parameters + * Create link builder instance * - * @param string $instanceName - * @param array $data - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param string $instance + * @param array $arguments + * @return CopyConstructorInterface + * @throws \InvalidArgumentException */ - public function create($instanceName, array $data = array()) + public function create($instance, array $arguments = array()) { - return $this->_objectManager->create($instanceName, $data); + if (!is_subclass_of($instance, '\Magento\Catalog\Model\Product\CopyConstructorInterface')) { + throw new \InvalidArgumentException( + $instance . ' does not implement \Magento\Catalog\Model\Product\CopyConstructorInterface' + ); + } + + return $this->objectManager->create($instance, $arguments); } -} +} diff --git a/app/code/Magento/Core/Model/DataService/ConfigInterface.php b/app/code/Magento/Catalog/Model/Product/CopyConstructorInterface.php similarity index 73% rename from app/code/Magento/Core/Model/DataService/ConfigInterface.php rename to app/code/Magento/Catalog/Model/Product/CopyConstructorInterface.php index 296bd5f558d..2688fc7f762 100644 --- a/app/code/Magento/Core/Model/DataService/ConfigInterface.php +++ b/app/code/Magento/Catalog/Model/Product/CopyConstructorInterface.php @@ -1,7 +1,5 @@ <?php /** - * Used to get class information associated with an alias, and stored in config files. - * * Magento * * NOTICE OF LICENSE @@ -23,15 +21,16 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\DataService; -interface ConfigInterface +namespace Magento\Catalog\Model\Product; + +interface CopyConstructorInterface { /** - * Get the class information for a given service call + * Build product duplicate * - * @param $alias - * @return mixed + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $duplicate */ - public function getClassByAlias($alias); -} + public function build(\Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate); +} diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 5b8d4a0163c..54461a0d16e 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -114,7 +114,7 @@ class Image extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Image\Factory $imageFactory * @param \Magento\View\Url $viewUrl * @param \Magento\View\FileSystem $viewFileSystem @@ -129,7 +129,7 @@ class Image extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Media\Config $catalogProductMediaConfig, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Image\Factory $imageFactory, \Magento\View\Url $viewUrl, \Magento\View\FileSystem $viewFileSystem, @@ -142,7 +142,7 @@ class Image extends \Magento\Core\Model\AbstractModel $this->_catalogProductMediaConfig = $catalogProductMediaConfig; $this->_coreFileStorageDatabase = $coreFileStorageDatabase; parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_mediaDirectory->create($this->_catalogProductMediaConfig->getBaseMediaPath()); $this->_imageFactory = $imageFactory; $this->_viewUrl = $viewUrl; diff --git a/app/code/Magento/Catalog/Model/Product/Link.php b/app/code/Magento/Catalog/Model/Product/Link.php index 6eb89357af0..7b3e099bc0a 100644 --- a/app/code/Magento/Catalog/Model/Product/Link.php +++ b/app/code/Magento/Catalog/Model/Product/Link.php @@ -46,7 +46,6 @@ namespace Magento\Catalog\Model\Product; class Link extends \Magento\Core\Model\AbstractModel { const LINK_TYPE_RELATED = 1; - const LINK_TYPE_GROUPED = 3; const LINK_TYPE_UPSELL = 4; const LINK_TYPE_CROSSSELL = 5; @@ -103,12 +102,6 @@ class Link extends \Magento\Core\Model\AbstractModel return $this; } - public function useGroupedLinks() - { - $this->setLinkTypeId(self::LINK_TYPE_GROUPED); - return $this; - } - public function useUpSellLinks() { $this->setLinkTypeId(self::LINK_TYPE_UPSELL); @@ -185,19 +178,4 @@ class Link extends \Magento\Core\Model\AbstractModel } return $this; } - - /** - * Save grouped product relation links - * - * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Catalog\Model\Product\Link - */ - public function saveGroupedLinks($product) - { - $data = $product->getGroupedLinkData(); - if (!is_null($data)) { - $this->_getResource()->saveGroupedLinks($product, $data, self::LINK_TYPE_GROUPED); - } - return $this; - } } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index 3f156c823af..7522fa5dfdf 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -47,7 +47,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType protected $_formattedOptionValue = null; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -120,7 +120,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * @param \Magento\UrlInterface $url * @param \Magento\Escaper $escaper * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\File\Size $fileSize * @param array $data */ @@ -131,7 +131,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType \Magento\UrlInterface $url, \Magento\Escaper $escaper, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\File\Size $fileSize, array $data = array() ) { @@ -140,8 +140,8 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $this->_escaper = $escaper; $this->_coreFileStorageDatabase = $coreFileStorageDatabase; $this->_filesystem = $filesystem; - $this->_rootDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); - $this->_mediaDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_rootDirectory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); + $this->_mediaDirectory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_fileSize = $fileSize; $this->_data = $data; parent::__construct($checkoutSession, $coreStoreConfig, $data); @@ -372,7 +372,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $filePath = $dispersion; - $tmpDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::SYS_TMP); + $tmpDirectory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::SYS_TMP_DIR); $fileHash = md5($tmpDirectory->readFile($tmpDirectory->getRelativePath($fileInfo['tmp_name']))); $filePath .= '/' . $fileHash . '.' . $extension; $fileFullPath = $this->_mediaDirectory->getAbsolutePath($this->_quotePath . $filePath); @@ -400,7 +400,7 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType $_height = $_imageSize[1]; } } - $uri = $this->_filesystem->getUri(\Magento\Filesystem::MEDIA); + $uri = $this->_filesystem->getUri(\Magento\App\Filesystem::MEDIA_DIR); $this->setUserValue(array( 'type' => $fileInfo['type'], 'title' => $fileInfo['name'], diff --git a/app/code/Magento/Catalog/Model/Product/Type.php b/app/code/Magento/Catalog/Model/Product/Type.php index 3049fe90d1e..0dfed06d58a 100644 --- a/app/code/Magento/Catalog/Model/Product/Type.php +++ b/app/code/Magento/Catalog/Model/Product/Type.php @@ -37,7 +37,6 @@ class Type const TYPE_SIMPLE = 'simple'; const TYPE_BUNDLE = 'bundle'; const TYPE_CONFIGURABLE = 'configurable'; - const TYPE_GROUPED = 'grouped'; const TYPE_VIRTUAL = 'virtual'; /**#@-*/ diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index d6df6d14a4d..9899651f0a1 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -107,7 +107,7 @@ abstract class AbstractType const OPTION_PREFIX = 'option_'; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -185,7 +185,7 @@ abstract class AbstractType * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Logger $logger * @param array $data @@ -198,7 +198,7 @@ abstract class AbstractType \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\Data $coreData, \Magento\Core\Helper\File\Storage\Database $fileStorageDb, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, \Magento\Logger $logger, array $data = array() @@ -384,13 +384,13 @@ abstract class AbstractType return $options; } // try to found super product configuration - // (if product was buying within grouped product) $superProductConfig = $buyRequest->getSuperProductConfig(); if (!empty($superProductConfig['product_id']) && !empty($superProductConfig['product_type']) ) { $superProductId = (int)$superProductConfig['product_id']; if ($superProductId) { + /** @var \Magento\Catalog\Model\Product $superProduct */ $superProduct = $this->_coreRegistry->registry('used_super_product_' . $superProductId); if (!$superProduct) { $superProduct = $this->_productFactory->create()->load($superProductId); @@ -505,7 +505,7 @@ abstract class AbstractType $path = dirname($dst); try { - $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT)->create($path); + $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR)->create($path); } catch (\Magento\Filesystem\FilesystemException $e) { throw new \Magento\Core\Exception( __("We can't create writeable directory \"%1\".", $path) @@ -731,7 +731,7 @@ abstract class AbstractType } /** - * Check if product is composite (grouped, configurable, etc) + * Check if product is composite * * @param \Magento\Catalog\Model\Product $product * @return bool diff --git a/app/code/Magento/Catalog/Model/Product/Type/Configurable.php b/app/code/Magento/Catalog/Model/Product/Type/Configurable.php index 1ec1638acf9..40e1ae1fcc4 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Configurable.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Configurable.php @@ -170,7 +170,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Logger $logger * @param \Magento\Catalog\Model\Resource\Product\Type\ConfigurableFactory $typeConfigurableFactory @@ -194,7 +194,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\Data $coreData, \Magento\Core\Helper\File\Storage\Database $fileStorageDb, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, \Magento\Logger $logger, \Magento\Catalog\Model\Resource\Product\Type\ConfigurableFactory $typeConfigurableFactory, diff --git a/app/code/Magento/Catalog/Model/ProductTypes/Config.php b/app/code/Magento/Catalog/Model/ProductTypes/Config.php index f69158e3f42..3e68285f783 100644 --- a/app/code/Magento/Catalog/Model/ProductTypes/Config.php +++ b/app/code/Magento/Catalog/Model/ProductTypes/Config.php @@ -23,9 +23,7 @@ */ namespace Magento\Catalog\Model\ProductTypes; -class Config - extends \Magento\Config\Data - implements \Magento\Catalog\Model\ProductTypes\ConfigInterface +class Config extends \Magento\Config\Data implements \Magento\Catalog\Model\ProductTypes\ConfigInterface { /** * @param \Magento\Catalog\Model\ProductTypes\Config\Reader $reader @@ -60,4 +58,15 @@ class Config { return $this->get(); } + + /** + * Check whether product type is set of products + * + * @param string $typeId + * @return bool + */ + public function isProductSet($typeId) + { + return $this->get($typeId . '/is_product_set', false); + } } diff --git a/app/code/Magento/Catalog/Model/ProductTypes/ConfigInterface.php b/app/code/Magento/Catalog/Model/ProductTypes/ConfigInterface.php index bf31993ff22..f868e70e811 100644 --- a/app/code/Magento/Catalog/Model/ProductTypes/ConfigInterface.php +++ b/app/code/Magento/Catalog/Model/ProductTypes/ConfigInterface.php @@ -39,4 +39,12 @@ interface ConfigInterface * @return array */ public function getAll(); + + /** + * Check whether product type is set of products + * + * @param string $typeId + * @return bool + */ + public function isProductSet($typeId); } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php index 1fe9b43ca53..b50c1e55259 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php @@ -40,7 +40,7 @@ class Image /** * Filesystem facade * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -53,12 +53,12 @@ class Image /** * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory */ public function __construct( \Magento\Logger $logger, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory ) { $this->_filesystem = $filesystem; @@ -92,7 +92,7 @@ class Image } catch (\Exception $e){ return $this; } - $path = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA)->getAbsolutePath('catalog/product/'); + $path = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR)->getAbsolutePath('catalog/product/'); $uploader->save($path); $fileName = $uploader->getUploadedFileName(); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Link.php b/app/code/Magento/Catalog/Model/Resource/Product/Link.php index 84972ad78ef..0a873217447 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Link.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Link.php @@ -100,7 +100,7 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb $links = $adapter->fetchPairs($select, $bind); $deleteIds = array(); - foreach($links as $linkedProductId => $linkId) { + foreach ($links as $linkedProductId => $linkId) { if (!isset($data[$linkedProductId])) { $deleteIds[] = (int)$linkId; } @@ -220,13 +220,6 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb ->from(array('l' => $this->getMainTable()), array('linked_product_id')) ->where('product_id = :product_id') ->where('link_type_id = :link_type_id'); - if ($typeId == \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED) { - $select->join( - array('e' => $this->getTable('catalog_product_entity')), - 'e.entity_id = l.linked_product_id AND e.required_options = 0', - array() - ); - } $childrenIds[$typeId] = array(); $result = $adapter->fetchAll($select, $bind); @@ -260,40 +253,4 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb return $parentIds; } - - /** - * Save grouped product relations - * - * @param \Magento\Catalog\Model\Product $product - * @param array $data - * @param int $typeId - * @return \Magento\Catalog\Model\Resource\Product\Link - */ - public function saveGroupedLinks($product, $data, $typeId) - { - $adapter = $this->_getWriteAdapter(); - // check for change relations - $bind = array( - 'product_id' => (int)$product->getId(), - 'link_type_id' => (int)$typeId - ); - $select = $adapter->select() - ->from($this->getMainTable(), array('linked_product_id')) - ->where('product_id = :product_id') - ->where('link_type_id = :link_type_id'); - $old = $adapter->fetchCol($select, $bind); - $new = array_keys($data); - - if (array_diff($old, $new) || array_diff($new, $old)) { - $product->setIsRelationsChanged(true); - } - - // save product links attributes - $this->saveProductLinks($product, $data, $typeId); - - // Grouped product relations should be added to relation table - $this->_catalogProductRelation->processRelations($product->getId(), $new); - - return $this; - } } diff --git a/app/code/Magento/Catalog/Model/Resource/Setup.php b/app/code/Magento/Catalog/Model/Resource/Setup.php index 1ca9f5cc2e6..02f45a46f02 100755 --- a/app/code/Magento/Catalog/Model/Resource/Setup.php +++ b/app/code/Magento/Catalog/Model/Resource/Setup.php @@ -61,7 +61,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup * @param \Magento\Core\Model\Resource\Setup\Context $context * @param string $resourceName * @param \Magento\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Index\Model\IndexerFactory $indexerFactory * @param \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeResourceFactory @@ -72,7 +72,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup \Magento\Core\Model\Resource\Setup\Context $context, $resourceName, \Magento\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Index\Model\IndexerFactory $indexerFactory, \Magento\Catalog\Model\Resource\Eav\AttributeFactory $eavAttributeResourceFactory, @@ -82,7 +82,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup $this->_categoryFactory = $categoryFactory; $this->_indexerFactory = $indexerFactory; $this->_eavAttributeResourceFactory = $eavAttributeResourceFactory; - parent::__construct($context, $resourceName, $cache, $attrGrCollFactory, $moduleName, $connectionName); + parent::__construct($context, $resourceName, $cache, $attrGroupCollectionFactory, $moduleName, $connectionName); } /** diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php b/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php index e24c3f8b947..8c564c3213d 100644 --- a/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php +++ b/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php @@ -146,10 +146,6 @@ $data = array( 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, 'code' => 'relation' ), - array( - 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED, - 'code' => 'super' - ), array( 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, 'code' => 'up_sell' @@ -173,16 +169,6 @@ $data = array( 'product_link_attribute_code' => 'position', 'data_type' => 'int' ), - array( - 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED, - 'product_link_attribute_code' => 'position', - 'data_type' => 'int' - ), - array( - 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED, - 'product_link_attribute_code' => 'qty', - 'data_type' => 'decimal' - ), array( 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, 'product_link_attribute_code' => 'position', diff --git a/app/code/Magento/Catalog/etc/adminhtml/di.xml b/app/code/Magento/Catalog/etc/adminhtml/di.xml index 4fa0e8bb974..8569d947310 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/di.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/di.xml @@ -24,7 +24,6 @@ */ --> <config> - <preference for="Magento\Catalog\Model\Product\Type\Grouped" type="Magento\Catalog\Model\Product\Type\Grouped\Backend" /> <type name="Magento\Catalog\Controller\Adminhtml\Product\Attribute"> <param name="attributeLabelCache"> <instance type="Magento\App\Cache\Type\Translate" /> @@ -62,4 +61,21 @@ <value type="bool">false</value> </param> </type> + <type name="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper"> + <plugin name="configurable" type="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Configurable" sortOrder="50" /> + </type> + <type name="Magento\Catalog\Model\Product\CopyConstructor\Composite"> + <param name="constructors"> + <value> + <crossSell>Magento\Catalog\Model\Product\CopyConstructor\CrossSell</crossSell> + <upSell>Magento\Catalog\Model\Product\CopyConstructor\UpSell</upSell> + <related>Magento\Catalog\Model\Product\CopyConstructor\Related</related> + </value> + </param> + </type> + <type name="Magento\Catalog\Model\Product\Copier"> + <param name="copyConstructor"> + <instance type="Magento\Catalog\Model\Product\CopyConstructor\Composite" /> + </param> + </type> </config> diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index ad3de957412..e7c9201c9c6 100755 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -53,6 +53,8 @@ <module name="Magento_Sales"/> <module name="Magento_CatalogSearch"/> <module name="Magento_Weee"/> + <module name="Magento_ProductAlert"/> + <module name="Magento_Rating"/> </depends> </module> </config> diff --git a/app/code/Magento/Catalog/etc/product_types.xml b/app/code/Magento/Catalog/etc/product_types.xml index 4031330f6a6..a4e0ddc487a 100644 --- a/app/code/Magento/Catalog/etc/product_types.xml +++ b/app/code/Magento/Catalog/etc/product_types.xml @@ -25,14 +25,6 @@ --> <config> <type name="simple" label="Simple Product" modelInstance="Magento\Catalog\Model\Product\Type\Simple" indexPriority="10" /> - <type name="grouped" label="Grouped Product" modelInstance="Magento\Catalog\Model\Product\Type\Grouped" composite='true' indexPriority="50"> - <priceModel instance="Magento\Catalog\Model\Product\Type\Grouped\Price" /> - <indexerModel instance="Magento\Catalog\Model\Resource\Product\Indexer\Price\Grouped" /> - <allowProductTypes> - <type name="simple" /> - <type name="virtual" /> - </allowProductTypes> - </type> <type name="configurable" label="Configurable Product" modelInstance="Magento\Catalog\Model\Product\Type\Configurable" composite='true' indexPriority="30"> <priceModel instance="Magento\Catalog\Model\Product\Type\Configurable\Price" /> <indexerModel instance="Magento\Catalog\Model\Resource\Product\Indexer\Price\Configurable" /> diff --git a/app/code/Magento/Catalog/i18n/de_DE.csv b/app/code/Magento/Catalog/i18n/de_DE.csv index e5e3e7aa707..8ae7321172c 100644 --- a/app/code/Magento/Catalog/i18n/de_DE.csv +++ b/app/code/Magento/Catalog/i18n/de_DE.csv @@ -146,7 +146,6 @@ "Catalog Product Link","Link zu den Produkten im Katalog" "Catalog Product View (Any)","Produktansicht des Katalogs (beliebig)" "Catalog Product View (Configurable)","Produktansicht des Katalogs (konfigurierbar)" -"Catalog Product View (Grouped)","Produktansicht des Katalogs (in Gruppen)" "Catalog Product View (Simple)","Produktansicht des Katalogs (vereinfacht)" "Catalog Product View (Virtual)","Produktansicht des Katalogs (virtuell)" "Catalog Section","Katalogabschnitt" @@ -313,7 +312,6 @@ "Grid","Raster" "Group add","Gruppe hinzufügen" "Group remove","Gruppe entfernen" -"Grouped Product","Gruppiertes Produkt" "Groups","Gruppen" "Home","Startseite" "ID","ID" diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv index ebe78d4e2c8..a76ec9887fb 100644 --- a/app/code/Magento/Catalog/i18n/en_US.csv +++ b/app/code/Magento/Catalog/i18n/en_US.csv @@ -147,7 +147,6 @@ "Catalog Product Link","Catalog Product Link" "Catalog Product View (Any)","Catalog Product View (Any)" "Catalog Product View (Configurable)","Catalog Product View (Configurable)" -"Catalog Product View (Grouped)","Catalog Product View (Grouped)" "Catalog Product View (Simple)","Catalog Product View (Simple)" "Catalog Product View (Virtual)","Catalog Product View (Virtual)" "Catalog Section","Catalog Section" @@ -314,7 +313,6 @@ "Grid","Grid" "Group add","Group add" "Group remove","Group remove" -"Grouped Product","Grouped Product" "Groups","Groups" "Home","Home" "ID","ID" diff --git a/app/code/Magento/Catalog/i18n/es_ES.csv b/app/code/Magento/Catalog/i18n/es_ES.csv index 07a4d96a75b..6d4cda7c684 100644 --- a/app/code/Magento/Catalog/i18n/es_ES.csv +++ b/app/code/Magento/Catalog/i18n/es_ES.csv @@ -146,7 +146,6 @@ "Catalog Product Link","Enlace al Catálgo de Productos" "Catalog Product View (Any)","Vista del Catálogo de Producto (cualquiera)" "Catalog Product View (Configurable)","Vista del Catálogo de Producto (Configurable)" -"Catalog Product View (Grouped)","Vista del Catálogo de Producto (Agrupada)" "Catalog Product View (Simple)","Vista del Catálogo de Producto (Simple)" "Catalog Product View (Virtual)","Vista del Catálogo de Producto (Virtual)" "Catalog Section","Sección de Catálogo" @@ -313,7 +312,6 @@ "Grid","Parrilla" "Group add","Añadir grupo" "Group remove","Eliminación de grupo" -"Grouped Product","Producto agrupado" "Groups","Grupos" "Home","Inicio" "ID","ID" diff --git a/app/code/Magento/Catalog/i18n/fr_FR.csv b/app/code/Magento/Catalog/i18n/fr_FR.csv index 98068e2e186..122f2ea0233 100644 --- a/app/code/Magento/Catalog/i18n/fr_FR.csv +++ b/app/code/Magento/Catalog/i18n/fr_FR.csv @@ -146,7 +146,6 @@ "Catalog Product Link","Lien du Produit Catalogue" "Catalog Product View (Any)","Affichage du Produit Catalogue (Tous)" "Catalog Product View (Configurable)","Affichage du Produit Catalogue (Configurable)" -"Catalog Product View (Grouped)","Affichage du Produit Catalogue (Groupé)" "Catalog Product View (Simple)","Affichage du Produit Catalogue (Simple)" "Catalog Product View (Virtual)","Affichage du Produit Catalogue (Virtuel)" "Catalog Section","Section Catalogue" @@ -313,7 +312,6 @@ "Grid","Grille" "Group add","Groupe ajouter" "Group remove","Suppression de groupe" -"Grouped Product","Produits groupés" "Groups","Groupes" "Home","Accueil" "ID","ID" diff --git a/app/code/Magento/Catalog/i18n/nl_NL.csv b/app/code/Magento/Catalog/i18n/nl_NL.csv index b89451ceef4..157296cda20 100644 --- a/app/code/Magento/Catalog/i18n/nl_NL.csv +++ b/app/code/Magento/Catalog/i18n/nl_NL.csv @@ -146,7 +146,6 @@ "Catalog Product Link","Catalogus Product Link" "Catalog Product View (Any)","Catalogus Product Bezichtiging (Elke)" "Catalog Product View (Configurable)","Catalogus Product Bezichtiging (Configureerbaar)" -"Catalog Product View (Grouped)","Catalogus Product Bezichtiging (Gegroepeerd)" "Catalog Product View (Simple)","Catalogus Product Bezichtiging (Simpel)" "Catalog Product View (Virtual)","Catalogus Product Bezichtiging (Virtueel)" "Catalog Section","Catalogus Gedeelte" @@ -313,7 +312,6 @@ "Grid","Rooster" "Group add","Voeg groep toe" "Group remove","Groep verwijderen" -"Grouped Product","Gegroepeerd Product" "Groups","Groepen" "Home","Thuis" "ID","ID" diff --git a/app/code/Magento/Catalog/i18n/pt_BR.csv b/app/code/Magento/Catalog/i18n/pt_BR.csv index f33e81c91e5..ec85d4721e5 100644 --- a/app/code/Magento/Catalog/i18n/pt_BR.csv +++ b/app/code/Magento/Catalog/i18n/pt_BR.csv @@ -146,7 +146,6 @@ "Catalog Product Link","Link do Produto de Catálogo" "Catalog Product View (Any)","Visualizar Produto de Catálogo (Qualquer Um)" "Catalog Product View (Configurable)","Visualizar Produto de Catálogo (Configurável)" -"Catalog Product View (Grouped)","Visualizar Produto de Catálogo (Agrupado)" "Catalog Product View (Simple)","Visualizar Produto de Catálogo (Simples)" "Catalog Product View (Virtual)","Visualizar Produto de Catálogo (Virtual)" "Catalog Section","Seção de Catálogo" @@ -313,7 +312,6 @@ "Grid","Grade" "Group add","Adicionar em grupo" "Group remove","Remover grupo" -"Grouped Product","Produto Agrupado" "Groups","Grupos" "Home","InÃcio" "ID","Identidade" diff --git a/app/code/Magento/Catalog/i18n/zh_CN.csv b/app/code/Magento/Catalog/i18n/zh_CN.csv index 685ee724075..776e34364e4 100644 --- a/app/code/Magento/Catalog/i18n/zh_CN.csv +++ b/app/code/Magento/Catalog/i18n/zh_CN.csv @@ -146,7 +146,6 @@ "Catalog Product Link","分类产å“链接" "Catalog Product View (Any)","分类产å“视图(任æ„)" "Catalog Product View (Configurable)","分类产å“视图(å¯é…置)" -"Catalog Product View (Grouped)","分类产å“视图(分组)" "Catalog Product View (Simple)","分类产å“视图(简å•)" "Catalog Product View (Virtual)","分类产å“视图(虚拟)" "Catalog Section","分类选择" @@ -313,7 +312,6 @@ "Grid","ç½‘æ ¼" "Group add","ç»„æ·»åŠ " "Group remove","ç»„åˆ é™¤" -"Grouped Product","分组产å“" "Groups","群组" "Home","主页" "ID","ID" diff --git a/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php b/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php index b70a948884e..0d9d9d0f3fb 100644 --- a/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php +++ b/app/code/Magento/Catalog/sql/catalog_setup/mysql4-upgrade-1.6.0.0.8-1.6.0.0.9.php @@ -31,7 +31,7 @@ $installer = $this; $installFile = __DIR__ . '/upgrade-1.6.0.0.8-1.6.0.0.9.php'; /** @var \Magento\Filesystem\Directory\Read $modulesDirectory */ -$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\Filesystem::MODULES); +$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); if ($modulesDirectory->isExist($modulesDirectory->getRelativePath($installFile))) { include $installFile; diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php index fa9bb46bf10..bba182665a1 100644 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php +++ b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php @@ -43,6 +43,6 @@ $installer->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'country_of_man 'comparable' => false, 'visible_on_front' => false, 'unique' => false, - 'apply_to' => 'simple,configurable,bundle,grouped', + 'apply_to' => 'simple,configurable,bundle', 'is_configurable' => false, )); diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/super/config.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/super/config.phtml index 6bb128b72ee..1112dc21677 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/super/config.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/edit/super/config.phtml @@ -68,7 +68,21 @@ jQuery(function($) { qtyField = $('#qty'), currentProductTemplateControl = $('#product-template-suggest-container .actions-split > .action-toggle'), attributesInput = $("input[name='attributes[]']", variationsContainer), - hasVariations = <?php echo ($this->getProduct()->isConfigurable() || $this->getRequest()->has('attributes')) ? 'true' : 'false' ?>; + hasVariations = <?php echo ($this->getProduct()->isConfigurable() || $this->getRequest()->has('attributes')) ? 'true' : 'false' ?>, + isLocked = function (element) { + return element.is('[data-locked]'); + }, + disableElement = function (element) { + if (!isLocked(element)) { + element.prop('disabled', true).trigger('change'); + } + }, + enableElement = function (element) { + if (!isLocked(element)) { + element.removeProp('disabled').trigger('change'); + + } + }; collapsableArea .on('show', function() { @@ -78,12 +92,8 @@ jQuery(function($) { attributesInput.prop('disabled', false); - qtyField - .prop('disabled', true) - .trigger('change'); - - stockAvailabilityField - .prop('disabled', false); + disableElement(qtyField); + enableElement(stockAvailabilityField); $.each($('#configurable-attributes-container').variationsAttributes('getAttributes'), function() { $('#attribute-' + this.code + '-container select').prop('disabled', true); @@ -97,12 +107,8 @@ jQuery(function($) { .removeClass('disabled') .removeProp('disabled'); - stockAvailabilityField - .prop('disabled', true); - - qtyField - .removeProp('disabled') - .trigger('change'); + disableElement(stockAvailabilityField); + enableElement(qtyField); }) .collapse(hasVariations ? 'show' : 'hide'); diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/price.phtml b/app/code/Magento/Catalog/view/adminhtml/catalog/product/price.phtml index 072029e77d8..e2bd96805d4 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/price.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/product/price.phtml @@ -35,10 +35,10 @@ <?php /** @var $_coreHelper \Magento\Core\Helper\Data */ $_coreHelper = $this->helper('Magento\Core\Helper\Data'); - /** @var $_weeeHelper \Magento\Weee\Helper\Data */ - $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); - /** @var $_taxHelper \Magento\Tax\Helper\Data */ - $_taxHelper = $this->helper('Magento\Tax\Helper\Data'); + /** @var $weeeHelper \Magento\Weee\Helper\Data */ + $weeeHelper = $this->helper('Magento\Weee\Helper\Data'); + /** @var $priceHelper \Magento\Catalog\Helper\Product\Price */ + $priceHelper = $this->helper('Magento\Catalog\Helper\Product\Price'); $_product = $this->getProduct(); $_id = $_product->getId(); @@ -46,31 +46,31 @@ $_website = $this->getWebsite($_storeId); $_weeeSeparator = ''; - $_simplePricesTax = ($_taxHelper->displayPriceIncludingTax() || $_taxHelper->displayBothPrices()); + $_simplePricesTax = ($priceHelper->displayPriceIncludingTax() || $priceHelper->displayBothPrices()); $_minimalPriceValue = $_product->getMinimalPrice(); - $_minimalPrice = $_taxHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax); + $_minimalPrice = $priceHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax); ?> <?php -$_exclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax = null); -$_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax = true); +$_exclTax = $priceHelper->getPrice($_product, $_minimalPriceValue, $includingTax = null); +$_inclTax = $priceHelper->getPrice($_product, $_minimalPriceValue, $includingTax = true); ?> -<?php $_weeeTaxAmount = $_weeeHelper->getAmount($_product, null, null, $_website); ?> -<?php if ($_weeeHelper->typeOfDisplay($_product, array(1,2,4))): ?> - <?php $_weeeTaxAmount = $_weeeHelper->getAmount($_product, null, null, $_website); ?> - <?php $_weeeTaxAttributes = $_weeeHelper->getProductWeeeAttributesForRenderer($_product, null, null, $_website); ?> +<?php $_weeeTaxAmount = $weeeHelper->getAmount($_product, null, null, $_website); ?> +<?php if ($weeeHelper->typeOfDisplay($_product, array(1,2,4))): ?> + <?php $_weeeTaxAmount = $weeeHelper->getAmount($_product, null, null, $_website); ?> + <?php $_weeeTaxAttributes = $weeeHelper->getProductWeeeAttributesForRenderer($_product, null, null, $_website); ?> <?php endif; ?> <div class="price-box"> -<?php $_price = $_taxHelper->getPrice($_product, $_product->getPrice()) ?> -<?php $_regularPrice = $_taxHelper->getPrice($_product, $_product->getPrice(), $_simplePricesTax) ?> -<?php $_finalPrice = $_taxHelper->getPrice($_product, $_product->getFinalPrice()) ?> -<?php $_finalPriceInclTax = $_taxHelper->getPrice($_product, $_product->getFinalPrice(), true) ?> -<?php $_weeeDisplayType = $_weeeHelper->getPriceDisplayType(); ?> +<?php $_price = $priceHelper->getPrice($_product, $_product->getPrice()) ?> +<?php $_regularPrice = $priceHelper->getPrice($_product, $_product->getPrice(), $_simplePricesTax) ?> +<?php $_finalPrice = $priceHelper->getPrice($_product, $_product->getFinalPrice()) ?> +<?php $_finalPriceInclTax = $priceHelper->getPrice($_product, $_product->getFinalPrice(), true) ?> +<?php $_weeeDisplayType = $weeeHelper->getPriceDisplayType(); ?> <?php if ($_finalPrice == $_price): ?> - <?php if ($_taxHelper->displayBothPrices()): ?> - <?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?> + <?php if ($priceHelper->displayBothPrices()): ?> + <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 0)): // including ?> <span class="price-excluding-tax"> <span class="label"><?php echo __('Excl. Tax:') ?></span> <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> @@ -83,7 +83,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax <?php echo $_coreHelper->currencyByStore($_finalPriceInclTax+$_weeeTaxAmount,true,false) ?> </span> </span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> <span class="price-excluding-tax"> <span class="label"><?php echo __('Excl. Tax:') ?></span> <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> @@ -103,7 +103,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax <?php endforeach; ?> )</span> </span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> <span class="price-excluding-tax"> <span class="label"><?php echo __('Excl. Tax:') ?></span> <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> @@ -123,7 +123,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax <?php endforeach; ?> )</span> </span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> <span class="price-excluding-tax"> <span class="label"><?php echo __('Excl. Tax:') ?></span> <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> @@ -156,11 +156,11 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax </span> <?php endif; ?> <?php else: ?> - <?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?> + <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 0)): // including ?> <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, true) ?> </span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, true) ?> </span> @@ -171,7 +171,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax <?php $_weeeSeparator = ' + '; ?> <?php endforeach; ?> )</span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> <?php echo $_coreHelper->currencyByStore($_price+$_weeeTaxAmount, $_storeId, true, true) ?> </span> @@ -182,7 +182,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax <?php $_weeeSeparator = ' + '; ?> <?php endforeach; ?> )</span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> <span class="regular-price"><?php echo $_coreHelper->currencyByStore($_price, $_storeId, true, true) ?></span><br /> <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> <span class="weee"> @@ -199,9 +199,9 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax <?php endif; ?> <?php endif; ?> <?php else: /* if ($_finalPrice == $_price): */ ?> - <?php $_originalWeeeTaxAmount = $_weeeHelper->getOriginalAmount($_product); ?> + <?php $_originalWeeeTaxAmount = $weeeHelper->getOriginalAmount($_product); ?> - <?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?> + <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 0)): // including ?> <p class="old-price"> <span class="price-label"><?php echo __('Regular Price:') ?></span> <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> @@ -209,7 +209,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax </span> </p> - <?php if ($_taxHelper->displayBothPrices()): ?> + <?php if ($priceHelper->displayBothPrices()): ?> <p class="special-price"> <span class="price-label"><?php echo __('Special Price:') ?></span> <span class="price-excluding-tax"> @@ -234,7 +234,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax </p> <?php endif; ?> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> <p class="old-price"> <span class="price-label"><?php echo __('Regular Price:') ?></span> <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> @@ -264,7 +264,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax </span> </span> </p> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> <p class="old-price"> <span class="price-label"><?php echo __('Regular Price:') ?></span> <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> @@ -294,7 +294,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax </span> </span> </p> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> <p class="old-price"> <span class="price-label"><?php echo __('Regular Price:') ?></span> <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> @@ -330,7 +330,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax </span> </p> - <?php if ($_taxHelper->displayBothPrices()): ?> + <?php if ($priceHelper->displayBothPrices()): ?> <p class="special-price"> <span class="price-label"><?php echo __('Special Price:') ?></span> <span class="price-excluding-tax"> @@ -361,7 +361,7 @@ $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, $includingTax <?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_product->getFinalPrice()): ?> <?php $_minimalPriceDisplayValue = $_minimalPrice; ?> - <?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, array(0, 1, 4))): ?> + <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, array(0, 1, 4))): ?> <?php $_minimalPriceDisplayValue = $_minimalPrice+$_weeeTaxAmount; ?> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/type-switcher.js b/app/code/Magento/Catalog/view/adminhtml/catalog/type-switcher.js index fbab1d582cf..ea184be046e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/type-switcher.js +++ b/app/code/Magento/Catalog/view/adminhtml/catalog/type-switcher.js @@ -76,19 +76,50 @@ if ($(this).is(':checked')) { $type.val(self.baseType.virtual).trigger('change'); if ($type.val() != 'bundle') { // @TODO move this check to Magento_Bundle after refactoring as widget - self.$weight.addClass('ignore-validate').prop('disabled', true); + self.disableElement(self.$weight); } self.$tab.show().closest('li').removeClass('removed'); } else { $type.val(self.baseType.real).trigger('change'); if ($type.val() != 'bundle') { // @TODO move this check to Magento_Bundle after refactoring as widget - self.$weight.removeClass('ignore-validate').prop('disabled', false); + self.enableElement(self.$weight); } self.$tab.hide(); } }).trigger('change'); }, + /** + * Disable element + * @param {jQuery|HTMLElement} element + */ + disableElement: function (element) { + if (!this._isLocked(element)) { + element.addClass('ignore-validate').prop('disabled', true); + } + }, + + /** + * Enable element + * @param {jQuery|HTMLElement} element + */ + enableElement: function (element) { + if (!this._isLocked(element)) { + element.removeClass('ignore-validate').prop('disabled', false); + } + }, + + /** + * Is element locked + * + * @param {jQuery|HTMLElement} element + * @returns {Boolean} + * @private + */ + _isLocked: function (element) { + return element.is('[data-locked]'); + }, + /** * Get element bu code * @param {string} code diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml index b4b7a42b574..91159ae119f 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml +++ b/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_new.xml @@ -122,7 +122,22 @@ <block class="Magento\View\Element\Template" name="affected-attribute-set-form" template="Magento_Catalog::product/configurable/affected-attribute-set-selector/form.phtml"/> </referenceContainer> <referenceContainer name="left"> - <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs" name="product_tabs"/> + <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs" name="product_tabs"> + <block class="Magento\Backend\Block\Widget\Tab" name="product_tabs.customer_options" as="customer_options"> + <arguments> + <argument name="label" xsi:type="string" translate="true">Custom Options</argument> + <argument name="url" xsi:type="url" path="catalog/*/options"> + <param name="_current">1</param> + </argument> + <argument name="class" xsi:type="string">ajax</argument> + </arguments> + </block> + <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts" name="product_tabs.product-alerts" as="product-alerts"> + <arguments> + <argument name="label" xsi:type="string" translate="true">Product Alerts</argument> + </arguments> + </block> + </block> </referenceContainer> <referenceContainer name="js"> <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Js" name="catalog_product_js" template="catalog/product/js.phtml"/> diff --git a/app/code/Magento/Catalog/view/adminhtml/product/product.css b/app/code/Magento/Catalog/view/adminhtml/product/product.css index 4d824b68fa8..54a508adde2 100644 --- a/app/code/Magento/Catalog/view/adminhtml/product/product.css +++ b/app/code/Magento/Catalog/view/adminhtml/product/product.css @@ -856,29 +856,6 @@ display: none !important; } -/* - Grouped Products Grid --------------------------------------- */ -#grouped_grid .col-name { - width: 25%; -} - -#grouped_grid .col-sku { - width: 10%; -} - -#grouped_grid .col-qty { - width: 7%; -} - -.ui-dialog.grouped .massaction { - display: none; -} - -.ui-dialog.grouped .col-entity_id { - width: 2%; -} - /* Custom Options -------------------------------------- */ diff --git a/app/code/Magento/Catalog/view/frontend/js/msrp.js b/app/code/Magento/Catalog/view/frontend/js/msrp.js index 3e11af76d51..a7d80e15530 100644 --- a/app/code/Magento/Catalog/view/frontend/js/msrp.js +++ b/app/code/Magento/Catalog/view/frontend/js/msrp.js @@ -27,7 +27,6 @@ (function($) { $.widget('mage.addToCart', { options: { - groupedProductContainer: '.grouped-items-table', showAddToCart: true }, diff --git a/app/code/Magento/Catalog/view/frontend/product/compare/list.phtml b/app/code/Magento/Catalog/view/frontend/product/compare/list.phtml index 8c8b6f77a20..7efe0129394 100644 --- a/app/code/Magento/Catalog/view/frontend/product/compare/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/compare/list.phtml @@ -40,7 +40,8 @@ <th class="cell label remove"> </th> <?php endif; ?> <td class="cell remove product"> - <a href="<?php echo $this->helper('Magento\Catalog\Helper\Product\Compare')->getRemoveUrl($_item) ?>" + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> + <a href="#" data-post='<?php echo $compareHelper->getPostDataRemove($_item); ?>' class="action delete" title="<?php echo __('Remove Product') ?>"> <span><?php echo __('Remove Product') ?></span> </a> @@ -84,8 +85,8 @@ <?php endif; ?> </div> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> - <div class="secondary addto links"> - <a href="<?php echo $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToWishlistUrl($_item) ?>" class="action towishlist" data-action="add-to-wishlist"> + <div class="secondary addto links" data-role="add-to-links"> + <a href="#" data-post='<?php echo $this->getAddToWishlistParams($_item); ?>' class="action towishlist" data-action="add-to-wishlist"> <span><?php echo __('Add to Wishlist') ?></span> </a> </div> diff --git a/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml b/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml index 59ac6a0d840..c41afa7c74e 100644 --- a/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/compare/sidebar.phtml @@ -48,8 +48,11 @@ $count = $_helper->getItemCount(); <?php echo $this->helper('Magento\Catalog\Helper\Output')->productAttribute($_item, $_item->getName(), 'name') ?> </a> </strong> - <a href="<?php echo $_helper->getRemoveUrl($_item) ?>" title="<?php echo __('Remove This Item') ?>" - class="action delete"><span><?php echo __('Remove This Item') ?></span></a> + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> + <a href="#" data-post='<?php echo $compareHelper->getPostDataRemove($_item); ?>' + title="<?php echo __('Remove This Item') ?>" + class="action delete"> + <span><?php echo __('Remove This Item') ?></span></a> </li> <?php endforeach; ?> </ol> @@ -64,17 +67,17 @@ $count = $_helper->getItemCount(); </div> </div> <script type="text/javascript"> - (function($) { + (function ($) { head.js("<?php echo $this->getViewFileUrl('Magento_Catalog::js/compare.js') ?>", function () { - $('#compare-items').compareItems({ - removeConfirmMessage: '<?php echo __('Are you sure you would like to remove this item from the compare products?') ?>', - removeSelector: '#compare-items a.action.delete', - clearAllConfirmMessage: '<?php echo __('Are you sure you would like to remove all products from your comparison?') ?>', - clearAllSelector: '#compare-clear-all' - }); + $('#compare-items').compareItems({ + removeConfirmMessage: '<?php echo __('Are you sure you would like to remove this item from the compare products?') ?>', + removeSelector: '#compare-items a.action.delete', + clearAllConfirmMessage: '<?php echo __('Are you sure you would like to remove all products from your comparison?') ?>', + clearAllSelector: '#compare-clear-all' }); - })(jQuery); - </script> + }); + })(jQuery); + </script> <?php else: ?> <p class="empty"><?php echo __('You have no items to compare.') ?></p> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/list.phtml b/app/code/Magento/Catalog/view/frontend/product/list.phtml index e447c72129d..bc368edf893 100644 --- a/app/code/Magento/Catalog/view/frontend/product/list.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/list.phtml @@ -91,10 +91,21 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im <div class="product actions"<?php echo strpos($pos, $viewMode . '-actions') ? $position : ''; ?>> <div class="primary"<?php echo strpos($pos, $viewMode . '-primary') ? $position: ''; ?>> <?php if ($_product->isSaleable()): ?> - <button type="button" title="<?php echo __('Add to Cart') ?>" class="action tocart" - data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_product) ?>'}}"> - <span><?php echo __('Add to Cart') ?></span> - </button> + <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?> + <button type="button" title="<?php echo __('Add to Cart') ?>" class="action tocart" + data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_product) ?>'}}"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); + ?> + <button type="button" title="<?php echo __('Add to Cart') ?>" class="action tocart" + data-post='<?php echo $postData; ?>'> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> <?php else: ?> <?php if ($_product->getIsSalable()): ?> <p class="stock available"><span><?php echo __('In stock') ?></span></p> @@ -103,12 +114,17 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im <?php endif; ?> <?php endif; ?> </div> - <div class="secondary"<?php echo strpos($pos, $viewMode . '-secondary') ? $position : ''; ?>> - <a href="<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getAddUrl($_product) ?>" + <div data-role="add-to-links" class="secondary"<?php echo strpos($pos, $viewMode . '-secondary') ? $position : ''; ?>> + <a href="#" + data-post='<?php echo $this->getAddToWishlistParams($_product); ?>' class="action towishlist" data-action="add-to-wishlist"> <span><?php echo __('Add to Wishlist') ?></span> </a> - <a href="<?php echo $this->getAddToCompareUrl($_product) ?>" class="action tocompare"> + <?php + $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); + ?> + <a href="#" class="action tocompare" + data-post='<?php echo $compareHelper->getPostDataParams($_product); ?>'> <span><?php echo __('Add to Compare') ?></span> </a> </div> diff --git a/app/code/Magento/Catalog/view/frontend/product/list/items.phtml b/app/code/Magento/Catalog/view/frontend/product/list/items.phtml index 716e37e4394..18d94f90ecd 100644 --- a/app/code/Magento/Catalog/view/frontend/product/list/items.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/list/items.phtml @@ -230,9 +230,20 @@ switch($type=$this->getType()) { <?php if($showCart): ?> <div class="primary"> <?php if($_item->isSaleable()): ?> - <button class="action tocart" data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" type="button" title="<?php echo __('Add to Cart') ?>"> - <span><?php echo __('Add to Cart') ?></span> - </button> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <button class="action tocart" data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + <button class="action tocart" + data-post='<?php echo $postData; ?>' + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> <p class="stock available"><span><?php echo __('In stock') ?></span></p> @@ -244,14 +255,20 @@ switch($type=$this->getType()) { <?php endif; ?> <?php if($showWishlist || $showCompare): ?> - <div class="secondary addto links"> + <div class="secondary addto links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="action towishlist" data-action="add-to-wishlist" title="<?php echo __('Add to Wishlist') ?>"> + <a href="#" data-post='<?php echo $this->getAddToWishlistParams($_item); ?>' class="action towishlist" data-action="add-to-wishlist" title="<?php echo __('Add to Wishlist') ?>"> <span><?php echo __('Add to Wishlist') ?></span> </a> <?php endif; ?> - <?php if($this->getAddToCompareUrl($_item) && $showCompare): ?> - <a href="<?php echo $this->getAddToCompareUrl($_item) ?>" class="action tocompare" title="<?php echo __('Add to Compare') ?>"> + <?php if($this->getAddToCompareUrl() && $showCompare): ?> + <?php + $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); + ?> + <a href="#" class="action tocompare" + data-post='<?php echo $compareHelper->getPostDataParams($_item);?>' + data-role="add-to-links" + title="<?php echo __('Add to Compare'); ?>"> <span><?php echo __('Add to Compare') ?></span> </a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/listing.phtml b/app/code/Magento/Catalog/view/frontend/product/listing.phtml index c61fb8bea98..29ded60475a 100644 --- a/app/code/Magento/Catalog/view/frontend/product/listing.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/listing.phtml @@ -85,8 +85,8 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im '<p class="stock unavailable"><span>' . __('Out of stock') . '</span></p>'; } - $info['links'] = '<div class="product links">' - . '<a href="' . $this->helper('Magento\Wishlist\Helper\Data')->getAddUrl($_product) . '" class="action towishlist" data-action="add-to-wishlist">' + $info['links'] = '<div class="product links" data-role="add-to-links">' + . '<a href="#" data-post=\'' . $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product) . '\' class="action towishlist" data-action="add-to-wishlist">' . '<span>' . __('Add to Wishlist') . '</span></a>' . '<a href="' . $this->getAddToCompareUrl($_product) . '" class="action tocompare">' . '<span>' . __('Add to Compare') . '</span></a></div>'; diff --git a/app/code/Magento/Catalog/view/frontend/product/price.phtml b/app/code/Magento/Catalog/view/frontend/product/price.phtml index 3cf63609936..2787e9b4ffd 100644 --- a/app/code/Magento/Catalog/view/frontend/product/price.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/price.phtml @@ -34,138 +34,63 @@ ?> <?php $_coreHelper = $this->helper('Magento\Core\Helper\Data'); - $_weeeHelper = $this->helper('Magento\Weee\Helper\Data'); - $_taxHelper = $this->helper('Magento\Tax\Helper\Data'); + $weeeHelper = $this->helper('Magento\Weee\Helper\Data'); + $priceHelper = $this->helper('Magento\Catalog\Helper\Product\Price'); /* @var $_coreHelper \Magento\Core\Helper\Data */ - /* @var $_weeeHelper \Magento\Weee\Helper\Data */ - /* @var $_taxHelper \Magento\Tax\Helper\Data */ + /* @var $weeeHelper \Magento\Weee\Helper\Data */ + /* @var $priceHelper Magento\Catalog\Helper\Product\Price */ $_product = $this->getProduct(); $_storeId = $_product->getStoreId(); $_id = $_product->getId(); $_weeeSeparator = ''; - $_simplePricesTax = ($_taxHelper->displayPriceIncludingTax() || $_taxHelper->displayBothPrices()); + $_simplePricesTax = ($priceHelper->displayPriceIncludingTax() || $priceHelper->displayBothPrices()); $_minimalPriceValue = $_product->getMinimalPrice(); - $_minimalPrice = $_taxHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax); + $_minimalPrice = $priceHelper->getPrice($_product, $_minimalPriceValue, $_simplePricesTax); ?> +<?php $_weeeTaxAmount = $weeeHelper->getAmountForDisplay($_product); ?> +<?php if ($weeeHelper->typeOfDisplay($_product, array(\Magento\Weee\Model\Tax::DISPLAY_INCL_DESCR, \Magento\Weee\Model\Tax::DISPLAY_EXCL_DESCR_INCL, 4))): ?> + <?php $_weeeTaxAmount = $weeeHelper->getAmount($_product); ?> + <?php $_weeeTaxAttributes = $weeeHelper->getProductWeeeAttributesForDisplay($_product); ?> +<?php endif; ?> +<?php $_weeeTaxAmountInclTaxes = $_weeeTaxAmount; ?> +<?php if ($weeeHelper->isTaxable() && !$priceHelper->priceIncludesTax($_storeId)): ?> + <?php $_attributes = $weeeHelper->getProductWeeeAttributesForRenderer($_product, null, null, null, true); ?> + <?php $_weeeTaxAmountInclTaxes = $weeeHelper->getAmountInclTaxes($_attributes); ?> +<?php endif; ?> -<?php if (!$_product->isGrouped()): ?> - <?php $_weeeTaxAmount = $_weeeHelper->getAmountForDisplay($_product); ?> - <?php if ($_weeeHelper->typeOfDisplay($_product, array(\Magento\Weee\Model\Tax::DISPLAY_INCL_DESCR, \Magento\Weee\Model\Tax::DISPLAY_EXCL_DESCR_INCL, 4))): ?> - <?php $_weeeTaxAmount = $_weeeHelper->getAmount($_product); ?> - <?php $_weeeTaxAttributes = $_weeeHelper->getProductWeeeAttributesForDisplay($_product); ?> - <?php endif; ?> - <?php $_weeeTaxAmountInclTaxes = $_weeeTaxAmount; ?> - <?php if ($_weeeHelper->isTaxable() && !$_taxHelper->priceIncludesTax($_storeId)): ?> - <?php $_attributes = $_weeeHelper->getProductWeeeAttributesForRenderer($_product, null, null, null, true); ?> - <?php $_weeeTaxAmountInclTaxes = $_weeeHelper->getAmountInclTaxes($_attributes); ?> - <?php endif; ?> - - <div class="price-box"> - <?php $_price = $_taxHelper->getPrice($_product, $_product->getPrice()) ?> - <?php $_regularPrice = $_taxHelper->getPrice($_product, $_product->getPrice(), $_simplePricesTax) ?> - <?php $_finalPrice = $_taxHelper->getPrice($_product, $_product->getFinalPrice()) ?> - <?php $_finalPriceInclTax = $_taxHelper->getPrice($_product, $_product->getFinalPrice(), true) ?> - <?php $_weeeDisplayType = $_weeeHelper->getPriceDisplayType(); ?> - <?php if ($_finalPrice >= $_price): ?> - <?php if ($_taxHelper->displayBothPrices()): ?> - <?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - </span> - </span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> - </span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?> - </span> +<div class="price-box"> +<?php $_price = $priceHelper->getPrice($_product, $_product->getPrice()) ?> +<?php $_regularPrice = $priceHelper->getPrice($_product, $_product->getPrice(), $_simplePricesTax) ?> +<?php $_finalPrice = $priceHelper->getPrice($_product, $_product->getFinalPrice()) ?> +<?php $_finalPriceInclTax = $priceHelper->getPrice($_product, $_product->getFinalPrice(), true) ?> +<?php $_weeeDisplayType = $weeeHelper->getPriceDisplayType(); ?> +<?php if ($_finalPrice >= $_price): ?> + <?php if ($priceHelper->displayBothPrices()): ?> + <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 0)): // including ?> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?> </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> - </span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_price, true, false) ?> - </span> - </span> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <span class="weee"> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - </span> - <?php endforeach; ?> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - </span> - </span> - <?php else: ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php if ($_finalPrice == $_price): ?> - <?php echo $_coreHelper->currency($_price, true, false) ?> - <?php else: ?> - <?php echo $_coreHelper->currency($_finalPrice, true, false) ?> - <?php endif; ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPriceInclTax, true, false) ?> - </span> + </span> + <span class="price-including-tax"> + <span class="label"><?php echo __('Incl. Tax:') ?></span> + <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> </span> - <?php endif; ?> - <?php else: ?> - <?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?> + </span> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?> </span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?> + </span> + <span class="price-including-tax"> + <span class="label"><?php echo __('Incl. Tax:') ?></span> + <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> </span> <span class="weee">( <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> @@ -174,9 +99,18 @@ <?php $_weeeSeparator = ' + '; ?> <?php endforeach; ?> )</span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?> + </span> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, false) ?> + </span> + </span> + <span class="price-including-tax"> + <span class="label"><?php echo __('Incl. Tax:') ?></span> + <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> </span> <span class="weee">( <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> @@ -185,70 +119,102 @@ <?php $_weeeSeparator = ' + '; ?> <?php endforeach; ?> )</span> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> - <span class="regular-price"><?php echo $_coreHelper->currency($_price,true,true) ?></span><br /> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <span class="weee"> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - </span> - <?php endforeach; ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?> + </span> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_price, true, false) ?> </span> - <?php else: ?> - <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + </span> + <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> + <span class="weee"> + <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> + </span> + <?php endforeach; ?> + <span class="price-including-tax"> + <span class="label"><?php echo __('Incl. Tax:') ?></span> + <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> + </span> + </span> + <?php else: ?> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> <?php if ($_finalPrice == $_price): ?> - <?php echo $_coreHelper->currency($_price, true, true) ?> + <?php echo $_coreHelper->currency($_price, true, false) ?> <?php else: ?> - <?php echo $_coreHelper->currency($_finalPrice, true, true) ?> + <?php echo $_coreHelper->currency($_finalPrice, true, false) ?> <?php endif; ?> </span> - <?php endif; ?> - <?php endif; ?> - <?php else: /* if ($_finalPrice == $_price): */ ?> - <?php $_originalWeeeTaxAmount = $_weeeHelper->getOriginalAmount($_product); ?> - - <?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 0)): // including ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?> - </span> - </p> - - <?php if ($_taxHelper->displayBothPrices()): ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - </span> + </span> + <span class="price-including-tax"> + <span class="label"><?php echo __('Incl. Tax:') ?></span> + <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPriceInclTax, true, false) ?> </span> - </p> - <?php else: ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmountInclTaxes, true, false) ?> + </span> + <?php endif; ?> + <?php else: ?> + <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 0)): // including ?> + <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?> + </span> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> + <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?> + </span> + <span class="weee">( + <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> + <?php echo $_weeeSeparator; ?> + <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> + <?php $_weeeSeparator = ' + '; ?> + <?php endforeach; ?> + )</span> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> + <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?> + </span> + <span class="weee">( + <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> + <?php echo $_weeeSeparator; ?> + <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?> + <?php $_weeeSeparator = ' + '; ?> + <?php endforeach; ?> + )</span> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> + <span class="regular-price"><?php echo $_coreHelper->currency($_price,true,true) ?></span><br /> + <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> + <span class="weee"> + <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> </span> - </p> - <?php endif; ?> + <?php endforeach; ?> + <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_price + $_weeeTaxAmount, true, true) ?> + </span> + <?php else: ?> + <span class="regular-price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php if ($_finalPrice == $_price): ?> + <?php echo $_coreHelper->currency($_price, true, true) ?> + <?php else: ?> + <?php echo $_coreHelper->currency($_finalPrice, true, true) ?> + <?php endif; ?> + </span> + <?php endif; ?> + <?php endif; ?> +<?php else: /* if ($_finalPrice == $_price): */ ?> + <?php $_originalWeeeTaxAmount = $weeeHelper->getOriginalAmount($_product); ?> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?> - </span> - </p> + <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 0)): // including ?> + <p class="old-price"> + <span class="price-label"><?php echo __('Regular Price:') ?></span> + <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?> + </span> + </p> + <?php if ($priceHelper->displayBothPrices()): ?> <p class="special-price"> <span class="price-label"><?php echo __('Special Price:') ?></span> <span class="price-excluding-tax"> @@ -257,13 +223,6 @@ <?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?> </span> </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> <span class="price-including-tax"> <span class="label"><?php echo __('Incl. Tax:') ?></span> <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> @@ -271,44 +230,112 @@ </span> </span> </p> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?> + <?php else: ?> + <p class="special-price"> + <span class="price-label"><?php echo __('Special Price:') ?></span> + <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmountInclTaxes, true, false) ?> + </span> + </p> + <?php endif; ?> + + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 1)): // incl. + weee ?> + <p class="old-price"> + <span class="price-label"><?php echo __('Regular Price:') ?></span> + <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?> + </span> + </p> + + <p class="special-price"> + <span class="price-label"><?php echo __('Special Price:') ?></span> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?> </span> - </p> + </span> + <span class="weee">( + <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> + <?php echo $_weeeSeparator; ?> + <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> + <?php $_weeeSeparator = ' + '; ?> + <?php endforeach; ?> + )</span> + <span class="price-including-tax"> + <span class="label"><?php echo __('Incl. Tax:') ?></span> + <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> + </span> + </span> + </p> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 4)): // incl. + weee ?> + <p class="old-price"> + <span class="price-label"><?php echo __('Regular Price:') ?></span> + <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_regularPrice + $_originalWeeeTaxAmount, true, false) ?> + </span> + </p> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?> - </span> + <p class="special-price"> + <span class="price-label"><?php echo __('Special Price:') ?></span> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPrice + $_weeeTaxAmount, true, false) ?> </span> - <span class="weee">( - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <?php echo $_weeeSeparator; ?> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?> - <?php $_weeeSeparator = ' + '; ?> - <?php endforeach; ?> - )</span> + </span> + <span class="weee">( + <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> + <?php echo $_weeeSeparator; ?> + <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount() + $_weeeTaxAttribute->getTaxAmount(), true, true); ?> + <?php $_weeeSeparator = ' + '; ?> + <?php endforeach; ?> + )</span> + <span class="price-including-tax"> + <span class="label"><?php echo __('Incl. Tax:') ?></span> + <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> + </span> + </span> + </p> + <?php elseif ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> + <p class="old-price"> + <span class="price-label"><?php echo __('Regular Price:') ?></span> + <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_regularPrice, true, false) ?> + </span> + </p> + + <p class="special-price"> + <span class="price-label"><?php echo __('Special Price:') ?></span> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPrice, true, false) ?> + </span> + </span> + <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> + <span class="weee"> + <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> + </span> + <?php endforeach; ?> <span class="price-including-tax"> <span class="label"><?php echo __('Incl. Tax:') ?></span> <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> </span> </span> - </p> - <?php elseif ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, 2)): // excl. + weee + final ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_regularPrice, true, false) ?> - </span> - </p> + </p> + <?php else: // excl. ?> + <p class="old-price"> + <span class="price-label"><?php echo __('Regular Price:') ?></span> + <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_regularPrice, true, false) ?> + </span> + </p> + <?php if ($priceHelper->displayBothPrices()): ?> <p class="special-price"> <span class="price-label"><?php echo __('Special Price:') ?></span> <span class="price-excluding-tax"> @@ -317,122 +344,44 @@ <?php echo $_coreHelper->currency($_finalPrice, true, false) ?> </span> </span> - <?php foreach ($_weeeTaxAttributes as $_weeeTaxAttribute): ?> - <span class="weee"> - <?php echo $_weeeTaxAttribute->getName(); ?>: <?php echo $_coreHelper->currency($_weeeTaxAttribute->getAmount(), true, true); ?> - </span> - <?php endforeach; ?> <span class="price-including-tax"> <span class="label"><?php echo __('Incl. Tax:') ?></span> <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPriceInclTax + $_weeeTaxAmountInclTaxes, true, false) ?> - </span> - </span> - </p> - <?php else: // excl. ?> - <p class="old-price"> - <span class="price-label"><?php echo __('Regular Price:') ?></span> - <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_regularPrice, true, false) ?> - </span> - </p> - - <?php if ($_taxHelper->displayBothPrices()): ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPrice, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPriceInclTax, true, false) ?> - </span> + <?php echo $_coreHelper->currency($_finalPriceInclTax, true, false) ?> </span> - </p> - <?php else: ?> - <p class="special-price"> - <span class="price-label"><?php echo __('Special Price:') ?></span> - <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_finalPrice, true, false) ?> </span> </p> - <?php endif; ?> + <?php else: ?> + <p class="special-price"> + <span class="price-label"><?php echo __('Special Price:') ?></span> + <span class="price" id="product-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_finalPrice, true, false) ?> + </span> + </p> <?php endif; ?> + <?php endif; ?> - <?php endif; /* if ($_finalPrice == $_price): */ ?> - - <?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_product->getFinalPrice()): ?> +<?php endif; /* if ($_finalPrice == $_price): */ ?> +<?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue && $_minimalPriceValue < $_product->getFinalPrice()): ?> - <?php $_minimalPriceDisplayValue = $_minimalPrice; ?> - <?php if ($_weeeTaxAmount && $_weeeHelper->typeOfDisplay($_product, array(0, 1, 4))): ?> - <?php $_minimalPriceDisplayValue = $_minimalPrice + $_weeeTaxAmount; ?> - <?php endif; ?> + <?php $_minimalPriceDisplayValue = $_minimalPrice; ?> + <?php if ($_weeeTaxAmount && $weeeHelper->typeOfDisplay($_product, array(0, 1, 4))): ?> + <?php $_minimalPriceDisplayValue = $_minimalPrice + $_weeeTaxAmount; ?> + <?php endif; ?> - <?php if ($this->getUseLinkForAsLowAs()):?> - <a href="<?php echo $_product->getProductUrl(); ?>" class="minimal-price-link"> - <?php else:?> - <span class="minimal-price-link"> - <?php endif?> - <span class="label"><?php echo __('As low as:') ?></span> - <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_minimalPriceDisplayValue, true, false) ?> - </span> - <?php if ($this->getUseLinkForAsLowAs()):?> - </a> - <?php else:?> + <?php if ($this->getUseLinkForAsLowAs()):?> + <a href="<?php echo $_product->getProductUrl(); ?>" class="minimal-price-link"> + <?php else:?> + <span class="minimal-price-link"> + <?php endif?> + <span class="label"><?php echo __('As low as:') ?></span> + <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_minimalPriceDisplayValue, true, false) ?> </span> - <?php endif?> - <?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice && $_minimalPrice < $_finalPrice): */ ?> - </div> - -<?php else: /* if (!$_product->isGrouped()): */ ?> - <?php - $showMinPrice = $this->getDisplayMinimalPrice(); - if ($showMinPrice && $_minimalPriceValue) { - $_exclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue); - $_inclTax = $_taxHelper->getPrice($_product, $_minimalPriceValue, true); - $price = $showMinPrice ? $_minimalPriceValue : 0; - } else { - $price = $_product->getFinalPrice(); - $_exclTax = $_taxHelper->getPrice($_product, $price); - $_inclTax = $_taxHelper->getPrice($_product, $price, true); - } - ?> - <?php if ($price): ?> - <div class="price-box" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> - <p<?php if ($showMinPrice): ?> class="minimal-price"<?php endif ?>> - <?php if ($showMinPrice): ?> - <span class="price-label"><?php echo __('Starting at:') ?></span> - <?php endif ?> - <?php if ($_taxHelper->displayBothPrices()): ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>" itemprop="price"> - <?php echo $_coreHelper->currency($_exclTax, true, false) ?> - </span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> - <?php echo $_coreHelper->currency($_inclTax, true, false) ?> - </span> - </span> - <?php else: ?> - <?php - $_showPrice = $_inclTax; - if (!$_taxHelper->displayPriceIncludingTax()) { - $_showPrice = $_exclTax; - } - ?> - <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>" itemprop="price"> - <?php echo $_coreHelper->currency($_showPrice, true, false) ?> - </span> - <?php endif; ?> - </p> - </div> - <?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice): */ ?> -<?php endif; /* if (!$_product->isGrouped()): */ ?> + <?php if ($this->getUseLinkForAsLowAs()):?> + </a> + <?php else:?> + </span> + <?php endif?> +<?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice && $_minimalPrice < $_finalPrice): */ ?> +</div> diff --git a/app/code/Magento/Catalog/view/frontend/product/view/addto.phtml b/app/code/Magento/Catalog/view/frontend/product/view/addto.phtml index 1001f061282..1af64b1c8b7 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/addto.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/addto.phtml @@ -23,24 +23,26 @@ */ /** @var $this \Magento\Catalog\Block\Product\View*/ ?> -<?php $_product = $this->getProduct(); ?> -<?php $_wishlistSubmitUrl = $this->helper('Magento\Wishlist\Helper\Data')->getAddUrl($_product); ?> +<?php +$_product = $this->getProduct(); +$_wishlistSubmitParams = $this->helper('Magento\Wishlist\Helper\Data')->getAddParams($_product); +$compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); +?> <div class="product addto links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> - <a href="<?php echo $_wishlistSubmitUrl ?>" + <a href="#" class="action towishlist" + data-post='<?php echo $_wishlistSubmitParams; ?>' data-action="add-to-wishlist"><span><?php echo __('Add to Wishlist') ?></span></a> <?php endif; ?> - <?php $_compareUrl = $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddUrl($_product); ?> - <?php if ($_compareUrl) : ?> - <a href="<?php echo $_compareUrl ?>" - class="action tocompare"><span><?php echo __('Add to Compare') ?></span></a> - <?php endif; ?> + <a href="#" data-post='<?php echo $compareHelper->getPostDataParams($_product);?>' + data-role="add-to-links" + class="action tocompare"><span><?php echo __('Add to Compare') ?></span></a> </div> <script type="text/javascript"> head.js("<?php echo $this->getViewFileUrl('Magento_Wishlist::js/add-to-wishlist.js') ?>", function () { - jQuery('[data-role="add-to-links"]').addToWishlist( + jQuery('.product.info.main').addToWishlist( <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode(array('productType' => $_product->getTypeId()))?> ); }); diff --git a/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml b/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml index 06ce797dd43..6779f656226 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/addtocart.phtml @@ -21,12 +21,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Catalog\Block\Product\View */ ?> <?php $_product = $this->getProduct(); ?> <?php $buttonTitle = __('Add to Cart'); ?> <?php if ($_product->isSaleable()): ?> <div class="box tocart"> - <?php if (!$_product->isGrouped()): ?> + <?php if ($this->shouldRenderQuantity()): ?> <div class="field qty"> <label class="label" for="qty"><span><?php echo __('Qty') ?></span></label> <div class="control"> @@ -63,41 +65,7 @@ "<?php echo $this->getViewFileUrl('mage/validation.js')?>", "<?php echo $this->getViewFileUrl('mage/validation/validation.js')?>", function () { $('#product_addtocart_form').validation({ - errorPlacement: function (error, element) { - if (element.attr('data-validate') && element.attr('data-validate').indexOf('validate-one-checkbox-required-by-name') > 0) { - error.appendTo('#links-advice-container'); - } else if (element.attr('data-validate')&& element.attr('data-validate').indexOf('validate-grouped-qty') > 0) { - $('#super-product-table').siblings(this.errorElement + '.' + this.errorClass).remove(); - $('#super-product-table').after(error); - } else if (element.is(':radio, :checkbox')) { - element.closest('.nested').after(error); - } else { - element.after(error); - } - }, - highlight: function (element, errorClass) { - if ($(element).attr('data-validate') && $(element).attr('data-validate').indexOf('validate-required-datetime') > 0) { - $(element).parent().find('.datetime-picker').each(function() { - $(this).removeClass(errorClass); - if ($(this).val().length === 0) { - $(this).addClass(errorClass); - } - }); - } else if ($(element).is(':radio, :checkbox')) { - $(element).closest('.nested').addClass(errorClass+'-group'); - } else { - $(element).addClass(errorClass); - } - }, - unhighlight: function (element, errorClass) { - if ($(element).attr('data-validate') && $(element).attr('data-validate').indexOf('validate-required-datetime') > 0) { - $(element).parent().find('.datetime-picker').removeClass(errorClass); - } else if ($(element).is(':radio, :checkbox')) { - $(element).closest('.nested').removeClass(errorClass+'-group'); - } else { - $(element).removeClass(errorClass); - } - } + radioCheckboxClosest: '.nested' }); }); })(jQuery); diff --git a/app/code/Magento/Catalog/view/frontend/product/view/tierprices.phtml b/app/code/Magento/Catalog/view/frontend/product/view/tierprices.phtml index 247be49486b..f8746736736 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/tierprices.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/tierprices.phtml @@ -41,15 +41,12 @@ if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(1, ?> <?php if (count($_tierPrices) > 0): ?> - <ul class="<?php echo ($this->getInGrouped() ? 'tier prices grouped items' : 'prices tier items'); ?>"> - <?php if ($this->getInGrouped()): ?> - <?php $_tierPrices = $this->getTierPrices($_product); ?> - <?php endif; ?> + <ul class="<?php echo ($this->hasListClass() ? $this->getListClass() : 'prices tier items'); ?>"> <?php $this->helper('Magento\Weee\Helper\Data')->processTierPrices($_product, $_tierPrices); ?> <?php foreach ($_tierPrices as $_index => $_price): ?> <li class="item"> <?php if ($_catalogHelper->canApplyMsrp($_product)): ?> - <?php if ($this->getInGrouped()): ?> + <?php if ($this->getShowDetailedPrice() === false): ?> <?php echo __('Buy %1 for', $_price['price_qty']) ?>: <?php else: ?> <?php echo __('Buy %1', $_price['price_qty']) ?> @@ -181,7 +178,7 @@ if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(1, <?php endif; // Can apply MSRP ?> - <?php if (!$this->getInGrouped()): ?> + <?php if ($this->getShowDetailedPrice() !== false): ?> <?php if(($_product->getPrice() == $_product->getFinalPrice() && $_product->getPrice() > $_price['price']) || ($_product->getPrice() != $_product->getFinalPrice() && $_product->getFinalPrice() > $_price['price'])): ?> <?php echo __('and') ?> <strong class="benefit"><?php echo __('save')?> <span class="percent tier-<?php echo $_index;?>"><?php echo $_price['savePercent']?></span>% @@ -195,7 +192,7 @@ if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(1, ? $this->getAddToCartUrl($_product, array('qty' => $_price['price_qty'])) : ''; ?> - <a href="#" id="<?php echo($popupId);?>" data-tier-price='{addToCartUrl:"<?php echo $addToCartUrl; ?>", name:"<?php echo $_product->getName() ?>", price:<?php echo json_encode($_price['real_price_html']) ?>, msrp:"<?php echo $this->helper('Magento\Core\Helper\Data')->currency($_product->getMsrp(),true,false) ?>"<?php if (!$this->getInGrouped()): ?>, qty:"<?php echo $_price['price_qty']?>"<?php endif ?>}'><?php echo __('Click for price'); ?></a> + <a href="#" id="<?php echo($popupId);?>" data-tier-price='{addToCartUrl:"<?php echo $addToCartUrl; ?>", name:"<?php echo $_product->getName() ?>", price:<?php echo json_encode($_price['real_price_html']) ?>, msrp:"<?php echo $this->helper('Magento\Core\Helper\Data')->currency($_product->getMsrp(),true,false) ?>"<?php if ($this->getCanDisplayQty() !== false): ?>, qty:"<?php echo $_price['price_qty']?>"<?php endif ?>}'><?php echo __('Click for price'); ?></a> <?php else: ?> <span class="msrp-price-hide-message"> <?php echo $_catalogHelper->getMsrpPriceMessage($_product) ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/view/validation.js b/app/code/Magento/Catalog/view/frontend/product/view/validation.js index 195c4d3371c..a6ba77053de 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/validation.js +++ b/app/code/Magento/Catalog/view/frontend/product/view/validation.js @@ -25,15 +25,18 @@ (function($) { $.widget("mage.validation", $.mage.validation, { options: { + radioCheckboxClosest: 'ul', errorPlacement: function (error, element) { + if (element.attr('data-validate-message-box')) { + var messageBox = $(element.attr('data-validate-message-box')); + messageBox.html(error); + return; + } var dataValidate = element.attr('data-validate'); if (dataValidate && dataValidate.indexOf('validate-one-checkbox-required-by-name') > 0) { error.appendTo('#links-advice-container'); - } else if (dataValidate && dataValidate.indexOf('validate-grouped-qty') > 0) { - $('#super-product-table').siblings(this.errorElement + '.' + this.errorClass).remove(); - $('#super-product-table').after(error); } else if (element.is(':radio, :checkbox')) { - element.closest('ul').after(error); + element.closest(this.radioCheckboxClosest).after(error); } else { element.after(error); } @@ -48,7 +51,7 @@ } }); } else if ($(element).is(':radio, :checkbox')) { - $(element).closest('ul').addClass(errorClass); + $(element).closest(this.radioCheckboxClosest).addClass(errorClass); } else { $(element).addClass(errorClass); } @@ -58,11 +61,11 @@ if (dataValidate && dataValidate.indexOf('validate-required-datetime') > 0) { $(element).parent().find('.datetime-picker').removeClass(errorClass); } else if ($(element).is(':radio, :checkbox')) { - $(element).closest('ul').removeClass(errorClass); + $(element).closest(this.radioCheckboxClosest).removeClass(errorClass); } else { $(element).removeClass(errorClass); } } } }); -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/app/code/Magento/Catalog/view/frontend/product/widget/new/column/new_default_list.phtml b/app/code/Magento/Catalog/view/frontend/product/widget/new/column/new_default_list.phtml index db74d774579..9f30e0fcf7f 100644 --- a/app/code/Magento/Catalog/view/frontend/product/widget/new/column/new_default_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/widget/new/column/new_default_list.phtml @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php if (($items$_products = $this->getProductCollection()) && $_products->getSize()): ?> +<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?> <?php $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Image');?> <div class="block widget new minilist"> <div class="title"> @@ -51,7 +51,22 @@ <div class="product actions"> <div class="primary"> <?php if($_product->isSaleable()): ?> - <a href="<?php echo $this->getAddToCartUrl($_product) ?>" class="action tocart"> + <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?> + <button type="button" title="<?php echo __('Add to Cart') ?>" class="action tocart" + data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_product) ?>'}}"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]); + ?> + <button type="button" title="<?php echo __('Add to Cart') ?>" class="action tocart" + data-post='<?php echo $postData; ?>'> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> + <a href="<?php echo $this->getAddToCartUrl($_product) ?>" class="action tocart"> <span><?php echo __('Add to Cart') ?></span> </a> <?php else: ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_grid.phtml b/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_grid.phtml index 9c13bb25ab7..e5db932f338 100644 --- a/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_grid.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_grid.phtml @@ -75,11 +75,23 @@ if ($exist = ($this->getProductCollection() && $this->getProductCollection()->ge <?php if($showCart): ?> <div class="primary"> <?php if($_item->isSaleable()): ?> - <button class="action tocart" - data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" - type="button" title="<?php echo __('Add to Cart') ?>"> - <span><?php echo __('Add to Cart') ?></span> - </button> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <button class="action tocart" + data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + <button class="action tocart" + data-post='<?php echo $postData; ?>' + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> <p class="stock available"><span><?php echo __('In stock') ?></span></p> @@ -90,17 +102,20 @@ if ($exist = ($this->getProductCollection() && $this->getProductCollection()->ge </div> <?php endif; ?> <?php if($showWishlist || $showCompare): ?> - <div class="secondary addto links"> + <div class="secondary addto links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" + <a href="#" + data-post='<?php echo $this->getAddToWishlistParams($_item); ?>' class="action towishlist" data-action="add-to-wishlist" title="<?php echo __('Add to Wishlist') ?>"> <span><?php echo __('Add to Wishlist') ?></span> </a> <?php endif; ?> - <?php if($this->getAddToCompareUrl($_item) && $showCompare): ?> - <a href="<?php echo $this->getAddToCompareUrl($_item) ?>" - class="action tocompare" title="<?php echo __('Add to Compare') ?>"> + <?php if($this->getAddToCompareUrl() && $showCompare): ?> + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> + <a href="#" class="action tocompare" + data-post='<?php echo $compareHelper->getPostDataParams($_item);?>' + title="<?php echo __('Add to Compare') ?>"> <span><?php echo __('Add to Compare') ?></span> </a> <?php endif; ?> @@ -115,4 +130,4 @@ if ($exist = ($this->getProductCollection() && $this->getProductCollection()->ge </ol> </div> </div> -<?php endif;?> +<?php endif;?> \ No newline at end of file diff --git a/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_list.phtml b/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_list.phtml index 2d3239dc164..b54adc15891 100644 --- a/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_list.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/widget/new/content/new_list.phtml @@ -75,11 +75,23 @@ if ($exist = ($this->getProductCollection() && $this->getProductCollection()->ge <?php if($showCart): ?> <div class="primary"> <?php if($_item->isSaleable()): ?> - <button class="action tocart" - data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" - type="button" title="<?php echo __('Add to Cart') ?>"> - <span><?php echo __('Add to Cart') ?></span> - </button> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <button class="action tocart" + data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + <button class="action tocart" + data-post='<?php echo $postData; ?>' + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> <p class="stock available"><span><?php echo __('In stock') ?></span></p> @@ -90,17 +102,20 @@ if ($exist = ($this->getProductCollection() && $this->getProductCollection()->ge </div> <?php endif; ?> <?php if($showWishlist || $showCompare): ?> - <div class="secondary addto links"> + <div class="secondary addto links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" + <a href="#" + data-post='<?php echo $this->getAddToWishlistParams($_item); ?>' class="action towishlist" data-action="add-to-wishlist" title="<?php echo __('Add to Wishlist') ?>"> <span><?php echo __('Add to Wishlist') ?></span> </a> <?php endif; ?> - <?php if($this->getAddToCompareUrl($_item) && $showCompare): ?> - <a href="<?php echo $this->getAddToCompareUrl($_item) ?>" - class="action tocompare" title="<?php echo __('Add to Compare') ?>"> + <?php if($this->getAddToCompareUrl() && $showCompare): ?> + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> + <a href="#" class="action tocompare" + title="<?php echo __('Add to Compare') ?>" + data-post='<?php echo $compareHelper->getPostDataParams($_item);?>'> <span><?php echo __('Add to Compare') ?></span> </a> <?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/rss/product/price.phtml b/app/code/Magento/Catalog/view/frontend/rss/product/price.phtml index 836ea064803..70b71334477 100644 --- a/app/code/Magento/Catalog/view/frontend/rss/product/price.phtml +++ b/app/code/Magento/Catalog/view/frontend/rss/product/price.phtml @@ -30,19 +30,17 @@ * @var $this \Magento\Catalog\Block\Product\Price */ ?> - <?php $_product = $this->getProduct() ?> +<?php /* @var $priceHelper \Magento\Catalog\Helper\Product\Price */ ?> <?php $_id = $_product->getId() ?> +<?php $priceHelper = $this->helper('Magento\Catalog\Helper\Product\Price'); ?> <?php if ($_product->getCanShowPrice() !== false):?> -<?php $_weeeSeparator = ''; ?> - -<?php $simplePricesTax = ($this->helper('Magento\Tax\Helper\Data')->displayPriceIncludingTax() || $this->helper('Magento\Tax\Helper\Data')->displayBothPrices()); ?> - -<?php $_minimalPriceValue = $_product->getMinimalPrice() ?> -<?php $_minimalPrice = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_minimalPriceValue, $simplePricesTax) ?> + <?php $_weeeSeparator = ''; ?> + <?php $simplePricesTax = ($priceHelper->displayPriceIncludingTax() || $priceHelper->displayBothPrices()); ?> + <?php $_minimalPriceValue = $_product->getMinimalPrice() ?> + <?php $_minimalPrice = $priceHelper->getPrice($_product, $_minimalPriceValue, $simplePricesTax) ?> -<?php if (!$_product->isGrouped()): ?> <?php $_weeeTaxAmount = $this->helper('Magento\Weee\Helper\Data')->getAmountForDisplay($_product); ?> <?php if ($this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, array(1,2,4))): ?> <?php $_weeeTaxAmount = $this->helper('Magento\Weee\Helper\Data')->getAmount($_product); ?> @@ -50,13 +48,13 @@ <?php endif; ?> <div class="price-box"> - <?php $_price = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getPrice()) ?> - <?php $_regularPrice = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getPrice(), $simplePricesTax) ?> - <?php $_finalPrice = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getFinalPrice()) ?> - <?php $_finalPriceInclTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_product->getFinalPrice(), true) ?> + <?php $_price = $priceHelper->getPrice($_product, $_product->getPrice()) ?> + <?php $_regularPrice = $priceHelper->getPrice($_product, $_product->getPrice(), $simplePricesTax) ?> + <?php $_finalPrice = $priceHelper->getPrice($_product, $_product->getFinalPrice()) ?> + <?php $_finalPriceInclTax = $priceHelper->getPrice($_product, $_product->getFinalPrice(), true) ?> <?php $_weeeDisplayType = $this->helper('Magento\Weee\Helper\Data')->getPriceDisplayType(); ?> <?php if ($_finalPrice == $_price): ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> + <?php if ($priceHelper->displayBothPrices()): ?> <?php if ($_weeeTaxAmount && $this->helper('Magento\Weee\Helper\Data')->typeOfDisplay($_product, 0)): // including ?> <span class="price-excluding-tax"> <span class="label"><?php echo __('Excl. Tax:') ?></span> @@ -174,7 +172,7 @@ <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_regularPrice+$_originalWeeeTaxAmount,true,false) ?></span> </p> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> + <?php if ($priceHelper->displayBothPrices()): ?> <p class="special-price"> <span class="price-label"><?php echo __('Special Price:') ?></span> <span class="price-excluding-tax"> @@ -274,7 +272,7 @@ <span class="price" id="old-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_regularPrice,true,false) ?></span> </p> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> + <?php if ($priceHelper->displayBothPrices()): ?> <p class="special-price"> <span class="price-label"><?php echo __('Special Price:') ?></span> <span class="price-excluding-tax"> @@ -317,38 +315,6 @@ <?php endif?> <?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice && $_minimalPrice < $_finalPrice): */ ?> </div> - -<?php else: /* if (!$_product->isGrouped()): */ ?> - <?php - $_exclTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_minimalPriceValue, $includingTax = null); - $_inclTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_product, $_minimalPriceValue, $includingTax = true); - ?> - <?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue): ?> - <div class="price-box"> - <p class="minimal-price"> - <span class="price-label"><?php echo __('Starting at:') ?></span> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> - <span class="price-excluding-tax"> - <span class="label"><?php echo __('Excl. Tax:') ?></span> - <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_exclTax, true, false) ?></span> - </span> - <span class="price-including-tax"> - <span class="label"><?php echo __('Incl. Tax:') ?></span> - <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_inclTax, true, false) ?></span> - </span> - <?php else: ?> - <?php - $_showPrice = $_inclTax; - if (!$this->helper('Magento\Tax\Helper\Data')->displayPriceIncludingTax()) { - $_showPrice = $_exclTax; - } - ?> - <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_showPrice, true, false) ?></span> - <?php endif; ?> - </p> - </div> - <?php endif; /* if ($this->getDisplayMinimalPrice() && $_minimalPrice): */ ?> -<?php endif; /* if (!$_product->isGrouped()): */ ?> <?php else: ?> -<?php //echo __('Price is not available');?> + <?php //echo __('Price is not available');?> <?php endif; /* if (!$_product->getCanShowPrice()): */?> diff --git a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php index bb230e5f9d0..6a88db7fa1f 100644 --- a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php +++ b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php @@ -158,11 +158,14 @@ class Stock extends \Magento\Data\Form\Element\Select */ protected function _disableFields() { + if ($this->getDisabled() || $this->_isProductComposite()) { + $this->_qty->setDisabled('disabled'); + } if (!$this->_isProductComposite() && $this->_qty->getValue() === null) { $this->setDisabled('disabled'); } - if ($this->_isProductComposite()) { - $this->_qty->setDisabled('disabled'); + if ($this->isLocked()) { + $this->_qty->lock(); } return $this; } diff --git a/app/code/Magento/CatalogInventory/Model/Observer.php b/app/code/Magento/CatalogInventory/Model/Observer.php index fa163b80ff1..7ae79d792f6 100644 --- a/app/code/Magento/CatalogInventory/Model/Observer.php +++ b/app/code/Magento/CatalogInventory/Model/Observer.php @@ -239,40 +239,6 @@ class Observer return $this; } - /** - * Copy product inventory data (used for product duplicate functionality) - * - * @param \Magento\Event\Observer $observer - * @return \Magento\CatalogInventory\Model\Observer - */ - public function copyInventoryData($observer) - { - /** @var \Magento\Catalog\Model\Product $currentProduct */ - $currentProduct = $observer->getEvent()->getCurrentProduct(); - /** @var \Magento\Catalog\Model\Product $newProduct */ - $newProduct = $observer->getEvent()->getNewProduct(); - - $newProduct->unsStockItem(); - $stockData = array( - 'use_config_min_qty' => 1, - 'use_config_min_sale_qty' => 1, - 'use_config_max_sale_qty' => 1, - 'use_config_backorders' => 1, - 'use_config_notify_stock_qty'=> 1 - ); - if ($currentStockItem = $currentProduct->getStockItem()) { - $stockData += array( - 'use_config_enable_qty_inc' => $currentStockItem->getData('use_config_enable_qty_inc'), - 'enable_qty_increments' => $currentStockItem->getData('enable_qty_increments'), - 'use_config_qty_increments' => $currentStockItem->getData('use_config_qty_increments'), - 'qty_increments' => $currentStockItem->getData('qty_increments'), - ); - } - $newProduct->setStockData($stockData); - - return $this; - } - /** * Prepare stock item data for save * @@ -561,7 +527,7 @@ class Observer $productTypeCustomOption = $quoteItem->getProduct()->getCustomOption('product_type'); if (!is_null($productTypeCustomOption)) { // Check if product related to current item is a part of grouped product - if ($productTypeCustomOption->getValue() == \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE) { + if ($productTypeCustomOption->getValue() == \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) { $stockItem->setProductName($quoteItem->getProduct()->getName()); $stockItem->setIsChildItem(true); } diff --git a/app/code/Magento/CatalogInventory/Model/Product/CopyConstructor/CatalogInventory.php b/app/code/Magento/CatalogInventory/Model/Product/CopyConstructor/CatalogInventory.php new file mode 100644 index 00000000000..bd8ec669bfb --- /dev/null +++ b/app/code/Magento/CatalogInventory/Model/Product/CopyConstructor/CatalogInventory.php @@ -0,0 +1,56 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\CatalogInventory\Model\Product\CopyConstructor; + +class CatalogInventory implements \Magento\Catalog\Model\Product\CopyConstructorInterface +{ + /** + * Copy product inventory data (used for product duplicate functionality) + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $duplicate + */ + public function build(\Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate) + { + $duplicate->unsStockItem(); + $stockData = array( + 'use_config_min_qty' => 1, + 'use_config_min_sale_qty' => 1, + 'use_config_max_sale_qty' => 1, + 'use_config_backorders' => 1, + 'use_config_notify_stock_qty' => 1 + ); + /** @var \Magento\CatalogInventory\Model\Stock\Item $currentStockItem */ + if ($currentStockItem = $product->getStockItem()) { + $stockData += array( + 'use_config_enable_qty_inc' => $currentStockItem->getData('use_config_enable_qty_inc'), + 'enable_qty_increments' => $currentStockItem->getData('enable_qty_increments'), + 'use_config_qty_increments' => $currentStockItem->getData('use_config_qty_increments'), + 'qty_increments' => $currentStockItem->getData('qty_increments'), + ); + } + $duplicate->setStockData($stockData); + } +} diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php index a6bb75ec6d9..a34dad9095d 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/Grouped.php @@ -75,7 +75,8 @@ class Grouped array()) ->joinLeft( array('l' => $this->getTable('catalog_product_link')), - 'e.entity_id = l.product_id AND l.link_type_id=' . \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED, + 'e.entity_id = l.product_id AND l.link_type_id=' + . \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, array()) ->joinLeft( array('le' => $this->getTable('catalog_product_entity')), diff --git a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml index 22c04dfec5e..05457026a73 100644 --- a/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml +++ b/app/code/Magento/CatalogInventory/etc/adminhtml/di.xml @@ -25,4 +25,11 @@ --> <config> <preference for="Magento\CatalogInventory\Model\Stock\Item" type="Magento\CatalogInventory\Model\Adminhtml\Stock\Item" /> + <type name="Magento\Catalog\Model\Product\CopyConstructor\Composite"> + <param name="constructors"> + <value> + <catalog_inventory>Magento\CatalogInventory\Model\Product\CopyConstructor\CatalogInventory</catalog_inventory> + </value> + </param> + </type> </config> diff --git a/app/code/Magento/CatalogInventory/etc/events.xml b/app/code/Magento/CatalogInventory/etc/events.xml index 1a2229835dc..ead47fb2d88 100644 --- a/app/code/Magento/CatalogInventory/etc/events.xml +++ b/app/code/Magento/CatalogInventory/etc/events.xml @@ -69,9 +69,6 @@ <event name="catalog_product_save_after"> <observer name="inventory" instance="Magento\CatalogInventory\Model\Observer" method="saveInventoryData" /> </event> - <event name="catalog_model_product_duplicate"> - <observer name="inventory" instance="Magento\CatalogInventory\Model\Observer" method="copyInventoryData" /> - </event> <event name="admin_system_config_changed_section_cataloginventory"> <observer name="inventory" instance="Magento\CatalogInventory\Model\Observer" method="updateItemsStockUponConfigChange" /> </event> diff --git a/app/code/Magento/CatalogInventory/etc/module.xml b/app/code/Magento/CatalogInventory/etc/module.xml index c56037ab276..5442076b16f 100755 --- a/app/code/Magento/CatalogInventory/etc/module.xml +++ b/app/code/Magento/CatalogInventory/etc/module.xml @@ -30,6 +30,7 @@ </sequence> <depends> <module name="Magento_Catalog"/> + <module name="Magento_GroupedProduct" /> <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Bundle"/> diff --git a/app/code/Magento/CatalogInventory/etc/product_types.xml b/app/code/Magento/CatalogInventory/etc/product_types.xml index d50ba19b364..72c3744a174 100644 --- a/app/code/Magento/CatalogInventory/etc/product_types.xml +++ b/app/code/Magento/CatalogInventory/etc/product_types.xml @@ -29,7 +29,4 @@ <type name="configurable"> <stockIndexerModel instance="Magento\CatalogInventory\Model\Resource\Indexer\Stock\Configurable" /> </type> - <type name="grouped"> - <stockIndexerModel instance="Magento\CatalogInventory\Model\Resource\Indexer\Stock\Grouped" /> - </type> </config> diff --git a/app/code/Magento/CatalogRule/Model/Observer.php b/app/code/Magento/CatalogRule/Model/Observer.php index 32065adc29a..219ab91e2b9 100644 --- a/app/code/Magento/CatalogRule/Model/Observer.php +++ b/app/code/Magento/CatalogRule/Model/Observer.php @@ -74,7 +74,7 @@ class Observer /** * @var \Magento\CatalogRule\Model\Resource\Rule\CollectionFactory */ - protected $_ruleCollFactory; + protected $_ruleCollectionFactory; /** * @var \Magento\Core\Model\StoreManagerInterface @@ -104,7 +104,7 @@ class Observer /** * @param Resource\RuleFactory $resourceRuleFactory * @param Resource\Rule $resourceRule - * @param Resource\Rule\CollectionFactory $ruleCollFactory + * @param Resource\Rule\CollectionFactory $ruleCollectionFactory * @param Rule\Product\Price $productPrice * @param RuleFactory $ruleFactory * @param FlagFactory $flagFactory @@ -121,7 +121,7 @@ class Observer public function __construct( Resource\RuleFactory $resourceRuleFactory, Resource\Rule $resourceRule, - Resource\Rule\CollectionFactory $ruleCollFactory, + Resource\Rule\CollectionFactory $ruleCollectionFactory, Rule\Product\Price $productPrice, RuleFactory $ruleFactory, FlagFactory $flagFactory, @@ -135,7 +135,7 @@ class Observer ) { $this->_resourceRuleFactory = $resourceRuleFactory; $this->_resourceRule = $resourceRule; - $this->_ruleCollFactory = $ruleCollFactory; + $this->_ruleCollectionFactory = $ruleCollectionFactory; $this->_productPrice = $productPrice; $this->_ruleFactory = $ruleFactory; $this->_flagFactory = $flagFactory; @@ -163,7 +163,7 @@ class Observer $productWebsiteIds = $product->getWebsiteIds(); - $rules = $this->_ruleCollFactory->create() + $rules = $this->_ruleCollectionFactory->create() ->addFieldToFilter('is_active', 1); foreach ($rules as $rule) { @@ -385,7 +385,7 @@ class Observer protected function _checkCatalogRulesAvailability($attributeCode) { /* @var $collection \Magento\CatalogRule\Model\Resource\Rule\Collection */ - $collection = $this->_ruleCollFactory->create() + $collection = $this->_ruleCollectionFactory->create() ->addAttributeInConditionFilter($attributeCode); $disabledRulesCount = 0; @@ -525,7 +525,7 @@ class Observer return; } - $rules = $this->_ruleCollFactory->create() + $rules = $this->_ruleCollectionFactory->create() ->addFieldToFilter('is_active', 1); foreach ($rules as $rule) { diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php index 0619a7be3fd..f55393e32ba 100644 --- a/app/code/Magento/CatalogRule/Model/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Rule.php @@ -143,7 +143,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel /** * @var \Magento\CatalogRule\Model\Rule\Action\CollectionFactory */ - protected $_actionCollFactory; + protected $_actionCollectionFactory; /** * @var \Magento\Catalog\Model\ProductFactory @@ -158,7 +158,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel /** * @var \Magento\Catalog\Model\Resource\Product\CollectionFactory */ - protected $_productCollFactory; + protected $_productCollectionFactory; /** * @var \Magento\Stdlib\DateTime @@ -170,10 +170,10 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory + * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\CatalogRule\Model\Rule\Condition\CombineFactory $combineFactory - * @param \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollFactory + * @param \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Core\Model\Resource\Iterator $resourceIterator * @param \Magento\Index\Model\Indexer $indexer @@ -191,10 +191,10 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\LocaleInterface $locale, - \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\CatalogRule\Model\Rule\Condition\CombineFactory $combineFactory, - \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollFactory, + \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Core\Model\Resource\Iterator $resourceIterator, \Magento\Index\Model\Indexer $indexer, @@ -207,10 +207,10 @@ class Rule extends \Magento\Rule\Model\AbstractModel array $relatedCacheTypes = array(), array $data = array() ) { - $this->_productCollFactory = $productCollFactory; + $this->_productCollectionFactory = $productCollectionFactory; $this->_storeManager = $storeManager; $this->_combineFactory = $combineFactory; - $this->_actionCollFactory = $actionCollFactory; + $this->_actionCollectionFactory = $actionCollectionFactory; $this->_productFactory = $productFactory; $this->_resourceIterator = $resourceIterator; $this->_indexer = $indexer; @@ -249,7 +249,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel */ public function getActionsInstance() { - return $this->_actionCollFactory->create(); + return $this->_actionCollectionFactory->create(); } /** @@ -302,7 +302,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel if ($this->getWebsiteIds()) { /** @var $productCollection \Magento\Catalog\Model\Resource\Product\Collection */ - $productCollection = $this->_productCollFactory->create(); + $productCollection = $this->_productCollectionFactory->create(); $productCollection->addWebsiteFilter($this->getWebsiteIds()); if ($this->_productsFilter) { $productCollection->addIdFilter($this->_productsFilter); diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php index f01e921d48a..d78e8c89482 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php @@ -69,7 +69,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb /** * @var \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory */ - protected $_productAttributeCollFactory; + protected $_productAttributeCollectionFactory; /** * Catalog product status @@ -149,7 +149,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Catalog\Model\Product\Type $catalogProductType * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Catalog\Model\Product\Status $catalogProductStatus - * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $productAttributeCollFactory + * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $productAttributeCollectionFactory * @param EngineProvider $engineProvider * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Filter\FilterManager $filter @@ -164,7 +164,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Eav\Model\Config $eavConfig, \Magento\Catalog\Model\Product\Status $catalogProductStatus, - \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $productAttributeCollFactory, + \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $productAttributeCollectionFactory, \Magento\CatalogSearch\Model\Resource\EngineProvider $engineProvider, \Magento\Event\ManagerInterface $eventManager, \Magento\Filter\FilterManager $filter, @@ -177,7 +177,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_catalogProductType = $catalogProductType; $this->_eavConfig = $eavConfig; $this->_catalogProductStatus = $catalogProductStatus; - $this->_productAttributeCollFactory = $productAttributeCollFactory; + $this->_productAttributeCollectionFactory = $productAttributeCollectionFactory; $this->_eventManager = $eventManager; $this->filter = $filter; $this->_catalogSearchData = $catalogSearchData; @@ -544,7 +544,7 @@ class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb if (null === $this->_searchableAttributes) { $this->_searchableAttributes = array(); - $productAttributes = $this->_productAttributeCollFactory->create(); + $productAttributes = $this->_productAttributeCollectionFactory->create(); if ($this->_engineProvider->get() && $this->_engineProvider->get()->allowAdvancedIndex()) { $productAttributes->addToIndexFilter(true); diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php index c12292e8eec..7b3c61ec31a 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php @@ -49,14 +49,14 @@ class Engine extends \Magento\Core\Model\Resource\Db\AbstractDb * * @var \Magento\CatalogSearch\Model\Resource\Fulltext\CollectionFactory */ - protected $_catalogSearchFulltextCollFactory; + protected $_catalogSearchFulltextCollectionFactory; /** * Catalog search advanced coll factory * * @var \Magento\CatalogSearch\Model\Resource\Advanced\CollectionFactory */ - protected $_catalogSearchAdvancedCollFactory; + protected $_catalogSearchAdvancedCollectionFactory; /** * @var \Magento\CatalogSearch\Model\Resource\Advanced @@ -86,8 +86,8 @@ class Engine extends \Magento\Core\Model\Resource\Db\AbstractDb * Construct * * @param \Magento\App\Resource $resource - * @param \Magento\CatalogSearch\Model\Resource\Advanced\CollectionFactory $catalogSearchAdvancedCollFactory - * @param \Magento\CatalogSearch\Model\Resource\Fulltext\CollectionFactory $catalogSearchFulltextCollFactory + * @param \Magento\CatalogSearch\Model\Resource\Advanced\CollectionFactory $catalogSearchAdvancedCollectionFactory + * @param \Magento\CatalogSearch\Model\Resource\Fulltext\CollectionFactory $catalogSearchFulltextCollectionFactory * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\CatalogSearch\Model\Resource\Advanced $searchResource * @param \Magento\CatalogSearch\Model\Resource\Advanced\Collection $searchResourceCollection @@ -96,16 +96,16 @@ class Engine extends \Magento\Core\Model\Resource\Db\AbstractDb */ public function __construct( \Magento\App\Resource $resource, - \Magento\CatalogSearch\Model\Resource\Advanced\CollectionFactory $catalogSearchAdvancedCollFactory, - \Magento\CatalogSearch\Model\Resource\Fulltext\CollectionFactory $catalogSearchFulltextCollFactory, + \Magento\CatalogSearch\Model\Resource\Advanced\CollectionFactory $catalogSearchAdvancedCollectionFactory, + \Magento\CatalogSearch\Model\Resource\Fulltext\CollectionFactory $catalogSearchFulltextCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\CatalogSearch\Model\Resource\Advanced $searchResource, \Magento\CatalogSearch\Model\Resource\Advanced\Collection $searchResourceCollection, \Magento\CatalogSearch\Helper\Data $catalogSearchData, \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper ) { - $this->_catalogSearchAdvancedCollFactory = $catalogSearchAdvancedCollFactory; - $this->_catalogSearchFulltextCollFactory = $catalogSearchFulltextCollFactory; + $this->_catalogSearchAdvancedCollectionFactory = $catalogSearchAdvancedCollectionFactory; + $this->_catalogSearchFulltextCollectionFactory = $catalogSearchFulltextCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; $this->_searchResource = $searchResource; $this->_searchResourceCollection = $searchResourceCollection; @@ -255,7 +255,7 @@ class Engine extends \Magento\Core\Model\Resource\Db\AbstractDb */ public function getResultCollection() { - return $this->_catalogSearchFulltextCollFactory->create(); + return $this->_catalogSearchFulltextCollectionFactory->create(); } /** @@ -265,7 +265,7 @@ class Engine extends \Magento\Core\Model\Resource\Db\AbstractDb */ public function getAdvancedResultCollection() { - return $this->_catalogSearchAdvancedCollFactory->create(); + return $this->_catalogSearchAdvancedCollectionFactory->create(); } /** diff --git a/app/code/Magento/Centinel/Block/Authentication.php b/app/code/Magento/Centinel/Block/Authentication.php index cb7bf543f18..77a1a694f49 100644 --- a/app/code/Magento/Centinel/Block/Authentication.php +++ b/app/code/Magento/Centinel/Block/Authentication.php @@ -65,6 +65,7 @@ class Authentication extends \Magento\View\Element\Template ) { $this->_checkoutSession = $checkoutSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Centinel/etc/module.xml b/app/code/Magento/Centinel/etc/module.xml index d7d8567123f..9294272d60c 100755 --- a/app/code/Magento/Centinel/etc/module.xml +++ b/app/code/Magento/Centinel/etc/module.xml @@ -34,6 +34,7 @@ <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_Theme"/> + <module name="Magento_Sales"/> </depends> </module> </config> diff --git a/app/code/Magento/Centinel/view/frontend/layout/checkout_multishipping_overview.xml b/app/code/Magento/Centinel/view/frontend/layout/multishipping_checkout_overview.xml similarity index 100% rename from app/code/Magento/Centinel/view/frontend/layout/checkout_multishipping_overview.xml rename to app/code/Magento/Centinel/view/frontend/layout/multishipping_checkout_overview.xml diff --git a/app/code/Magento/Checkout/Block/Agreements.php b/app/code/Magento/Checkout/Block/Agreements.php index 38852805665..161b2c2cb50 100644 --- a/app/code/Magento/Checkout/Block/Agreements.php +++ b/app/code/Magento/Checkout/Block/Agreements.php @@ -30,19 +30,19 @@ class Agreements extends \Magento\View\Element\Template /** * @var \Magento\Checkout\Model\Resource\Agreement\CollectionFactory */ - protected $_agreementCollFactory; + protected $_agreementCollectionFactory; /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollFactory + * @param \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollFactory, + \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory, array $data = array() ) { - $this->_agreementCollFactory = $agreementCollFactory; + $this->_agreementCollectionFactory = $agreementCollectionFactory; parent::__construct($context, $data); } @@ -56,7 +56,7 @@ class Agreements extends \Magento\View\Element\Template $agreements = array(); } else { /** @var \Magento\Checkout\Model\Resource\Agreement\Collection $agreements */ - $agreements = $this->_agreementCollFactory->create() + $agreements = $this->_agreementCollectionFactory->create() ->addStoreFilter($this->_storeManager->getStore()->getId()) ->addFieldToFilter('is_active', 1); } diff --git a/app/code/Magento/Checkout/Block/Cart.php b/app/code/Magento/Checkout/Block/Cart.php index 950f7d905a7..658a01cb0ee 100644 --- a/app/code/Magento/Checkout/Block/Cart.php +++ b/app/code/Magento/Checkout/Block/Cart.php @@ -66,6 +66,7 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart $this->_cartHelper = $cartHelper; $this->_catalogUrlBuilder = $catalogUrlBuilder; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Block/Cart/AbstractCart.php b/app/code/Magento/Checkout/Block/Cart/AbstractCart.php index 527e7fbea26..969b1860d9b 100644 --- a/app/code/Magento/Checkout/Block/Cart/AbstractCart.php +++ b/app/code/Magento/Checkout/Block/Cart/AbstractCart.php @@ -80,6 +80,7 @@ class AbstractCart extends \Magento\View\Element\Template $this->_checkoutSession = $checkoutSession; $this->_catalogData = $catalogData; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Block/Cart/Coupon.php b/app/code/Magento/Checkout/Block/Cart/Coupon.php index f1e6ee2cf61..275ce2099d3 100644 --- a/app/code/Magento/Checkout/Block/Cart/Coupon.php +++ b/app/code/Magento/Checkout/Block/Cart/Coupon.php @@ -29,6 +29,24 @@ namespace Magento\Checkout\Block\Cart; class Coupon extends \Magento\Checkout\Block\Cart\AbstractCart { + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Catalog\Helper\Data $catalogData + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Catalog\Helper\Data $catalogData, + \Magento\Customer\Model\Session $customerSession, + \Magento\Checkout\Model\Session $checkoutSession, + array $data = array() + ) { + parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + $this->_isScopePrivate = true; + } + public function getCouponCode() { return $this->getQuote()->getCouponCode(); diff --git a/app/code/Magento/Checkout/Block/Cart/Crosssell.php b/app/code/Magento/Checkout/Block/Cart/Crosssell.php index 516c1e3381f..b162fdd602f 100644 --- a/app/code/Magento/Checkout/Block/Cart/Crosssell.php +++ b/app/code/Magento/Checkout/Block/Cart/Crosssell.php @@ -79,6 +79,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\CatalogInventory\Model\Stock $stock * @param \Magento\Catalog\Model\Product\LinkFactory $productLinkFactory * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -98,7 +99,8 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\CatalogInventory\Model\Stock $stock, \Magento\Catalog\Model\Product\LinkFactory $productLinkFactory, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_checkoutSession = $checkoutSession; $this->_productVisibility = $productVisibility; @@ -116,8 +118,10 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } /** @@ -211,7 +215,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct foreach ($this->getQuote()->getAllItems() as $quoteItem) { $productTypeOpt = $quoteItem->getOptionByCode('product_type'); if ($productTypeOpt instanceof \Magento\Sales\Model\Quote\Item\Option - && $productTypeOpt->getValue() == \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE + && $productTypeOpt->getValue() == \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE && $productTypeOpt->getProductId() ) { $productIds[] = $productTypeOpt->getProductId(); diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php index 3ce2a6ed861..4b290598b16 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer.php @@ -103,6 +103,7 @@ class Renderer extends \Magento\View\Element\Template $this->_checkoutSession = $checkoutSession; $this->messageManager = $messageManager; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Configurable.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Configurable.php index d23047f0284..d1dcfc14c35 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Configurable.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Configurable.php @@ -36,6 +36,36 @@ class Configurable extends \Magento\Checkout\Block\Cart\Item\Renderer */ const CONFIG_THUMBNAIL_SOURCE = 'checkout/cart/configurable_product_image'; + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Catalog\Helper\Product\Configuration $productConfig + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Core\Helper\Url $urlHelper + * @param \Magento\Message\ManagerInterface $messageManager + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Catalog\Helper\Product\Configuration $productConfig, + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Core\Helper\Url $urlHelper, + \Magento\Message\ManagerInterface $messageManager, + array $data = array() + ) { + parent::__construct( + $context, + $productConfig, + $checkoutSession, + $imageHelper, + $urlHelper, + $messageManager, + $data + ); + $this->_isScopePrivate = true; + } + /** * Get item configurable child product * diff --git a/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Grouped.php b/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Grouped.php index c32bddc20a2..4e012a9426f 100644 --- a/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Grouped.php +++ b/app/code/Magento/Checkout/Block/Cart/Item/Renderer/Grouped.php @@ -36,6 +36,36 @@ class Grouped extends \Magento\Checkout\Block\Cart\Item\Renderer */ const CONFIG_THUMBNAIL_SOURCE = 'checkout/cart/grouped_product_image'; + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Catalog\Helper\Product\Configuration $productConfig + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Core\Helper\Url $urlHelper + * @param \Magento\Message\ManagerInterface $messageManager + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Catalog\Helper\Product\Configuration $productConfig, + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Core\Helper\Url $urlHelper, + \Magento\Message\ManagerInterface $messageManager, + array $data = array() + ) { + parent::__construct( + $context, + $productConfig, + $checkoutSession, + $imageHelper, + $urlHelper, + $messageManager, + $data + ); + $this->_isScopePrivate = true; + } + /** * Get item grouped product * diff --git a/app/code/Magento/Checkout/Block/Cart/Shipping.php b/app/code/Magento/Checkout/Block/Cart/Shipping.php index fa179d27a61..7d773b392cc 100644 --- a/app/code/Magento/Checkout/Block/Cart/Shipping.php +++ b/app/code/Magento/Checkout/Block/Cart/Shipping.php @@ -57,6 +57,11 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart */ protected $_taxHelper; + /** + * @var \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface + */ + protected $_carrierFactory; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Catalog\Helper\Data $catalogData @@ -64,6 +69,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Directory\Block\Data $directoryBlock * @param \Magento\Tax\Helper\Data $taxHelper + * @param \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory * @param array $data */ public function __construct( @@ -73,11 +79,14 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart \Magento\Checkout\Model\Session $checkoutSession, \Magento\Directory\Block\Data $directoryBlock, \Magento\Tax\Helper\Data $taxHelper, + \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, array $data = array() ) { - $this->_taxHelper = $taxHelper; $this->_directoryBlock = $directoryBlock; + $this->_taxHelper = $taxHelper; + $this->_carrierFactory = $carrierFactory; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + $this->_isScopePrivate = true; } /** @@ -264,7 +273,7 @@ class Shipping extends \Magento\Checkout\Block\Cart\AbstractCart foreach ($this->_rates as $rateGroup) { if (!empty($rateGroup)) { foreach ($rateGroup as $rate) { - $this->_carriers[] = $rate->getCarrierInstance(); + $this->_carriers[] = $this->_carrierFactory->get($rate->getCarrier()); } } } diff --git a/app/code/Magento/Checkout/Block/Cart/Sidebar.php b/app/code/Magento/Checkout/Block/Cart/Sidebar.php index bb11733e091..68d3ada702d 100644 --- a/app/code/Magento/Checkout/Block/Cart/Sidebar.php +++ b/app/code/Magento/Checkout/Block/Cart/Sidebar.php @@ -105,6 +105,7 @@ class Sidebar extends \Magento\Checkout\Block\Cart\AbstractCart $this->_taxConfig = $taxConfig; $this->_checkoutCart = $checkoutCart; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Block/Cart/Totals.php b/app/code/Magento/Checkout/Block/Cart/Totals.php index 778fe52bf5b..b0d1098508a 100644 --- a/app/code/Magento/Checkout/Block/Cart/Totals.php +++ b/app/code/Magento/Checkout/Block/Cart/Totals.php @@ -55,6 +55,7 @@ class Totals extends \Magento\Checkout\Block\Cart\AbstractCart ) { $this->_salesConfig = $salesConfig; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $data); + $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Checkout/Block/Onepage.php b/app/code/Magento/Checkout/Block/Onepage.php index c38932ef2fd..127bf5f6716 100644 --- a/app/code/Magento/Checkout/Block/Onepage.php +++ b/app/code/Magento/Checkout/Block/Onepage.php @@ -35,6 +35,38 @@ namespace Magento\Checkout\Block; class Onepage extends \Magento\Checkout\Block\Onepage\AbstractOnepage { + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\App\Cache\Type\Config $configCacheType + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Checkout\Model\Session $resourceSession + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Core\Helper\Data $coreData, + \Magento\App\Cache\Type\Config $configCacheType, + \Magento\Customer\Model\Session $customerSession, + \Magento\Checkout\Model\Session $resourceSession, + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, + array $data = array() + ) { + parent::__construct( + $context, + $coreData, + $configCacheType, + $customerSession, + $resourceSession, + $countryCollFactory, + $regionCollFactory, + $data + ); + $this->_isScopePrivate = true; + } /** * Get 'one step checkout' step data * diff --git a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php b/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php index 44d8aa13059..9958455c25c 100644 --- a/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php +++ b/app/code/Magento/Checkout/Block/Onepage/AbstractOnepage.php @@ -52,12 +52,12 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template /** * @var \Magento\Directory\Model\Resource\Region\CollectionFactory */ - protected $_regionCollFactory; + protected $_regionCollectionFactory; /** * @var \Magento\Directory\Model\Resource\Country\CollectionFactory */ - protected $_countryCollFactory; + protected $_countryCollectionFactory; /** * @var \Magento\Core\Helper\Data @@ -70,8 +70,8 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $resourceSession - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory * @param array $data */ public function __construct( @@ -80,17 +80,18 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template \Magento\App\Cache\Type\Config $configCacheType, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $resourceSession, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, array $data = array() ) { $this->_coreData = $coreData; $this->_configCacheType = $configCacheType; $this->_customerSession = $customerSession; $this->_checkoutSession = $resourceSession; - $this->_countryCollFactory = $countryCollFactory; - $this->_regionCollFactory = $regionCollFactory; + $this->_countryCollectionFactory = $countryCollectionFactory; + $this->_regionCollectionFactory = $regionCollectionFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** @@ -148,7 +149,7 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template public function getCountryCollection() { if (!$this->_countryCollection) { - $this->_countryCollection = $this->_countryCollFactory->create()->loadByStore(); + $this->_countryCollection = $this->_countryCollectionFactory->create()->loadByStore(); } return $this->_countryCollection; } @@ -156,7 +157,7 @@ abstract class AbstractOnepage extends \Magento\View\Element\Template public function getRegionCollection() { if (!$this->_regionCollection) { - $this->_regionCollection = $this->_regionCollFactory->create() + $this->_regionCollection = $this->_regionCollectionFactory->create() ->addCountryFilter($this->getAddress()->getCountryId()) ->load(); } diff --git a/app/code/Magento/Checkout/Block/Onepage/Billing.php b/app/code/Magento/Checkout/Block/Onepage/Billing.php index 6fc8e11e870..b0f0f9914da 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Billing.php +++ b/app/code/Magento/Checkout/Block/Onepage/Billing.php @@ -61,8 +61,8 @@ class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $resourceSession - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory * @param \Magento\Sales\Model\Quote\AddressFactory $addressFactory * @param array $data */ @@ -72,8 +72,8 @@ class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage \Magento\App\Cache\Type\Config $configCacheType, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $resourceSession, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, \Magento\Sales\Model\Quote\AddressFactory $addressFactory, array $data = array() ) { @@ -84,10 +84,11 @@ class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage $configCacheType, $customerSession, $resourceSession, - $countryCollFactory, - $regionCollFactory, + $countryCollectionFactory, + $regionCollectionFactory, $data ); + $this->_isScopePrivate = true; } /** @@ -122,7 +123,7 @@ class Billing extends \Magento\Checkout\Block\Onepage\AbstractOnepage */ public function getCountries() { - return $this->_countryCollFactory->create()->loadByStore(); + return $this->_countryCollectionFactory->create()->loadByStore(); } /** diff --git a/app/code/Magento/Checkout/Block/Onepage/Failure.php b/app/code/Magento/Checkout/Block/Onepage/Failure.php index fd19d8759cc..7569ebe8e50 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Failure.php +++ b/app/code/Magento/Checkout/Block/Onepage/Failure.php @@ -46,6 +46,7 @@ class Failure extends \Magento\View\Element\Template ) { $this->_checkoutSession = $checkoutSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } public function getRealOrderId() diff --git a/app/code/Magento/Checkout/Block/Onepage/Link.php b/app/code/Magento/Checkout/Block/Onepage/Link.php index fd798d5ec68..6481984b0eb 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Link.php +++ b/app/code/Magento/Checkout/Block/Onepage/Link.php @@ -60,6 +60,7 @@ class Link extends \Magento\View\Element\Template $this->_checkoutHelper = $checkoutHelper; $this->_checkoutSession = $checkoutSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Block/Onepage/Login.php b/app/code/Magento/Checkout/Block/Onepage/Login.php index 35b8772ceee..59006e91e9b 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Login.php +++ b/app/code/Magento/Checkout/Block/Onepage/Login.php @@ -54,8 +54,8 @@ class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $resourceSession - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory * @param \Magento\Checkout\Helper\Data $checkoutData * @param \Magento\Message\ManagerInterface $messageManager * @param array $data @@ -66,8 +66,8 @@ class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage \Magento\App\Cache\Type\Config $configCacheType, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $resourceSession, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, \Magento\Checkout\Helper\Data $checkoutData, \Magento\Message\ManagerInterface $messageManager, array $data = array() @@ -81,10 +81,11 @@ class Login extends \Magento\Checkout\Block\Onepage\AbstractOnepage $configCacheType, $customerSession, $resourceSession, - $countryCollFactory, - $regionCollFactory, + $countryCollectionFactory, + $regionCollectionFactory, $data ); + $this->_isScopePrivate = true; } protected function _construct() diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php b/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php index 973275719e2..5b27f0066d8 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php +++ b/app/code/Magento/Checkout/Block/Onepage/Payment/Info.php @@ -25,7 +25,7 @@ */ /** - * Multishipping checkout payment information data + * Checkout payment information data * * @category Magento * @package Magento_Checkout @@ -54,6 +54,7 @@ class Info extends \Magento\Payment\Block\Info\AbstractContainer ) { $this->_checkoutSession = $checkoutSession; parent::__construct($context, $paymentData, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php b/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php index e26e8fb6add..e76b366ef8b 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php +++ b/app/code/Magento/Checkout/Block/Onepage/Payment/Methods.php @@ -55,6 +55,7 @@ class Methods extends \Magento\Payment\Block\Form\Container ) { $this->_checkoutSession = $checkoutSession; parent::__construct($context, $paymentHelper, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Block/Onepage/Review/Info.php b/app/code/Magento/Checkout/Block/Onepage/Review/Info.php index 0822e418fce..ebbddbe7640 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Review/Info.php +++ b/app/code/Magento/Checkout/Block/Onepage/Review/Info.php @@ -48,6 +48,7 @@ class Info extends \Magento\Sales\Block\Items\AbstractItems ) { $this->_checkoutSession = $checkoutSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping.php b/app/code/Magento/Checkout/Block/Onepage/Shipping.php index 7c72481fe9b..b0d132d7b32 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Shipping.php +++ b/app/code/Magento/Checkout/Block/Onepage/Shipping.php @@ -49,8 +49,8 @@ class Shipping extends \Magento\Checkout\Block\Onepage\AbstractOnepage * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $resourceSession - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory * @param \Magento\Sales\Model\Quote\AddressFactory $addressFactory * @param array $data */ @@ -60,8 +60,8 @@ class Shipping extends \Magento\Checkout\Block\Onepage\AbstractOnepage \Magento\App\Cache\Type\Config $configCacheType, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $resourceSession, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, \Magento\Sales\Model\Quote\AddressFactory $addressFactory, array $data = array() ) { @@ -72,10 +72,11 @@ class Shipping extends \Magento\Checkout\Block\Onepage\AbstractOnepage $configCacheType, $customerSession, $resourceSession, - $countryCollFactory, - $regionCollFactory, + $countryCollectionFactory, + $regionCollectionFactory, $data ); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php index b711a7354c3..bfbd855468a 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php +++ b/app/code/Magento/Checkout/Block/Onepage/Shipping/Method/Available.php @@ -52,8 +52,8 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Checkout\Model\Session $resourceSession - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory * @param \Magento\Tax\Helper\Data $taxData * @param array $data */ @@ -63,8 +63,8 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage \Magento\App\Cache\Type\Config $configCacheType, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $resourceSession, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, \Magento\Tax\Helper\Data $taxData, array $data = array() ) { @@ -75,10 +75,11 @@ class Available extends \Magento\Checkout\Block\Onepage\AbstractOnepage $configCacheType, $customerSession, $resourceSession, - $countryCollFactory, - $regionCollFactory, + $countryCollectionFactory, + $regionCollectionFactory, $data ); + $this->_isScopePrivate = true; } public function getShippingRates() diff --git a/app/code/Magento/Checkout/Block/Onepage/Success.php b/app/code/Magento/Checkout/Block/Onepage/Success.php index 5b9c090e234..5f1d1bd2fde 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Success.php +++ b/app/code/Magento/Checkout/Block/Onepage/Success.php @@ -92,6 +92,7 @@ class Success extends \Magento\View\Element\Template $this->_agreementFactory = $agreementFactory; $this->_recurringProfileCollectionFactory = $recurringProfileCollectionFactory; $this->_orderConfig = $orderConfig; + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Controller/Action.php b/app/code/Magento/Checkout/Controller/Action.php index 79fd08d23dd..5f8f808d314 100644 --- a/app/code/Magento/Checkout/Controller/Action.php +++ b/app/code/Magento/Checkout/Controller/Action.php @@ -26,7 +26,7 @@ /** - * Controller for onepage and multishipping checkouts + * Controller for onepage checkouts */ namespace Magento\Checkout\Controller; diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 49433023d49..3f637af2e71 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -63,7 +63,7 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @var \Magento\Checkout\Model\Resource\Agreement\CollectionFactory */ - protected $_agreementCollFactory; + protected $_agreementCollectionFactory; /** * @var \Magento\Email\Model\TemplateFactory @@ -76,7 +76,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollFactory + * @param \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory * @param \Magento\Email\Model\TemplateFactory $emailTemplFactory */ public function __construct( @@ -85,14 +85,14 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Core\Model\LocaleInterface $locale, - \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollFactory, + \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory, \Magento\Email\Model\TemplateFactory $emailTemplFactory ) { $this->_coreStoreConfig = $coreStoreConfig; $this->_storeManager = $storeManager; $this->_checkoutSession = $checkoutSession; $this->_locale = $locale; - $this->_agreementCollFactory = $agreementCollFactory; + $this->_agreementCollectionFactory = $agreementCollectionFactory; $this->_emailTemplFactory = $emailTemplFactory; parent::__construct($context); } @@ -133,7 +133,7 @@ class Data extends \Magento\App\Helper\AbstractHelper if (!$this->_coreStoreConfig->getConfigFlag('checkout/options/enable_agreements')) { $this->_agreements = array(); } else { - $this->_agreements = $this->_agreementCollFactory->create() + $this->_agreements = $this->_agreementCollectionFactory->create() ->addStoreFilter($this->_storeManager->getStore()->getId()) ->addFieldToFilter('is_active', 1) ->getAllIds(); diff --git a/app/code/Magento/Checkout/Helper/Url.php b/app/code/Magento/Checkout/Helper/Url.php index 5f785fb3cb8..3d53ca4a9b4 100644 --- a/app/code/Magento/Checkout/Helper/Url.php +++ b/app/code/Magento/Checkout/Helper/Url.php @@ -53,40 +53,6 @@ class Url extends \Magento\Core\Helper\Url return $this->_getUrl('checkout/onepage'); } - /** - * Multi Shipping (MS) checkout urls - */ - - /** - * Retrieve multishipping checkout url - * - * @return string - */ - public function getMSCheckoutUrl() - { - return $this->_getUrl('checkout/multishipping'); - } - - public function getMSLoginUrl() - { - return $this->_getUrl('checkout/multishipping/login', array('_secure'=>true, '_current'=>true)); - } - - public function getMSAddressesUrl() - { - return $this->_getUrl('checkout/multishipping/addresses'); - } - - public function getMSShippingAddressSavedUrl() - { - return $this->_getUrl('checkout/multishipping_address/shippingSaved'); - } - - public function getMSRegisterUrl() - { - return $this->_getUrl('checkout/multishipping/register'); - } - /** * One Page (OP) checkout urls */ diff --git a/app/code/Magento/Checkout/Model/Resource/Setup.php b/app/code/Magento/Checkout/Model/Resource/Setup.php index 34ce493b2cc..22e6cd9348a 100644 --- a/app/code/Magento/Checkout/Model/Resource/Setup.php +++ b/app/code/Magento/Checkout/Model/Resource/Setup.php @@ -45,7 +45,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup * @param \Magento\Core\Model\Resource\Setup\Context $context * @param string $resourceName * @param \Magento\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory * @param \Magento\Customer\Helper\Address $customerAddress * @param string $moduleName * @param string $connectionName @@ -54,13 +54,13 @@ class Setup extends \Magento\Eav\Model\Entity\Setup \Magento\Core\Model\Resource\Setup\Context $context, $resourceName, \Magento\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Customer\Helper\Address $customerAddress, $moduleName = 'Magento_Checkout', $connectionName = '' ) { $this->_customerAddress = $customerAddress; - parent::__construct($context, $resourceName, $cache, $attrGrCollFactory, $moduleName, $connectionName); + parent::__construct($context, $resourceName, $cache, $attrGroupCollectionFactory, $moduleName, $connectionName); } /** diff --git a/app/code/Magento/Checkout/etc/frontend/di.xml b/app/code/Magento/Checkout/etc/frontend/di.xml index 0c0c1faabb9..dd1ef149300 100644 --- a/app/code/Magento/Checkout/etc/frontend/di.xml +++ b/app/code/Magento/Checkout/etc/frontend/di.xml @@ -33,7 +33,6 @@ <param name="secureUrlList"> <value> <checkout_onepage>/checkout/onepage</checkout_onepage> - <checkout_multishipping>/checkout/multishipping</checkout_multishipping> </value> </param> </type> diff --git a/app/code/Magento/Checkout/etc/frontend/page_types.xml b/app/code/Magento/Checkout/etc/frontend/page_types.xml index 7b7c368b91f..688528fbfa1 100644 --- a/app/code/Magento/Checkout/etc/frontend/page_types.xml +++ b/app/code/Magento/Checkout/etc/frontend/page_types.xml @@ -26,21 +26,6 @@ <page_types> <type id="checkout_cart_configure" label="Configure Cart Item (Any)"/> <type id="checkout_cart_index" label="Shopping Cart"/> - <type id="checkout_cart_multishipping" label="Catalog Quick Search Form Suggestions"/> - <type id="checkout_cart_multishipping_address_editaddress" label="Multishipping Checkout One Address Edit Form"/> - <type id="checkout_cart_multishipping_address_editbilling" label="Multishipping Checkout Billing Address Edit Form"/> - <type id="checkout_cart_multishipping_address_editshipping" label="Multishipping Checkout Shipping Address Edit Form"/> - <type id="checkout_cart_multishipping_address_newbilling" label="Multishipping Checkout Billing Address Creation"/> - <type id="checkout_cart_multishipping_address_newshipping" label="Multishipping Checkout Shipping Address Creation"/> - <type id="checkout_cart_multishipping_address_selectbilling" label="Multishipping Checkout Billing Address Selection"/> - <type id="checkout_cart_multishipping_addresses" label="Multishipping Checkout Address (Any) Form"/> - <type id="checkout_cart_multishipping_billing" label="Multishipping Checkout Billing Information Step"/> - <type id="checkout_cart_multishipping_customer_address" label="Multishipping Checkout Customer Address Edit Form"/> - <type id="checkout_cart_multishipping_login" label="Multishipping Checkout Login User Form"/> - <type id="checkout_cart_multishipping_overview" label="Multishipping Checkout Overview"/> - <type id="checkout_cart_multishipping_register" label="Multishipping Checkout Register User Form"/> - <type id="checkout_cart_multishipping_shipping" label="Multishipping Checkout Shipping Information Step"/> - <type id="checkout_cart_multishipping_success" label="Multishipping Checkout Success"/> <type id="checkout_onepage_failure" label="One Page Checkout Failure"/> <type id="checkout_onepage_index" label="One Page Checkout"/> <type id="checkout_onepage_paymentmethod" label="One Page Checkout Choose Payment Method"/> diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml index 5527e10adbe..13abefbbf37 100755 --- a/app/code/Magento/Checkout/etc/module.xml +++ b/app/code/Magento/Checkout/etc/module.xml @@ -28,6 +28,7 @@ <sequence> <module name="Magento_Sales"/> <module name="Magento_CatalogInventory"/> + <module name="Magento_GroupedProduct" /> </sequence> <depends> <module name="Magento_Sales"/> @@ -35,6 +36,7 @@ <module name="Magento_Core"/> <module name="Magento_Customer"/> <module name="Magento_Catalog"/> + <module name="Magento_GroupedProduct" /> <module name="Magento_Payment"/> <module name="Magento_Tax"/> <module name="Magento_Directory"/> @@ -42,6 +44,9 @@ <module name="Magento_GiftMessage"/> <module name="Magento_Wishlist"/> <module name="Magento_Weee"/> + <module name="Magento_Backend"/> + <module name="Magento_Theme"/> + <module name="Magento_Email"/> </depends> </module> </config> diff --git a/app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php b/app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php index 2b09bb01af9..9d219fbe0e2 100644 --- a/app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php +++ b/app/code/Magento/Checkout/sql/checkout_setup/install-1.6.0.0.php @@ -598,160 +598,6 @@ $setup->insert($installer->getTable('eav_form_element'), array( 'sort_order' => $elementSort++ )); -/** - ***************************************************************************** - * checkout/multishipping/register/ - ***************************************************************************** - */ - -$setup->insert($installer->getTable('eav_form_type'), array( - 'code' => 'checkout_multishipping_register', - 'label' => 'checkout_multishipping_register', - 'is_system' => 1, - 'theme' => '', - 'store_id' => 0 -)); -$formTypeId = $setup->lastInsertId($installer->getTable('eav_form_type')); - -$setup->insert($installer->getTable('eav_form_type_entity'), array( - 'type_id' => $formTypeId, - 'entity_type_id' => $customerEntityTypeId -)); -$setup->insert($installer->getTable('eav_form_type_entity'), array( - 'type_id' => $formTypeId, - 'entity_type_id' => $addressEntityTypeId -)); - -$setup->insert($installer->getTable('eav_form_fieldset'), array( - 'type_id' => $formTypeId, - 'code' => 'general', - 'sort_order' => 1 -)); -$fieldsetId = $setup->lastInsertId($installer->getTable('eav_form_fieldset')); - -$setup->insert($installer->getTable('eav_form_fieldset_label'), array( - 'fieldset_id' => $fieldsetId, - 'store_id' => 0, - 'label' => 'Personal Information' -)); - -$elementSort = 0; -if ($showPrefix) { - $setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'prefix'), - 'sort_order' => $elementSort++ - )); -} -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'firstname'), - 'sort_order' => $elementSort++ -)); -if ($showMiddlename) { - $setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'middlename'), - 'sort_order' => $elementSort++ - )); -} -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'lastname'), - 'sort_order' => $elementSort++ -)); -if ($showSuffix) { - $setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'suffix'), - 'sort_order' => $elementSort++ - )); -} -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'email'), - 'sort_order' => $elementSort++ -)); -if ($showDob) { - $setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'dob'), - 'sort_order' => $elementSort++ - )); -} -if ($showTaxVat) { - $setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($customerEntityTypeId, 'taxvat'), - 'sort_order' => $elementSort++ - )); -} - -$setup->insert($installer->getTable('eav_form_fieldset'), array( - 'type_id' => $formTypeId, - 'code' => 'address', - 'sort_order' => 2 -)); -$fieldsetId = $setup->lastInsertId($installer->getTable('eav_form_fieldset')); - -$setup->insert($installer->getTable('eav_form_fieldset_label'), array( - 'fieldset_id' => $fieldsetId, - 'store_id' => 0, - 'label' => 'Address Information' -)); - -$elementSort = 0; -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'company'), - 'sort_order' => $elementSort++ -)); -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'telephone'), - 'sort_order' => $elementSort++ -)); -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'street'), - 'sort_order' => $elementSort++ -)); -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'city'), - 'sort_order' => $elementSort++ -)); -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'region'), - 'sort_order' => $elementSort++ -)); -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'postcode'), - 'sort_order' => $elementSort++ -)); -$setup->insert($installer->getTable('eav_form_element'), array( - 'type_id' => $formTypeId, - 'fieldset_id' => $fieldsetId, - 'attribute_id' => $installer->getAttributeId($addressEntityTypeId, 'country_id'), - 'sort_order' => $elementSort++ -)); - $table = $installer->getTable('core_config_data'); $select = $setup->select() diff --git a/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml b/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml index 4b98b3140c5..04d39084cbb 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/item/configure/updatecart.phtml @@ -22,12 +22,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var $this \Magento\Catalog\Block\Product\View */ ?> <?php $_product = $this->getProduct(); ?> <?php $buttonTitle = __('Update Cart'); ?> <?php if ($_product->isSaleable()): ?> <div class="box tocart update"> - <?php if (!$_product->isGrouped()): ?> + <?php if ($this->shouldRenderQuantity()): ?> <div class="field qty"> <label class="label" for="qty"><span><?php echo __('Qty') ?></span></label> <div class="control"> diff --git a/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml b/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml index 1aa9ca7c8fb..850a12f799a 100644 --- a/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml +++ b/app/code/Magento/Checkout/view/frontend/cart/item/default.phtml @@ -296,7 +296,7 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllowInCart()) : ?> <?php if ($isVisibleProduct): ?> - <a href="<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getMoveFromCartUrl($_item->getId()); ?>" class="use-ajax action towishlist"> + <a href="#" data-post='<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getMoveFromCartParams($_item->getId()); ?>' class="use-ajax action towishlist"> <span><?php echo __('Move to Wishlist'); ?></span> </a> <?php endif ?> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml index 173335470ba..dc6a482cee0 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml @@ -41,7 +41,6 @@ <block class="Magento\Checkout\Block\Cart" name="checkout.cart.methods.bottom" template="cart/methods.phtml" cacheable="false"> <container name="checkout.cart.methods" as="methods" label="Payment Methods After Checkout Button"> <block class="Magento\Checkout\Block\Onepage\Link" name="checkout.cart.methods.onepage.bottom" template="onepage/link.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Multishipping\Link" name="checkout.cart.methods.multishipping" template="multishipping/link.phtml" cacheable="false"/> </container> </block> <block class="Magento\Checkout\Block\Cart\Crosssell" name="checkout.cart.crosssell" template="Magento_Catalog::product/list/items.phtml" after="-" cacheable="false"> diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php index f592f48c3c5..64df4431b96 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php @@ -151,9 +151,9 @@ class Images extends \Magento\Backend\App\Action $path = $this->getStorage()->getSession()->getCurrentPath(); foreach ($files as $file) { $file = $helper->idDecode($file); - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $this->_objectManager->get('Magento\Filesystem'); - $dir = $filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = $this->_objectManager->get('Magento\App\Filesystem'); + $dir = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); $filePath = $path . '/' . $file; if ($dir->isFile($dir->getRelativePath($filePath))) { $this->getStorage()->deleteFile($filePath); diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index 9e7ebc3f883..6b7116a2fb9 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -83,14 +83,14 @@ class Images extends \Magento\App\Helper\AbstractHelper * @param \Magento\App\Helper\Context $context * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Backend\Helper\Data $backendData, \Magento\Core\Helper\Data $coreData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\StoreManagerInterface $storeManager ) { parent::__construct($context); @@ -98,7 +98,7 @@ class Images extends \Magento\App\Helper\AbstractHelper $this->_coreData = $coreData; $this->_storeManager = $storeManager; - $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_directory->create(\Magento\Cms\Model\Wysiwyg\Config::IMAGE_DIRECTORY); } diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php index ad7f4901c8e..f8e67392d67 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php @@ -147,7 +147,7 @@ class Storage extends \Magento\Object * @param \Magento\Backend\Model\Url $backendUrl * @param \Magento\Cms\Helper\Wysiwyg\Images $cmsWysiwygImages * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Image\AdapterFactory $imageFactory * @param \Magento\View\Url $viewUrl * @param \Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory $storageCollectionFactory @@ -167,7 +167,7 @@ class Storage extends \Magento\Object \Magento\Backend\Model\Url $backendUrl, \Magento\Cms\Helper\Wysiwyg\Images $cmsWysiwygImages, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Image\AdapterFactory $imageFactory, \Magento\View\Url $viewUrl, \Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory $storageCollectionFactory, @@ -184,7 +184,7 @@ class Storage extends \Magento\Object $this->_backendUrl = $backendUrl; $this->_cmsWysiwygImages = $cmsWysiwygImages; $this->_coreFileStorageDb = $coreFileStorageDb; - $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_imageFactory = $imageFactory; $this->_viewUrl = $viewUrl; $this->_storageCollectionFactory = $storageCollectionFactory; @@ -381,32 +381,29 @@ class Storage extends \Magento\Object */ public function deleteDirectory($path) { - // prevent accidental root directory deleting - $rootCmp = rtrim($this->_cmsWysiwygImages->getStorageRoot(), '/'); - $rootCmp = preg_replace('~[/\\\]+~', '/', $rootCmp); - $pathCmp = rtrim($path, '/'); - - if ($rootCmp == $pathCmp) { - throw new \Magento\Core\Exception( - __('We cannot delete root directory %1.', $path) - ); - } - if ($this->_coreFileStorageDb->checkDbUsage()) { $this->_directoryDatabaseFactory->create()->deleteDirectory($path); } try { - $this->_directory->delete($this->_directory->getRelativePath($path)); + $this->_deleteByPath($path); + $path = $this->getThumbnailRoot() . $this->_getRelativePathToRoot($path); + $this->_deleteByPath($path); } catch (\Magento\Filesystem\FilesystemException $e) { throw new \Magento\Core\Exception(__('We cannot delete directory %1.', $path)); } + } - if (strpos($pathCmp, $rootCmp) === 0) { - $this->_directory->delete( - $this->_directory->getRelativePath( - $this->getThumbnailRoot() . substr($pathCmp, strlen($rootCmp)) - ) - ); + /** + * Delete by path + * + * @param string $path + */ + protected function _deleteByPath($path) + { + $path = $this->_sanitizePath($path); + if (!empty($path)) { + $this->_validatePath($path); + $this->_directory->delete($this->_directory->getRelativePath($path)); } } @@ -658,4 +655,49 @@ class Storage extends \Magento\Object { return $this->_resizeParameters['height']; } + + /** + * Is path under storage root directory + * + * @param string $path + * + * @throws \Magento\Core\Exception + */ + protected function _validatePath($path) + { + $root = $this->_sanitizePath($this->_cmsWysiwygImages->getStorageRoot()); + if ($root == $path) { + throw new \Magento\Core\Exception(__('We cannot delete root directory %1.', $path)); + } + if (strpos($path, $root) !== 0) { + throw new \Magento\Core\Exception(__('Directory %1 is not under storage root path.', $path)); + } + } + + /** + * Sanitize path + * + * @param string $path + * + * @return string + */ + protected function _sanitizePath($path) + { + return rtrim(preg_replace('~[/\\\]+~', '/', $this->_directory->getDriver()->getRealPath($path)), '/'); + } + + /** + * Get path in root storage dir + * + * @param string $path + * + * @return string|bool + */ + protected function _getRelativePathToRoot($path) + { + return substr( + $this->_sanitizePath($path), + strlen($this->_sanitizePath($this->_cmsWysiwygImages->getStorageRoot())) + ); + } } diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php index 64c3777087c..2ccf1fffd41 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage/Collection.php @@ -36,15 +36,15 @@ namespace Magento\Cms\Model\Wysiwyg\Images\Storage; class Collection extends \Magento\Data\Collection\Filesystem { /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; /** * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ - public function __construct(\Magento\Core\Model\EntityFactory $entityFactory, \Magento\Filesystem $filesystem) + public function __construct(\Magento\Core\Model\EntityFactory $entityFactory, \Magento\App\Filesystem $filesystem) { $this->_filesystem = $filesystem; parent::__construct($entityFactory); @@ -53,7 +53,7 @@ class Collection extends \Magento\Data\Collection\Filesystem protected function _generateRow($filename) { $filename = preg_replace('~[/\\\]+~', '/', $filename); - $path = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $path = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); return array( 'filename' => $filename, 'basename' => basename($filename), diff --git a/app/code/Magento/Cms/etc/module.xml b/app/code/Magento/Cms/etc/module.xml index b14591291ed..62eae84d789 100644 --- a/app/code/Magento/Cms/etc/module.xml +++ b/app/code/Magento/Cms/etc/module.xml @@ -35,6 +35,8 @@ <module name="Magento_Widget"/> <module name="Magento_Backend"/> <module name="Magento_Catalog"/> + <module name="Magento_Email"/> + <module name="Magento_Install"/> </depends> </module> </config> diff --git a/app/code/Magento/Connect/Helper/Data.php b/app/code/Magento/Connect/Helper/Data.php index fa76f1b422d..afc081bda5a 100644 --- a/app/code/Magento/Connect/Helper/Data.php +++ b/app/code/Magento/Connect/Helper/Data.php @@ -31,7 +31,7 @@ namespace Magento\Connect\Helper; class Data extends \Magento\Core\Helper\Data { /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -51,7 +51,7 @@ class Data extends \Magento\Core\Helper\Data * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Locale $locale * @param \Magento\App\State $appState - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Convert\Xml $xmlConverter * @param bool $dbCompatibleMode */ @@ -61,12 +61,12 @@ class Data extends \Magento\Core\Helper\Data \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Locale $locale, \Magento\App\State $appState, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Convert\Xml $xmlConverter, $dbCompatibleMode = true ) { $this->filesystem = $filesystem; - $this->readDirectory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::VAR_DIR); + $this->readDirectory = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::VAR_DIR); $this->_xmlConverter = $xmlConverter; parent::__construct( $context, diff --git a/app/code/Magento/Connect/Model/Extension.php b/app/code/Magento/Connect/Model/Extension.php index b39a13a6844..13b11e5add2 100644 --- a/app/code/Magento/Connect/Model/Extension.php +++ b/app/code/Magento/Connect/Model/Extension.php @@ -46,7 +46,7 @@ class Extension extends \Magento\Object protected $_package; /** - * @var \Magento\Filesystem $filesystem + * @var \Magento\App\Filesystem $filesystem */ protected $filesystem; @@ -76,14 +76,14 @@ class Extension extends \Magento\Object * Constructor * * @param \Magento\Convert\ConvertArray $convertArray - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param Session $session * @param \Magento\Logger $logger * @param array $data */ public function __construct( \Magento\Convert\ConvertArray $convertArray, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Connect\Model\Session $session, \Magento\Logger $logger, array $data = array() @@ -91,7 +91,7 @@ class Extension extends \Magento\Object $this->_convertArray = $convertArray; $this->_session = $session; $this->filesystem = $filesystem; - $this->writeDirectory = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->writeDirectory = $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $this->logger = $logger; parent::__construct($data); diff --git a/app/code/Magento/Connect/Model/Extension/Collection.php b/app/code/Magento/Connect/Model/Extension/Collection.php index 238f5765bf8..7f365378e2c 100644 --- a/app/code/Magento/Connect/Model/Extension/Collection.php +++ b/app/code/Magento/Connect/Model/Extension/Collection.php @@ -45,7 +45,7 @@ class Collection extends \Magento\Data\Collection\Filesystem protected $_disallowedFilesMask = '/^package\.xml$/i'; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -58,13 +58,13 @@ class Collection extends \Magento\Data\Collection\Filesystem * Set base dir * * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ - public function __construct(\Magento\Core\Model\EntityFactory $entityFactory, \Magento\Filesystem $filesystem) + public function __construct(\Magento\Core\Model\EntityFactory $entityFactory, \Magento\App\Filesystem $filesystem) { parent::__construct($entityFactory); $this->filesystem = $filesystem; - $this->connectDirectory = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->connectDirectory = $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $this->connectDirectory->create('connect'); $this->addTargetDir($this->connectDirectory->getAbsolutePath('connect')); } diff --git a/app/code/Magento/Contacts/etc/module.xml b/app/code/Magento/Contacts/etc/module.xml index 06955bdf4c7..e4fa2ea264d 100755 --- a/app/code/Magento/Contacts/etc/module.xml +++ b/app/code/Magento/Contacts/etc/module.xml @@ -33,6 +33,7 @@ <module name="Magento_Customer"/> <module name="Magento_Backend"/> <module name="Magento_Cms"/> + <module name="Magento_Email"/> </depends> </module> </config> diff --git a/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php b/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php index 895aa9ad273..ad537e54a5c 100644 --- a/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php +++ b/app/code/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandler.php @@ -26,7 +26,7 @@ namespace Magento\Core\App\FrontController\Plugin; use Magento\Core\Model\StoreManager, - Magento\Filesystem; + Magento\App\Filesystem; class DispatchExceptionHandler { @@ -38,7 +38,7 @@ class DispatchExceptionHandler /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; diff --git a/app/code/Magento/Core/App/Media.php b/app/code/Magento/Core/App/Media.php index d9139d58152..ca7b14d16c0 100644 --- a/app/code/Magento/Core/App/Media.php +++ b/app/code/Magento/Core/App/Media.php @@ -89,7 +89,7 @@ class Media implements AppInterface protected $_response; /** - * @var \Magento\Filesystem $filesystem + * @var \Magento\App\Filesystem $filesystem */ protected $filesystem; @@ -108,7 +108,7 @@ class Media implements AppInterface * @param $mediaDirectory * @param $configCacheFile * @param $relativeFileName - * @param \Magento\Filesystem $filesytem + * @param \Magento\App\Filesystem $filesytem */ public function __construct( State $applicationState, @@ -120,7 +120,7 @@ class Media implements AppInterface $mediaDirectory, $configCacheFile, $relativeFileName, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_applicationState = $applicationState; $this->_objectManager = $objectManager; @@ -132,20 +132,20 @@ class Media implements AppInterface $this->_configCacheFile = $configCacheFile; $this->_relativeFileName = $relativeFileName; $this->filesystem = $filesystem; - $this->directory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + $this->directory = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); } /** - * Execute application + * Run application * - * @return int + * @return \Magento\App\ResponseInterface */ public function execute() { try { if (!$this->_applicationState->isInstalled()) { - $this->_response->sendNotFound(); - return -1; + $this->_response->setHttpResponseCode(404); + return $this->_response; } if (!$this->_mediaDirectory) { $config = $this->_objectManager->create( @@ -159,29 +159,28 @@ class Media implements AppInterface ); $isAllowed = $this->_isAllowed; if (!$isAllowed($this->_relativeFileName, $allowedResources)) { - $this->_response->sendNotFound(); - return -1; + $this->_response->setHttpResponseCode(404); + return $this->_response; } } if (0 !== stripos($this->_request->getPathInfo(), $this->_mediaDirectory . '/')) { - $this->_response->sendNotFound(); - return -1; + $this->_response->setHttpResponseCode(404); + return $this->_response; } $sync = $this->_objectManager->get('Magento\Core\Model\File\Storage\Synchronization'); $sync->synchronize($this->_relativeFileName, $this->_request->getFilePath()); if ($this->directory->isReadable($this->directory->getRelativePath($this->_request->getFilePath()))) { - $this->_response->sendFile($this->_request->getFilePath()); - return 0; + $this->_response->setFilePath($this->_request->getFilePath()); } else { - $this->_response->sendNotFound(); - return -1; + $this->_response->setHttpResponseCode(404); } + return $this->_response; } catch (\Magento\Core\Model\Store\Exception $e) { - $this->_response->sendNotFound(); - return -1; + $this->_response->setHttpResponseCode(404); + return $this->_response; } } } diff --git a/app/code/Magento/Core/Block/Formkey.php b/app/code/Magento/Core/Block/Formkey.php index 01fe4cef976..9408511ce4a 100644 --- a/app/code/Magento/Core/Block/Formkey.php +++ b/app/code/Magento/Core/Block/Formkey.php @@ -48,6 +48,7 @@ class Formkey extends \Magento\View\Element\Template ) { $this->formKey = $formKey; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Core/Helper/File/Media.php b/app/code/Magento/Core/Helper/File/Media.php index 800c4dc77bf..1f746651b13 100644 --- a/app/code/Magento/Core/Helper/File/Media.php +++ b/app/code/Magento/Core/Helper/File/Media.php @@ -37,7 +37,7 @@ class Media extends \Magento\App\Helper\AbstractHelper protected $_date; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -45,13 +45,13 @@ class Media extends \Magento\App\Helper\AbstractHelper * Constructor * * @param \Magento\App\Helper\Context $context - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Date $date */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Model\Date $date, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { parent::__construct($context); $this->_date = $date; @@ -77,7 +77,7 @@ class Media extends \Magento\App\Helper\AbstractHelper $path = ltrim($path, '\\/'); $fullPath = $mediaDirectory . '/' . $path; - $dir = $this->filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + $dir = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); $relativePath = $dir->getRelativePath($fullPath); if (!$dir->isFile($relativePath)) { throw new \Magento\Core\Exception(__('File %1 does not exist', $fullPath)); diff --git a/app/code/Magento/Core/Helper/File/Storage/Database.php b/app/code/Magento/Core/Helper/File/Storage/Database.php index 82e5e3e8192..f66897ce72e 100644 --- a/app/code/Magento/Core/Helper/File/Storage/Database.php +++ b/app/code/Magento/Core/Helper/File/Storage/Database.php @@ -62,7 +62,7 @@ class Database extends \Magento\App\Helper\AbstractHelper protected $_mediaBaseDirectory; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -85,14 +85,14 @@ class Database extends \Magento\App\Helper\AbstractHelper * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Model\File\Storage\DatabaseFactory $dbStorageFactory * @param \Magento\Core\Model\File\Storage\File $fileStorage - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\ConfigInterface $config */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Model\File\Storage\DatabaseFactory $dbStorageFactory, \Magento\Core\Model\File\Storage\File $fileStorage, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\ConfigInterface $config ) { $this->_filesystem = $filesystem; @@ -312,7 +312,7 @@ class Database extends \Magento\App\Helper\AbstractHelper $uniqueResultFile = $this->getUniqueFilename($path, $file); if ($uniqueResultFile !== $file) { - $dirWrite = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $dirWrite = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $dirWrite->renameFile($path . $file, $path . $uniqueResultFile); } $this->saveFile($path . $uniqueResultFile); @@ -343,7 +343,7 @@ class Database extends \Magento\App\Helper\AbstractHelper public function getMediaBaseDir() { if (null === $this->_mediaBaseDirectory) { - $mediaDir = $this->_filesystem->getPath(\Magento\Filesystem::MEDIA); + $mediaDir = $this->_filesystem->getPath(\Magento\App\Filesystem::MEDIA_DIR); $this->_mediaBaseDirectory = rtrim($mediaDir, '\\/'); } return $this->_mediaBaseDirectory; diff --git a/app/code/Magento/Core/Helper/PostData.php b/app/code/Magento/Core/Helper/PostData.php new file mode 100644 index 00000000000..0b6c19b7790 --- /dev/null +++ b/app/code/Magento/Core/Helper/PostData.php @@ -0,0 +1,84 @@ +<?php +/** + * Helper to obtain post data for postData widget + * + * @author Magento Core Team <core@magentocommerce.com> + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Core + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Core\Helper; + +class PostData extends \Magento\App\Helper\AbstractHelper +{ + /** + * Form key + * + * @var \Magento\Data\Form\FormKey + */ + protected $_formKey; + + /** + * @param \Magento\App\Helper\Context $context + * @param \Magento\Data\Form\FormKey $formKey + */ + public function __construct( + \Magento\App\Helper\Context $context, + \Magento\Data\Form\FormKey $formKey + ) { + parent::__construct($context); + $this->_formKey = $formKey; + } + + /** + * get data for post by javascript in format acceptable to $.mage.dataPost widget + * + * @param string $url + * @param array $data + * @return string + */ + public function getPostData($url, array $data = array()) + { + if (!isset($data['form_key'])) { + $data['form_key'] = $this->_formKey->getFormKey(); + } + if (!isset($data[\Magento\App\Action\Action::PARAM_NAME_URL_ENCODED])) { + $data[\Magento\App\Action\Action::PARAM_NAME_URL_ENCODED] = $this->getEncodedUrl(); + } + return json_encode(['action' => $url, 'data' => $data]); + } + + /** + * Get current encoded url + * + * @param string|null $url + * @return string + */ + public function getEncodedUrl($url = null) + { + if (!$url) { + $url = $this->_urlBuilder->getCurrentUrl(); + } + return $this->urlEncode($url); + } +} diff --git a/app/code/Magento/Core/Helper/Theme.php b/app/code/Magento/Core/Helper/Theme.php index 6d7a67521ef..3e8f8b6d42b 100644 --- a/app/code/Magento/Core/Helper/Theme.php +++ b/app/code/Magento/Core/Helper/Theme.php @@ -34,7 +34,7 @@ class Theme extends \Magento\App\Helper\AbstractHelper /** * Filesystem facade * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -59,14 +59,14 @@ class Theme extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Layout\ProcessorFactory $layoutProcessorFactory * @param \Magento\Core\Model\Resource\Theme\Collection $themeCollection * @param \Magento\View\FileSystem $viewFileSystem */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\Layout\ProcessorFactory $layoutProcessorFactory, \Magento\Core\Model\Resource\Theme\Collection $themeCollection, \Magento\View\FileSystem $viewFileSystem @@ -118,7 +118,7 @@ class Theme extends \Magento\App\Helper\AbstractHelper 'skipProxy' => true ); - $rootDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $rootDirectory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $files = array(); foreach ($elements as $fileId) { $fileId = (string)$fileId; @@ -145,9 +145,9 @@ class Theme extends \Magento\App\Helper\AbstractHelper */ public function getGroupedCssFiles($theme) { - $jsDir = $this->_filesystem->getPath(\Magento\Filesystem::PUB_LIB); - $codeDir = $this->_filesystem->getPath(\Magento\Filesystem::MODULES); - $designDir = $this->_filesystem->getPath(\Magento\Filesystem::THEMES); + $jsDir = $this->_filesystem->getPath(\Magento\App\Filesystem::PUB_LIB_DIR); + $codeDir = $this->_filesystem->getPath(\Magento\App\Filesystem::MODULES_DIR); + $designDir = $this->_filesystem->getPath(\Magento\App\Filesystem::THEMES_DIR); $groups = array(); $themes = array(); diff --git a/app/code/Magento/Core/Model/AbstractShell.php b/app/code/Magento/Core/Model/AbstractShell.php index a3857ca01cb..b4b2278c5d0 100644 --- a/app/code/Magento/Core/Model/AbstractShell.php +++ b/app/code/Magento/Core/Model/AbstractShell.php @@ -66,17 +66,17 @@ abstract class AbstractShell /** * Initializes application and parses input parameters * - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param string $entryPoint * @throws \Exception */ - public function __construct(\Magento\Filesystem $filesystem, $entryPoint) + public function __construct(\Magento\App\Filesystem $filesystem, $entryPoint) { if (isset($_SERVER['REQUEST_METHOD'])) { throw new \Exception('This script cannot be run from Browser. This is the shell script.'); } - $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->_entryPoint = $entryPoint; $this->_rawArgs = $_SERVER['argv']; $this->_applyPhpVariables(); diff --git a/app/code/Magento/Core/Model/App.php b/app/code/Magento/Core/Model/App.php index ece5761cca2..a3c9e3174cf 100644 --- a/app/code/Magento/Core/Model/App.php +++ b/app/code/Magento/Core/Model/App.php @@ -53,7 +53,7 @@ class App implements \Magento\Core\Model\AppInterface /** * Magento version */ - const VERSION = '2.0.0.0-dev61'; + const VERSION = '2.0.0.0-dev62'; /** @@ -423,9 +423,9 @@ class App implements \Magento\Core\Model\AppInterface public function cleanAllSessions() { if (session_module_name() == 'files') { - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $this->_objectManager->create('Magento\Filesystem'); - $sessionDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::SESSION); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = $this->_objectManager->create('Magento\App\Filesystem'); + $sessionDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::SESSION_DIR); foreach ($sessionDirectory->read() as $path) { $sessionDirectory->delete($path); } @@ -804,7 +804,7 @@ class App implements \Magento\Core\Model\AppInterface 'revision' => '0', 'patch' => '0', 'stability' => 'dev', - 'number' => '61', + 'number' => '62', ); } } diff --git a/app/code/Magento/Core/Model/Asset/Plugin/CleanMergedJsCss.php b/app/code/Magento/Core/Model/Asset/Plugin/CleanMergedJsCss.php index 25ffc178db3..e7363b8f71e 100644 --- a/app/code/Magento/Core/Model/Asset/Plugin/CleanMergedJsCss.php +++ b/app/code/Magento/Core/Model/Asset/Plugin/CleanMergedJsCss.php @@ -32,17 +32,17 @@ class CleanMergedJsCss protected $database; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; /** * @param \Magento\Core\Helper\File\Storage\Database $database - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Core\Helper\File\Storage\Database $database, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->database = $database; $this->filesystem = $filesystem; @@ -59,7 +59,7 @@ class CleanMergedJsCss $invocationChain->proceed($arguments); /** @var \Magento\Filesystem\Directory\ReadInterface $pubCacheDirectory */ - $pubCacheDirectory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::PUB_VIEW_CACHE); + $pubCacheDirectory = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR); $mergedDir = $pubCacheDirectory->getAbsolutePath() . '/' . \Magento\View\Asset\Merged::PUBLIC_MERGE_DIR; $this->database->deleteFolder($mergedDir); } diff --git a/app/code/Magento/Core/Model/Config/FileResolver.php b/app/code/Magento/Core/Model/Config/FileResolver.php index da923c0ab5f..5b9e320adb6 100644 --- a/app/code/Magento/Core/Model/Config/FileResolver.php +++ b/app/code/Magento/Core/Model/Config/FileResolver.php @@ -41,12 +41,12 @@ class FileResolver implements \Magento\Config\FileResolverInterface /** * @param \Magento\Module\Dir\Reader $moduleReader - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Config\FileIteratorFactory $iteratorFactory */ public function __construct( \Magento\Module\Dir\Reader $moduleReader, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Config\FileIteratorFactory $iteratorFactory ) { $this->iteratorFactory = $iteratorFactory; @@ -61,7 +61,7 @@ class FileResolver implements \Magento\Config\FileResolverInterface { switch ($scope) { case 'primary': - $directory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); + $directory = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::CONFIG_DIR); $iterator = $this->iteratorFactory->create( $directory, $directory->search('{' . $filename . ',*/' . $filename . '}') diff --git a/app/code/Magento/Core/Model/DataService/Config.php b/app/code/Magento/Core/Model/DataService/Config.php deleted file mode 100644 index d8edd40476d..00000000000 --- a/app/code/Magento/Core/Model/DataService/Config.php +++ /dev/null @@ -1,166 +0,0 @@ -<?php -/** - * This class reads config.xml of modules, and provides interface to the configuration of service calls. - * - * Service calls are defined in service_calls.xml files in etc directory of the modules. - * Additionally, reference to service_calls.xml file is configured in config.xml file. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class Config implements \Magento\Core\Model\DataService\ConfigInterface -{ - /** Xpath to service call */ - const SERVICE_CALLS_XPATH = '/service_calls/service_call'; - - /** @var \Magento\Core\Model\DataService\Config\Reader\Factory */ - protected $_readerFactory; - - /** @var \Magento\Core\Model\DataService\Config\Reader */ - protected $_reader; - - /** @var array $_serviceCallNodes */ - protected $_serviceCallNodes; - - /** @var \Magento\Module\Dir\Reader */ - protected $_moduleReader; - - /** - * @param Config\Reader\Factory $readerFactory - * @param \Magento\Module\Dir\Reader $moduleReader - */ - public function __construct( - \Magento\Core\Model\DataService\Config\Reader\Factory $readerFactory, - \Magento\Module\Dir\Reader $moduleReader - ) { - $this->_readerFactory = $readerFactory; - $this->_moduleReader = $moduleReader; - $this->_indexServiceCallNodes(); - } - - /** - * Build an index of service calls nodes to avoid expensive xpath calls - * - * @return \Magento\Core\Model\DataService\Config $this - */ - private function _indexServiceCallNodes() - { - /** @var \DOMElement $node */ - foreach ($this->getServiceCalls() as $node) { - $this->_serviceCallNodes[$node->getAttribute('name')] = $node; - } - return $this; - } - - /** - * Reader object initialization. - * - * @return \Magento\Core\Model\DataService\Config\Reader - */ - protected function _getReader() - { - if (is_null($this->_reader)) { - $serviceCallsFiles = $this->_getServiceCallsFiles(); - $this->_reader = $this->_readerFactory->createReader($serviceCallsFiles); - } - return $this->_reader; - } - - /** - * Retrieve list of service calls files from each module. - * - * @return array - */ - protected function _getServiceCallsFiles() - { - return $this->_moduleReader->getConfigurationFiles('service_calls.xml'); - } - - /** - * Get \DOMXPath with loaded service calls inside. - * - * @return \DOMXPath - */ - protected function _getXPathServiceCalls() - { - $serviceCalls = $this->_getReader()->getServiceCallConfig(); - return new \DOMXPath($serviceCalls); - } - - /** - * Return Service Calls. - * - * @return \DOMNodeList - */ - public function getServiceCalls() - { - return $this->_getXPathServiceCalls()->query(self::SERVICE_CALLS_XPATH); - } - - /** - * Get the class information for a given service call - * - * @param string $alias - * @return array - * @throws \InvalidArgumentException - * @throws \LogicException - */ - public function getClassByAlias($alias) - { - //validate that service call is defined - if (!isset($this->_serviceCallNodes[$alias])) { - throw new \InvalidArgumentException("Service call with name '{$alias}' doesn't exist"); - } - - /** @var \DOMElement $node */ - $node = $this->_serviceCallNodes[$alias]; - $methodArguments = array(); - - /** @var \DOMElement $child */ - foreach ($node->childNodes as $child) { - if ($child instanceof \DOMElement) { - $methodArguments[$child->getAttribute('name')] = $child->nodeValue; - } - } - - $result = array( - 'class' => $node->getAttribute('service'), - 'retrieveMethod' => $node->getAttribute('method'), - 'methodArguments' => $methodArguments, - ); - - //validate that service attribute is defined - if (!$result['class']) { - throw new \InvalidArgumentException("Invalid Service call {$alias}, " - . 'service type must be defined in the "service" attribute'); - } - - //validate that retrieval method attribute is defined - if (!$result['retrieveMethod']) { - throw new \LogicException("Invalid Service call {$alias}, " - . "retrieval method must be defined for the service {$result['class']}"); - } - - return $result; - } -} diff --git a/app/code/Magento/Core/Model/DataService/Config/Reader.php b/app/code/Magento/Core/Model/DataService/Config/Reader.php deleted file mode 100644 index 28b0aaec337..00000000000 --- a/app/code/Magento/Core/Model/DataService/Config/Reader.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php -/** - * Magento Data Service Config reader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService\Config; - -class Reader extends \Magento\Config\AbstractXml -{ - /** - * @var \Magento\Module\Dir\Reader - */ - private $_modulesReader; - - /** - * @param \Magento\Config\FileIterator $configFiles - * @param \Magento\Module\Dir\Reader $moduleReader - */ - public function __construct(\Magento\Config\FileIterator $configFiles, \Magento\Module\Dir\Reader $moduleReader) - { - if (count($configFiles)) { - parent::__construct($configFiles); - } - $this->_modulesReader = $moduleReader; - } - - /** - * Get absolute path to the XML-schema file - * - * @return string - */ - public function getSchemaFile() - { - return $this->_modulesReader->getModuleDir('etc', 'Magento_Core') . '/service_calls.xsd'; - } - - /** - * Extract configuration data from the DOM structure - * - * @param \DOMDocument $dom - * @return array - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _extractData(\DOMDocument $dom) - { - return array(); - } - - /** - * Get XML-contents, initial for merging - * - * @return string - */ - protected function _getInitialXml() - { - return '<?xml version="1.0"?><service_calls></service_calls>'; - } - - /** - * Get if xml files must be runtime validated - * - * @return boolean - */ - protected function _isRuntimeValidated() - { - return false; - } - - /** - * Retrieve Service Calls - * - * @return \DOMDocument - */ - public function getServiceCallConfig() - { - return $this->_getDomConfigModel()->getDom(); - } - - /** - * Get list of paths to identifiable nodes - * - * @return array - */ - protected function _getIdAttributes() - { - return array( - '/service_calls/service_call/arg' => 'name', - '/service_calls/service_call' => 'name', - ); - } - - /** - * Perform xml validation - * - * @return \Magento\Config\AbstractXml - * @throws \Magento\Exception if invalid XML-file passed - */ - public function validate() - { - return $this->_performValidate(); - } -} diff --git a/app/code/Magento/Core/Model/DataService/Graph.php b/app/code/Magento/Core/Model/DataService/Graph.php deleted file mode 100644 index e9903a30822..00000000000 --- a/app/code/Magento/Core/Model/DataService/Graph.php +++ /dev/null @@ -1,132 +0,0 @@ -<?php -/** - * DataService graph manages creation and storage of data services. - * - * manages the graph of objects - * - initializes data service - * - calls factory to retrieve data - * - stores data to repository - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class Graph implements \Magento\Core\Model\DataService\Path\NodeInterface -{ - /** @var \Magento\Core\Model\DataService\Invoker */ - protected $_invoker; - - /** @var \Magento\Core\Model\DataService\Repository */ - protected $_repository; - - /** - * @param \Magento\Core\Model\DataService\Invoker $dataServiceInvoker - * @param \Magento\Core\Model\DataService\Repository $repository - */ - public function __construct( - \Magento\Core\Model\DataService\Invoker $dataServiceInvoker, - \Magento\Core\Model\DataService\Repository $repository - ) { - $this->_invoker = $dataServiceInvoker; - $this->_repository = $repository; - } - - /** - * Get the value for the method argument - * - * @param string $path - * @return mixed - */ - public function getArgumentValue($path) - { - return $this->_invoker->getArgumentValue($path); - } - - /** - * Takes array of the following structure - * and initializes all of the data sources - * - * array(dataServiceName => array( - * blocks => array( - * 'namespace' => aliasInNamespace - * )) - * - * @param array $dataServicesList - * @return \Magento\Core\Model\DataService\Graph - * @throws \InvalidArgumentException - */ - public function init(array $dataServicesList) - { - foreach ($dataServicesList as $dataServiceName => $namespaceConfig) { - if (!isset($namespaceConfig['namespaces'])) { - throw new \InvalidArgumentException("Data reference configuration doesn't have a block to link to"); - } - if ($this->get($dataServiceName) === false) { - throw new \InvalidArgumentException("Data service '$dataServiceName' couldn't be retrieved"); - } - foreach ($namespaceConfig['namespaces'] as $namespaceName => $aliasInNamespace) { - $this->_repository->setAlias($namespaceName, $dataServiceName, $aliasInNamespace); - } - } - return $this; - } - - /** - * Retrieve the data or the service call based on its name - * - * @param string $dataServiceName - * @return bool|array - */ - public function get($dataServiceName) - { - $dataService = $this->_repository->get($dataServiceName); - if ($dataService === null) { - $dataService = $this->_invoker->getServiceData($dataServiceName); - $this->_repository->add($dataServiceName, $dataService); - } - return $dataService; - } - - /** - * Retrieve all data for the service calls for particular namespace. - * - * @param string $namespace - * @return mixed - */ - public function getByNamespace($namespace) - { - return $this->_repository->getByNamespace($namespace); - } - - /** - * Return a child path node that corresponds to the input path element. This can be used to walk the - * data service graph. Leaf nodes in the graph tend to be of mixed type (scalar, array, or object). - * - * @param string $pathElement the path element name of the child node - * @return \Magento\Core\Model\DataService\Path\NodeInterface|mixed|null the child node, - * or mixed if this is a leaf node - */ - public function getChildNode($pathElement) - { - return $this->get($pathElement); - } -} diff --git a/app/code/Magento/Core/Model/DataService/Invoker.php b/app/code/Magento/Core/Model/DataService/Invoker.php deleted file mode 100644 index 9c580a3289f..00000000000 --- a/app/code/Magento/Core/Model/DataService/Invoker.php +++ /dev/null @@ -1,146 +0,0 @@ -<?php -/** - * DataService invoker invokes the service, calls the methods and retrieves the data from the call. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class Invoker -{ - /** - * separates data structure hierarchy - */ - const DATASERVICE_PATH_SEPARATOR = '.'; - - /** - * @var \Magento\Core\Model\DataService\ConfigInterface - */ - protected $_config; - - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** @var \Magento\Core\Model\DataService\Path\Composite */ - protected $_composite; - - /** - * @var \Magento\Core\Model\DataService\Path\Navigator - */ - private $_navigator; - - /** - * @param \Magento\Core\Model\DataService\ConfigInterface $config - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\DataService\Path\Composite $composite - * @param \Magento\Core\Model\DataService\Path\Navigator $navigator - */ - public function __construct( - \Magento\Core\Model\DataService\ConfigInterface $config, - \Magento\ObjectManager $objectManager, - \Magento\Core\Model\DataService\Path\Composite $composite, - \Magento\Core\Model\DataService\Path\Navigator $navigator - ) { - $this->_config = $config; - $this->_objectManager = $objectManager; - $this->_composite = $composite; - $this->_navigator = $navigator; - } - - /** - * Call service method and retrieve the data (array) from the call - * - * @param string $sourceName - * @throws \InvalidArgumentException - * @return bool|array - */ - public function getServiceData($sourceName) - { - $classInformation = $this->_config->getClassByAlias($sourceName); - $instance = $this->_objectManager->get($classInformation['class']); - $serviceData = $this->_applyMethod( - $instance, $classInformation['retrieveMethod'], - $classInformation['methodArguments'] - ); - if (!is_array($serviceData)) { - $type = gettype($serviceData); - throw new \InvalidArgumentException( - "Data service method calls must return an array, received {$type} instead. - Called {$classInformation['class']}::{$classInformation['retrieveMethod']}" - ); - } - return $serviceData; - } - - /** - * Invoke method configured for service call - * - * @param Object $object - * @param string $methodName - * @param array $methodArguments - * @return array - */ - protected function _applyMethod($object, $methodName, $methodArguments) - { - $arguments = array(); - if (is_array($methodArguments)) { - $arguments = $this->_prepareArguments($methodArguments); - } - return call_user_func_array(array($object, $methodName), $arguments); - } - - /** - * Prepare values for the method params - * - * @param array $argumentsList - * @return array - */ - protected function _prepareArguments($argumentsList) - { - $result = array(); - foreach ($argumentsList as $name => $value) { - $result[$name] = $this->getArgumentValue($value); - } - return $result; - } - - /** - * Get the value for the method argument - * - * @param string $valueTemplate - * @return mixed - */ - public function getArgumentValue($valueTemplate) - { - $composite = $this->_composite; - $navigator = $this->_navigator; - $callback = function ($matches) use ($composite, $navigator) { - // convert from '{{parent.child}}' format to array('parent', 'child') format - $pathArray = explode(\Magento\Core\Model\DataService\Invoker::DATASERVICE_PATH_SEPARATOR, $matches[1]); - return $navigator->search($composite, $pathArray); - }; - - return preg_replace_callback('(\{\{(.*?)\}\})', $callback, $valueTemplate); - } -} diff --git a/app/code/Magento/Core/Model/DataService/Path/Composite.php b/app/code/Magento/Core/Model/DataService/Path/Composite.php deleted file mode 100644 index 9486de46e6d..00000000000 --- a/app/code/Magento/Core/Model/DataService/Path/Composite.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * DataService composite visitable element - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService\Path; - -class Composite implements \Magento\Core\Model\DataService\Path\NodeInterface -{ - /** - * @var array - */ - protected $_children = array(); - - /** - * @param \Magento\ObjectManager $objectManager - * @param array string[] $items - */ - public function __construct(\Magento\ObjectManager $objectManager, $items) - { - foreach ($items as $key => $item) { - $this->_children[$key] = $objectManager->get($item); - } - } - - /** - * Return a child path node that corresponds to the input path element. This can be used to walk the - * data service tree. Leaf nodes in the graph tend to be of mixed type (scalar, array, or object). - * - * @param string $pathElement the path element name of the child node - * @return \Magento\Core\Model\DataService\Path\NodeInterface|mixed|null the child node, - * or mixed if this is a leaf node - */ - public function getChildNode($pathElement) - { - if (array_key_exists($pathElement, $this->_children)) { - return $this->_children[$pathElement]; - } - - return null; - } -} diff --git a/app/code/Magento/Core/Model/DataService/Path/Navigator.php b/app/code/Magento/Core/Model/DataService/Path/Navigator.php deleted file mode 100644 index fd937fafedb..00000000000 --- a/app/code/Magento/Core/Model/DataService/Path/Navigator.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Navigates the DataService path. - * - * DataServices can be represented by a path, for example {root.branch.leaf} could be a way to point to - * a specific 'leaf' data service that lives within the context of 'branch' which itself is found under - * the 'root' data service. What we are trying to solve here is an efficient and easy to use method of - * accessing a specific data service within an existing hierarchy. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService\Path; - -class Navigator -{ - /** - * Searches a root node using a given path for a specific child node. - * - * @param \Magento\Core\Model\DataService\Path\NodeInterface|array $root - * Root node in the graph from which to start the search. - * @param array $path path to use for searching. - * @throws \InvalidArgumentException if $root is null or if path can't be followed to a leaf node. - * @return mixed - */ - public function search($root, array $path) - { - if (null === $root) { - throw new \InvalidArgumentException('Search contained null root.'); - } - $pathElement = array_shift($path); - - $childElement = null; - if (is_array($root)) { - if (array_key_exists($pathElement, $root)) { - $childElement = $root[$pathElement]; - } - } else { - $childElement = $root->getChildNode($pathElement); - } - - if (empty($path)) { - return $childElement; - } - try { - return $this->search($childElement, $path); - } catch (\InvalidArgumentException $iae) { - throw new \InvalidArgumentException( - 'Search failed to find an intermediate node with given path: ' - . $pathElement . '.' . join('.', $path) - ); - } - } -} diff --git a/app/code/Magento/Core/Model/DataService/Path/NodeInterface.php b/app/code/Magento/Core/Model/DataService/Path/NodeInterface.php deleted file mode 100644 index c3798809181..00000000000 --- a/app/code/Magento/Core/Model/DataService/Path/NodeInterface.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** - * DataService path node interface. - * - * Think of the data service paths as forming a graph. This interface represents a node in such a graph. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService\Path; - -interface NodeInterface -{ - /** - * Returns a child path node that corresponds to the input path element. This can be used to walk the - * data service graph. Leaf nodes in the graph tend to be of mixed type (scalar, array, or object). - * - * @param string $pathElement the path element name of the child node - * @return \Magento\Core\Model\DataService\Path\NodeInterface|mixed|null the child node, - * or mixed if this is a leaf node - */ - public function getChildNode($pathElement); -} diff --git a/app/code/Magento/Core/Model/DataService/Path/Request.php b/app/code/Magento/Core/Model/DataService/Path/Request.php deleted file mode 100644 index cd3f3069488..00000000000 --- a/app/code/Magento/Core/Model/DataService/Path/Request.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * Wrapper around \Magento\App\Request\Http for the Navigator class. - * - * HTTP Requests need to be exposed as data services for the front end to be able to access the - * request data. This class acts as a wrapper around the \Magento\App\Request\Http object so - * that the data can be searched for and extracted via the Navigator class. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService\Path; - -class Request implements \Magento\Core\Model\DataService\Path\NodeInterface -{ - /** - * @var \Magento\App\RequestInterface - */ - protected $_request; - - /** - * @param \Magento\App\RequestInterface $request - */ - public function __construct(\Magento\App\RequestInterface $request) - { - $this->_request = $request; - } - - /** - * Return a child path node that corresponds to the input path element. This can be used to walk the - * data service graph. Leaf nodes in the graph tend to be of mixed type (scalar, array, or object). - * - * @param string $pathElement the path element name of the child node - * @return \Magento\Core\Model\DataService\Path\NodeInterface|mixed|null the child node, - * or mixed if this is a leaf node - */ - public function getChildNode($pathElement) - { - switch ($pathElement) { - case 'params': - return $this->_request->getParams(); - } - - return null; - } -} diff --git a/app/code/Magento/Core/Model/DataService/Repository.php b/app/code/Magento/Core/Model/DataService/Repository.php deleted file mode 100644 index 4c2a70fadcb..00000000000 --- a/app/code/Magento/Core/Model/DataService/Repository.php +++ /dev/null @@ -1,118 +0,0 @@ -<?php -/** - * DataService Repository stores the data and allows to retrieve for service calls. - * - * Assigns namespaces and aliases to the service calls data. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class Repository implements \Magento\Core\Model\DataService\Path\NodeInterface -{ - /** - * @var array - */ - protected $_serviceData = array(); - - /** - * @var array - */ - protected $_namespaces = array(); - - /** - * Assign a new name to existing namespace identified by alias. - * - * @param string $namespace - * @param string $serviceName - * @param string $alias - * @return $this - */ - public function setAlias($namespace, $serviceName, $alias) - { - if (isset($this->_namespaces[$namespace])) { - $this->_namespaces[$namespace][$serviceName] = $alias; - } else { - $this->_namespaces[$namespace] = array($serviceName => $alias); - } - return $this; - } - - /** - * Get all data services from namespace. - * - * @param string $namespace - * @return array - */ - public function getByNamespace($namespace) - { - if (!isset($this->_namespaces[$namespace])) { - return array(); - } - $dataServices = array(); - $dataServicesNames = $this->_namespaces[$namespace]; - foreach ($dataServicesNames as $serviceName => $alias) { - $dataServices[$alias] = $this->get($serviceName); - } - return $dataServices; - } - - /** - * Add new service data. - * - * @param string $serviceName - * @param array $data - * @return \Magento\Core\Model\DataService\Repository - */ - public function add($serviceName, $data) - { - $this->_serviceData[$serviceName] = $data; - return $this; - } - - /** - * Get service data by name. - * - * @param string $serviceName - * @return array|null - */ - public function get($serviceName) - { - if (!isset($this->_serviceData[$serviceName])) { - return null; - } - return $this->_serviceData[$serviceName]; - } - - /** - * Return a child path node that corresponds to the input path element. This can be used to walk the - * data service graph. Leaf nodes in the graph tend to be of mixed type (scalar, array, or object). - * - * @param string $pathElement the path element name of the child node - * @return \Magento\Core\Model\DataService\Path\NodeInterface|mixed|null the child node, - * or mixed if this is a leaf node - */ - public function getChildNode($pathElement) - { - return $this->get($pathElement); - } -} diff --git a/app/code/Magento/Core/Model/File/Storage.php b/app/code/Magento/Core/Model/File/Storage.php index 42e38da9232..dc48841f182 100644 --- a/app/code/Magento/Core/Model/File/Storage.php +++ b/app/code/Magento/Core/Model/File/Storage.php @@ -26,7 +26,7 @@ namespace Magento\Core\Model\File; -use \Magento\Filesystem; +use \Magento\App\Filesystem; /** * Class Storage @@ -96,7 +96,7 @@ class Storage extends \Magento\Core\Model\AbstractModel /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -109,7 +109,7 @@ class Storage extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\File\Storage\Flag $fileFlag * @param \Magento\Core\Model\File\Storage\FileFactory $fileFactory * @param \Magento\Core\Model\File\Storage\DatabaseFactory $databaseFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -123,7 +123,7 @@ class Storage extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\File\Storage\Flag $fileFlag, \Magento\Core\Model\File\Storage\FileFactory $fileFactory, \Magento\Core\Model\File\Storage\DatabaseFactory $databaseFactory, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -298,7 +298,7 @@ class Storage extends \Magento\Core\Model\AbstractModel public function getScriptConfig() { $config = array(); - $config['media_directory'] = $this->filesystem->getPath(Filesystem::MEDIA); + $config['media_directory'] = $this->filesystem->getPath(Filesystem::MEDIA_DIR); $allowedResources = $this->_coreConfig->getValue(self::XML_PATH_MEDIA_RESOURCE_WHITELIST, 'default'); foreach ($allowedResources as $allowedResource) { diff --git a/app/code/Magento/Core/Model/File/Storage/Config.php b/app/code/Magento/Core/Model/File/Storage/Config.php index e25256a259e..319f86bc8dd 100644 --- a/app/code/Magento/Core/Model/File/Storage/Config.php +++ b/app/code/Magento/Core/Model/File/Storage/Config.php @@ -52,16 +52,16 @@ class Config /** * @param \Magento\Core\Model\File\Storage $storage - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param string $cacheFile */ public function __construct( \Magento\Core\Model\File\Storage $storage, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, $cacheFile ) { $this->config = $storage->getScriptConfig(); - $this->pubDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB); + $this->pubDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::PUB_DIR); $this->cacheFilePath = $cacheFile; } diff --git a/app/code/Magento/Core/Model/File/Storage/Response.php b/app/code/Magento/Core/Model/File/Storage/Response.php index f235ef2bc2a..77dcf25ae4f 100644 --- a/app/code/Magento/Core/Model/File/Storage/Response.php +++ b/app/code/Magento/Core/Model/File/Storage/Response.php @@ -23,36 +23,47 @@ */ namespace Magento\Core\Model\File\Storage; -class Response +use Magento\App\Response\Http; + +class Response extends Http { /** - * Application object manager + * @var \Magento\File\Transfer\Adapter\Http + */ + protected $_transferAdapter; + + /** + * Full path to file * - * @var \Magento\ObjectManager + * @var string */ - protected $_objectManager; + protected $_filePath; - public function __construct(\Magento\ObjectManager $objectManager = null) + /** + * @param \Magento\File\Transfer\Adapter\Http $transferAdapter + */ + public function __construct(\Magento\File\Transfer\Adapter\Http $transferAdapter) { - $this->_objectManager = $objectManager; + $this->_transferAdapter = $transferAdapter; } /** - * Send the file to client - * - * @param string|array $filePath + * Send response */ - public function sendFile($filePath) + public function sendResponse() { - $transfer = $this->_objectManager->create('Magento\File\Transfer\Adapter\Http'); - $transfer->send($filePath); + if ($this->_filePath && $this->getHttpResponseCode() == 200) { + $this->_transferAdapter->send($this->_filePath); + } else { + parent::sendResponse(); + } } /** - * Return page header + * @param string $path */ - public function sendNotFound() + public function setFilePath($path) { - header('HTTP/1.0 404 Not Found'); + $this->_filePath = $path; } } diff --git a/app/code/Magento/Core/Model/File/Storage/Synchronization.php b/app/code/Magento/Core/Model/File/Storage/Synchronization.php index 1e93b48bb71..0da6710e838 100644 --- a/app/code/Magento/Core/Model/File/Storage/Synchronization.php +++ b/app/code/Magento/Core/Model/File/Storage/Synchronization.php @@ -49,14 +49,14 @@ class Synchronization /** * @param \Magento\Core\Model\File\Storage\DatabaseFactory $storageFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Core\Model\File\Storage\DatabaseFactory $storageFactory, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->storageFactory = $storageFactory; - $this->pubDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB); + $this->pubDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::PUB_DIR); } /** diff --git a/app/code/Magento/Core/Model/Layout.php b/app/code/Magento/Core/Model/Layout.php index 2b951e72de8..2245462cc86 100644 --- a/app/code/Magento/Core/Model/Layout.php +++ b/app/code/Magento/Core/Model/Layout.php @@ -154,14 +154,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn */ protected $_scheduledStructure; - /** - * @var array - */ - protected $_serviceCalls = array(); - - /** @var \Magento\Core\Model\DataService\Graph */ - protected $_dataServiceGraph; - /** * Renderers registered for particular name * @@ -226,7 +218,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * @param \Magento\Data\Structure $structure * @param Layout\Argument\Processor $argumentProcessor * @param Layout\ScheduledStructure $scheduledStructure - * @param DataService\Graph $dataServiceGraph * @param Store\Config $coreStoreConfig * @param \Magento\App\State $appState * @param \Magento\Message\ManagerInterface $messageManager @@ -243,7 +234,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn \Magento\Data\Structure $structure, \Magento\Core\Model\Layout\Argument\Processor $argumentProcessor, \Magento\Core\Model\Layout\ScheduledStructure $scheduledStructure, - \Magento\Core\Model\DataService\Graph $dataServiceGraph, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\App\State $appState, \Magento\Message\ManagerInterface $messageManager, @@ -262,7 +252,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn $this->setXml(simplexml_load_string('<layout/>', $this->_elementClass)); $this->_renderingOutput = new \Magento\Object; $this->_scheduledStructure = $scheduledStructure; - $this->_dataServiceGraph = $dataServiceGraph; $this->_processorFactory = $processorFactory; $this->themeFactory = $themeFactory; $this->_logger = $logger; @@ -369,9 +358,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn $this->_readStructure($this->getNode()); - $this->_dataServiceGraph - ->init($this->getServiceCalls()); - while (false === $this->_scheduledStructure->isStructureEmpty()) { $this->_scheduleElement(key($this->_scheduledStructure->getStructure())); }; @@ -465,7 +451,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn break; case Element::TYPE_BLOCK: - $this->_initServiceCalls($node); $this->_scheduleStructure($node, $parent); $this->_readStructure($node); break; @@ -509,32 +494,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn } } - /** - * Grab information about data service from the node - * - * @param \Magento\View\Layout\Element $node - * @return \Magento\Core\Model\Layout - */ - protected function _initServiceCalls($node) - { - if (!$dataServices = $node->xpath('data')) { - return $this; - } - $nodeName = $node->getAttribute('name'); - foreach ($dataServices as $dataServiceNode) { - $dataServiceName = $dataServiceNode->getAttribute('service_call'); - if (isset($this->_serviceCalls[$dataServiceName])) { - $this->_serviceCalls[$dataServiceName]['namespaces'][$nodeName] = - $dataServiceNode->getAttribute('alias'); - } else { - $this->_serviceCalls[$dataServiceName] = array( - 'namespaces' => array($nodeName => $dataServiceNode->getAttribute('alias')) - ); - } - } - return $this; - } - /** * Merge Container attributes * @@ -866,16 +825,12 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn $className = (string)$node['class']; $arguments = $this->_processArguments($args); - $dictionary = $this->_dataServiceGraph->getByNamespace((string)$node['name']); $block = $this->_createBlock($className, $elementName, array('data' => $arguments)); if (!empty($node['template'])) { $templateFileName = (string)$node['template']; - if ($block instanceof \Magento\View\Element\Template) { - $block->assign($dictionary); - } $block->setTemplate($templateFileName); } @@ -890,11 +845,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn return $block; } - public function getServiceCalls() - { - return $this->_serviceCalls; - } - /** * Set container-specific data to structure element * @@ -1562,12 +1512,11 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * @param $dynamicType * @param $type * @param $template - * @param string $dataServiceName * @param array $data * @return $this */ public function addAdjustableRenderer($namespace, $staticType, $dynamicType, $type, $template, - $dataServiceName = '', $data = array() + $data = array() ) { if (!isset($namespace)) { $this->_renderers[$namespace] = array(); @@ -1578,7 +1527,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn $this->_renderers[$namespace][$staticType][$dynamicType] = array( 'type' => $type, 'template' => $template, - 'dataServiceName' => $dataServiceName, 'data' => $data ); return $this; @@ -1614,9 +1562,6 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn { if ($options = $this->getRendererOptions($namespace, $staticType, $dynamicType)) { $dictionary = array(); - if (!empty($options['dataServiceName'])) { - $dictionary = $this->_dataServiceGraph->get($options['dataServiceName']); - } /** @var $block \Magento\View\Element\Template */ $block = $this->createBlock($options['type'], '') ->setData($data) @@ -1668,4 +1613,14 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn { return !(boolean)count($this->_xml->xpath('//' . Element::TYPE_BLOCK . '[@cacheable="false"]')); } + + /** + * Check is current layout private + * + * @return bool + */ + public function isPrivate() + { + return !(boolean)count($this->_xml->xpath('//' . Element::TYPE_BLOCK . '[@cache-control="private"]')); + } } diff --git a/app/code/Magento/Core/Model/Layout/Merge.php b/app/code/Magento/Core/Model/Layout/Merge.php index 20b69269198..71fa12c7102 100644 --- a/app/code/Magento/Core/Model/Layout/Merge.php +++ b/app/code/Magento/Core/Model/Layout/Merge.php @@ -124,7 +124,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface protected $_logger; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -139,7 +139,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface * @param \Magento\Cache\FrontendInterface $cache * @param \Magento\Core\Model\Layout\Update\Validator $validator * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Design\ThemeInterface $theme Non-injectable theme instance */ public function __construct( @@ -151,7 +151,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface \Magento\Cache\FrontendInterface $cache, \Magento\Core\Model\Layout\Update\Validator $validator, \Magento\Logger $logger, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\Design\ThemeInterface $theme = null ) { $this->_theme = $theme ?: $design->getDesignTheme(); @@ -601,7 +601,7 @@ class Merge implements \Magento\View\Layout\ProcessorInterface $layoutStr = ''; $theme = $this->_getPhysicalTheme($this->_theme); $updateFiles = $this->_fileSource->getFiles($theme); - $dir = $this->filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $dir = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $useErrors = libxml_use_internal_errors(true); foreach ($updateFiles as $file) { $filename = $dir->getRelativePath($file->getFilename()); diff --git a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php index c5d2c85426b..a41576b2da2 100644 --- a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php +++ b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/FileResolver.php @@ -38,14 +38,14 @@ class FileResolver implements \Magento\Config\FileResolverInterface protected $iteratorFactory; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Config\FileIteratorFactory $iteratorFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Config\FileIteratorFactory $iteratorFactory ) { - $this->directoryRead = $filesystem->getDirectoryRead(\Magento\Filesystem::APP); + $this->directoryRead = $filesystem->getDirectoryRead(\Magento\App\Filesystem::APP_DIR); $this->iteratorFactory = $iteratorFactory; } diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/File.php b/app/code/Magento/Core/Model/Resource/File/Storage/File.php index 267ea7799d9..7bbfe64ddde 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/File.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/File.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\File\Storage; class File { /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -42,11 +42,11 @@ class File protected $_logger; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Logger $log */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Logger $log ) { $this->_logger = $log; @@ -63,7 +63,7 @@ class File { $files = array(); $directories = array(); - $directoryInstance = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + $directoryInstance = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); if ($directoryInstance->isDirectory($dir)) { foreach ($directoryInstance->readRecursively($dir) as $path) { $itemName = basename($path); @@ -92,7 +92,7 @@ class File */ public function clear($dir = '') { - $directoryInstance = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $directoryInstance = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); if ($directoryInstance->isDirectory($dir)) { foreach ($directoryInstance->read($dir) as $path) { $directoryInstance->delete($path); @@ -120,11 +120,11 @@ class File : $dir['name']; try { - $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA)->create($path); + $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR)->create($path); } catch (\Exception $e) { $this->_logger->log($e->getMessage()); throw new \Magento\Core\Exception( - __('Unable to create directory: %1', \Magento\Filesystem::MEDIA . '/' . $path) + __('Unable to create directory: %1', \Magento\App\Filesystem::MEDIA_DIR . '/' . $path) ); } @@ -143,7 +143,7 @@ class File public function saveFile($filePath, $content, $overwrite = false) { try { - $directoryInstance = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $directoryInstance = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); if (!$directoryInstance->isFile($filePath) || ($overwrite && $directoryInstance->delete($filePath))) { $directoryInstance->writeFile($filePath, $content); return true; diff --git a/app/code/Magento/Core/Model/Resource/Setup.php b/app/code/Magento/Core/Model/Resource/Setup.php index 0397fcaced6..3b10fba864d 100644 --- a/app/code/Magento/Core/Model/Resource/Setup.php +++ b/app/code/Magento/Core/Model/Resource/Setup.php @@ -120,7 +120,7 @@ class Setup implements \Magento\Module\Updater\SetupInterface /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -152,7 +152,7 @@ class Setup implements \Magento\Module\Updater\SetupInterface $this->_themeResourceFactory = $context->getThemeResourceFactory(); $this->_moduleConfig = $context->getModuleList()->getModule($moduleName); $this->filesystem = $context->getFilesystem(); - $this->modulesDir = $this->filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $this->modulesDir = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $this->_connectionName = $connectionName ?: $this->_connectionName; } @@ -835,7 +835,7 @@ class Setup implements \Magento\Module\Updater\SetupInterface } /** - * @return \Magento\Filesystem + * @return \Magento\App\Filesystem */ public function getFilesystem() { diff --git a/app/code/Magento/Core/Model/Resource/Setup/Context.php b/app/code/Magento/Core/Model/Resource/Setup/Context.php index b0a05f88d17..264f1078dfd 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Context.php +++ b/app/code/Magento/Core/Model/Resource/Setup/Context.php @@ -76,7 +76,7 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_encryptor; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -93,7 +93,7 @@ class Context implements \Magento\ObjectManager\ContextInterface * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory * @param \Magento\Core\Model\Theme\CollectionFactory $themeFactory * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Logger $logger, @@ -106,7 +106,7 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\Core\Model\Resource\Theme\CollectionFactory $themeResourceFactory, \Magento\Core\Model\Theme\CollectionFactory $themeFactory, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_logger = $logger; $this->_eventManager = $eventManager; @@ -202,7 +202,7 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Filesystem + * @return \Magento\App\Filesystem */ public function getFilesystem() { diff --git a/app/code/Magento/Core/Model/Resource/Setup/Migration.php b/app/code/Magento/Core/Model/Resource/Setup/Migration.php index 25243f8029e..7614ecc76d9 100644 --- a/app/code/Magento/Core/Model/Resource/Setup/Migration.php +++ b/app/code/Magento/Core/Model/Resource/Setup/Migration.php @@ -158,7 +158,7 @@ class Migration extends \Magento\Core\Model\Resource\Setup $moduleName = 'Magento_Core', $connectionName = '' ) { - $this->_directory = $context->getFilesystem()->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->_directory = $context->getFilesystem()->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->_coreHelper = $helper; $this->_pathToMapFile = $confPathToMapFile; parent::__construct($context, $resourceName, $moduleName, $connectionName); diff --git a/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php b/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php index 6963e414260..f996e53bfed 100644 --- a/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php +++ b/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php @@ -29,7 +29,7 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db /** * Filesystem class * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -59,7 +59,7 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db protected $_isActive; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Stdlib\DateTime $dateTime * @param string $host @@ -72,7 +72,7 @@ class Mysql extends \Magento\Core\Model\Resource\Type\Db * @param bool $active */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Stdlib\DateTime $dateTime, $host, diff --git a/app/code/Magento/Core/Model/Session/Config.php b/app/code/Magento/Core/Model/Session/Config.php index ac8ea3c1d03..a385cc6a1e8 100644 --- a/app/code/Magento/Core/Model/Session/Config.php +++ b/app/code/Magento/Core/Model/Session/Config.php @@ -117,7 +117,7 @@ class Config implements \Magento\Session\Config\ConfigInterface protected $_appState; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -127,7 +127,7 @@ class Config implements \Magento\Session\Config\ConfigInterface * @param \Magento\Stdlib\String $stringHelper * @param \Magento\App\RequestInterface $request * @param \Magento\App\State $appState - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param string $saveMethod * @param null|string $savePath * @param null|string $cacheLimiter @@ -138,7 +138,7 @@ class Config implements \Magento\Session\Config\ConfigInterface \Magento\Stdlib\String $stringHelper, \Magento\App\RequestInterface $request, \Magento\App\State $appState, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, $saveMethod = \Magento\Session\SaveHandlerInterface::DEFAULT_HANDLER, $savePath = null, $cacheLimiter = null diff --git a/app/code/Magento/Core/Model/Store.php b/app/code/Magento/Core/Model/Store.php index b58f95b1ad1..78b512335d4 100644 --- a/app/code/Magento/Core/Model/Store.php +++ b/app/code/Magento/Core/Model/Store.php @@ -276,7 +276,7 @@ class Store extends \Magento\Core\Model\AbstractModel /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -312,7 +312,7 @@ class Store extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Url $url * @param \Magento\App\RequestInterface $request * @param \Magento\Core\Model\Resource\Config\Data $configDataResource - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Core\Model\Resource\Store $resource @@ -331,7 +331,7 @@ class Store extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Url $url, \Magento\App\RequestInterface $request, \Magento\Core\Model\Resource\Config\Data $configDataResource, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Config $coreConfig, \Magento\Core\Model\Resource\Store $resource, @@ -568,7 +568,7 @@ class Store extends \Magento\Core\Model\AbstractModel $url = $this->getConfig($path); if (!$url) { $url = $this->getBaseUrl(self::URL_TYPE_WEB, $secure) - . $this->filesystem->getUri(\Magento\Filesystem::PUB_LIB); + . $this->filesystem->getUri(\Magento\App\Filesystem::PUB_LIB_DIR); } break; @@ -577,7 +577,7 @@ class Store extends \Magento\Core\Model\AbstractModel $url = $this->getConfig($path); if (!$url) { $url = $this->getBaseUrl(self::URL_TYPE_WEB, $secure) - . $this->filesystem->getUri(\Magento\Filesystem::STATIC_VIEW); + . $this->filesystem->getUri(\Magento\App\Filesystem::STATIC_VIEW_DIR); } break; @@ -586,7 +586,7 @@ class Store extends \Magento\Core\Model\AbstractModel $url = $this->getConfig($path); if (!$url) { $url = $this->getBaseUrl(self::URL_TYPE_WEB, $secure) - . $this->filesystem->getUri(\Magento\Filesystem::PUB_VIEW_CACHE); + . $this->filesystem->getUri(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR); } break; @@ -597,7 +597,7 @@ class Store extends \Magento\Core\Model\AbstractModel $url = $this->getConfig($path); if (!$url) { $url = $this->getBaseUrl(self::URL_TYPE_WEB, $secure) - . $this->filesystem->getUri(\Magento\Filesystem::MEDIA); + . $this->filesystem->getUri(\Magento\App\Filesystem::MEDIA_DIR); } } break; @@ -655,16 +655,16 @@ class Store extends \Magento\Core\Model\AbstractModel * If we use Database file storage and server doesn't support rewrites (.htaccess in media folder) * we have to put name of fetching media script exactly into URL * - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param bool $secure * @return string|bool */ - protected function _getMediaScriptUrl(\Magento\Filesystem $filesystem, $secure) + protected function _getMediaScriptUrl(\Magento\App\Filesystem $filesystem, $secure) { if (!$this->getConfig(self::XML_PATH_USE_REWRITES) && $this->_coreFileStorageDatabase->checkDbUsage() ) { - return $this->getBaseUrl(self::URL_TYPE_WEB, $secure) . $filesystem->getUri(\Magento\Filesystem::PUB) + return $this->getBaseUrl(self::URL_TYPE_WEB, $secure) . $filesystem->getUri(\Magento\App\Filesystem::PUB_DIR) . '/' . self::MEDIA_REWRITE_SCRIPT; } return false; diff --git a/app/code/Magento/Core/Model/Theme/Collection.php b/app/code/Magento/Core/Model/Theme/Collection.php index 340da17163d..dd2989605b4 100644 --- a/app/code/Magento/Core/Model/Theme/Collection.php +++ b/app/code/Magento/Core/Model/Theme/Collection.php @@ -57,16 +57,16 @@ class Collection extends \Magento\Data\Collection implements \Magento\View\Desig /** * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Config\FileIteratorFactory $fileIteratorFactory */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Config\FileIteratorFactory $fileIteratorFactory ) { parent::__construct($entityFactory); - $this->_directory = $filesystem->getDirectoryRead(\Magento\Filesystem::THEMES); + $this->_directory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::THEMES_DIR); $this->fileIteratorFactory = $fileIteratorFactory; } diff --git a/app/code/Magento/Core/Model/Theme/Image/Path.php b/app/code/Magento/Core/Model/Theme/Image/Path.php index bcb825085d8..8e29888a36a 100644 --- a/app/code/Magento/Core/Model/Theme/Image/Path.php +++ b/app/code/Magento/Core/Model/Theme/Image/Path.php @@ -37,7 +37,7 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -54,12 +54,12 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface /** * Initialize dependencies * - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Url $viewUrl * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\Url $viewUrl, \Magento\Core\Model\StoreManagerInterface $storeManager ) { @@ -96,7 +96,7 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface */ public function getImagePreviewDirectory() { - return $this->filesystem->getPath(\Magento\Filesystem::MEDIA) . '/' . self::PREVIEW_DIRECTORY_PATH; + return $this->filesystem->getPath(\Magento\App\Filesystem::MEDIA_DIR) . '/' . self::PREVIEW_DIRECTORY_PATH; } /** @@ -106,6 +106,6 @@ class Path implements \Magento\View\Design\Theme\Image\PathInterface */ public function getTemporaryDirectory() { - return $this->filesystem->getPath(\Magento\Filesystem::MEDIA) . '/theme/origin'; + return $this->filesystem->getPath(\Magento\App\Filesystem::MEDIA_DIR) . '/theme/origin'; } } diff --git a/app/code/Magento/Core/Model/Theme/Registration.php b/app/code/Magento/Core/Model/Theme/Registration.php index b7de8746ed6..be58085e3b8 100644 --- a/app/code/Magento/Core/Model/Theme/Registration.php +++ b/app/code/Magento/Core/Model/Theme/Registration.php @@ -75,16 +75,16 @@ class Registration * * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory * @param Collection $filesystemCollection - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory, \Magento\Core\Model\Theme\Collection $filesystemCollection, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_collectionFactory = $collectionFactory; $this->_themeCollection = $filesystemCollection; - $this->directoryRead = $filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + $this->directoryRead = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); } /** diff --git a/app/code/Magento/Core/Model/Translate.php b/app/code/Magento/Core/Model/Translate.php index d84b79a5e34..2ece5a27e60 100644 --- a/app/code/Magento/Core/Model/Translate.php +++ b/app/code/Magento/Core/Model/Translate.php @@ -197,7 +197,7 @@ class Translate implements TranslateInterface protected $_appState; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -220,7 +220,7 @@ class Translate implements TranslateInterface * @param \Magento\Core\Model\Resource\Translate $translate * @param \Magento\Core\Model\App $app * @param \Magento\App\State $appState - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -238,7 +238,7 @@ class Translate implements TranslateInterface \Magento\Core\Model\Resource\Translate $translate, \Magento\Core\Model\App $app, \Magento\App\State $appState, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_viewDesign = $viewDesign; $this->_localeHierarchy = $config->getHierarchy(); @@ -254,7 +254,7 @@ class Translate implements TranslateInterface $this->_app = $app; $this->_appState = $appState; $this->filesystem = $filesystem; - $this->directory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->directory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); } /** @@ -499,7 +499,7 @@ class Translate implements TranslateInterface */ protected function _getModuleTranslationFile($moduleName, $locale) { - $file = $this->_modulesReader->getModuleDir(\Magento\Filesystem::LOCALE, $moduleName); + $file = $this->_modulesReader->getModuleDir(\Magento\App\Filesystem::LOCALE_DIR, $moduleName); $file .= '/' . $locale . '.csv'; return $file; } @@ -514,7 +514,7 @@ class Translate implements TranslateInterface { $area = isset($area) ? $area : $this->_appState->getAreaCode(); return $this->_viewFileSystem - ->getFilename(\Magento\Filesystem::LOCALE . '/' . $locale . '.csv', array('area' => $area)); + ->getFilename(\Magento\App\Filesystem::LOCALE_DIR . '/' . $locale . '.csv', array('area' => $area)); } /** diff --git a/app/code/Magento/Core/etc/config.xml b/app/code/Magento/Core/etc/config.xml index 518dc38094a..1035177d413 100644 --- a/app/code/Magento/Core/etc/config.xml +++ b/app/code/Magento/Core/etc/config.xml @@ -88,40 +88,18 @@ </media_storage_configuration> <filesystem> <directory> - <design> - <read_only>1</read_only> - <path>app/design</path> - </design> - <var> - <read_only>0</read_only> - <path>var</path> - <allow_create_dirs>1</allow_create_dirs> - <permissions>511</permissions> - </var> - <tmp> - <read_only>0</read_only> - <path>var/tmp</path> - <allow_create_dirs>1</allow_create_dirs> - <permissions>511</permissions> - </tmp> - <cache> - <read_only>0</read_only> - <path>var/cache</path> - <allow_create_dirs>1</allow_create_dirs> - <permissions>511</permissions> - </cache> - <log> + <media> <read_only>0</read_only> - <path>var/log</path> - <allow_create_dirs>1</allow_create_dirs> + <path>pub/media</path> + <uri>pub/media</uri> <permissions>511</permissions> - </log> - <session> + </media> + <static> <read_only>0</read_only> - <path>var/session</path> - <allow_create_dirs>1</allow_create_dirs> + <path>pub/static</path> + <uri>pub/static</uri> <permissions>511</permissions> - </session> + </static> <pub> <read_only>0</read_only> <path>pub</path> @@ -129,34 +107,32 @@ <permissions>511</permissions> </pub> <pub_lib> - <read_only>1</read_only> + <read_only>0</read_only> <path>pub/lib</path> <uri>pub/lib</uri> + <permissions>511</permissions> </pub_lib> - <media> + <view_cache> <read_only>0</read_only> - <path>pub/media</path> - <uri>pub/media</uri> + <path>pub/cache</path> + <uri>pub/cache</uri> <permissions>511</permissions> - </media> + </view_cache> + <tmp> + <read_only>0</read_only> + <path>var/tmp</path> + <permissions>511</permissions> + </tmp> + <design> + <read_only>1</read_only> + <path>app/design</path> + </design> <upload> <read_only>0</read_only> <path>pub/media/upload</path> <uri>pub/media/upload</uri> <permissions>511</permissions> </upload> - <static> - <read_only>0</read_only> - <path>pub/static</path> - <uri>pub/static</uri> - <permissions>511</permissions> - </static> - <view_cache> - <read_only>0</read_only> - <path>pub/cache</path> - <uri>pub/cache</uri> - <permissions>511</permissions> - </view_cache> <ftp> <read_only>0</read_only> <permissions>511</permissions> diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 03b8a50a3b7..2d878c8d39f 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -33,7 +33,6 @@ <preference for="Magento\Session\SessionManagerInterface" type="Magento\Core\Model\Session" /> <preference for="Magento\Core\Model\LocaleInterface" type="Magento\Core\Model\Locale" /> <preference for="Magento\View\Asset\MergeStrategyInterface" type="Magento\View\Asset\MergeStrategy\Direct" /> - <preference for="Magento\Core\Model\DataService\ConfigInterface" type="Magento\Core\Model\DataService\Config" /> <preference for="Magento\Core\Model\ConfigInterface" type="Magento\Core\Model\Config" /> <preference for="Magento\Core\Model\Config\DataInterface" type="Magento\Core\Model\Config\Data" /> <preference for="Magento\Core\Model\Config\Storage\WriterInterface" type="Magento\Core\Model\Config\Storage\Writer\Db" /> diff --git a/app/code/Magento/Core/etc/layouts.xsd b/app/code/Magento/Core/etc/layouts.xsd index a091804c308..a03c770d642 100644 --- a/app/code/Magento/Core/etc/layouts.xsd +++ b/app/code/Magento/Core/etc/layouts.xsd @@ -135,7 +135,6 @@ <xs:element name="update" type="updateType"/> <xs:element name="remove" type="removeType"/> <xs:element name="move" type="moveType"/> - <xs:element name="data" type="dataType"/> <xs:simpleType name="handlePageType"> <xs:restriction base="xs:string"> @@ -222,7 +221,6 @@ <xs:element ref="block" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="container" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="referenceBlock" minOccurs="0" maxOccurs="unbounded"/> - <xs:element ref="data" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute type="elementNameType" name="name" use="optional"/> <xs:attribute type="blockClassType" name="class" use="optional"/> @@ -237,16 +235,6 @@ <xs:attribute name="cacheable" type="xs:boolean" default="true" use="optional"/> </xs:complexType> - <xs:complexType name="dataType"> - <xs:annotation> - <xs:documentation> - Use data from Service Layer in View Layer. - </xs:documentation> - </xs:annotation> - <xs:attribute type="xs:string" name="alias" use="required"/> - <xs:attribute type="xs:string" name="serviceCall" use="optional"/> - </xs:complexType> - <xs:complexType name="actionType"> <xs:annotation> <xs:documentation> diff --git a/app/code/Magento/Core/etc/module.xml b/app/code/Magento/Core/etc/module.xml index b2bf27498fb..2b5c4d33fbc 100755 --- a/app/code/Magento/Core/etc/module.xml +++ b/app/code/Magento/Core/etc/module.xml @@ -44,6 +44,8 @@ <module name="Magento_PaypalUk"/> <module name="Magento_ProductAlert"/> <module name="Magento_SalesRule"/> + <module name="Magento_Eav"/> + <module name="Magento_Install"/> <extension name="spl"/> <extension name="dom"/> <extension name="simplexml"/> diff --git a/app/code/Magento/Core/etc/service_calls.xsd b/app/code/Magento/Core/etc/service_calls.xsd deleted file mode 100644 index 0c1c78f903f..00000000000 --- a/app/code/Magento/Core/etc/service_calls.xsd +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Schema for service calls - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="service_calls"> - <xs:complexType> - <xs:sequence minOccurs="0" maxOccurs="unbounded"> - <xs:element ref="service_call" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:attributeGroup name="serviceCallAttributeGroup"> - <xs:attribute name="name" type="xs:string" use="required" /> - <xs:attribute name="service" type="xs:string" use="required" /> - <xs:attribute name="method" type="xs:string" use="required" /> - </xs:attributeGroup> - - <xs:element name="service_call"> - <xs:annotation> - <xs:documentation> - Service call definition - </xs:documentation> - </xs:annotation> - - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="arg" type="typeArg" /> - </xs:sequence> - <xs:attributeGroup ref="serviceCallAttributeGroup"/> - </xs:complexType> - </xs:element> - - <xs:complexType name="typeArg"> - <xs:annotation> - <xs:documentation> - Dynamic values which are evaluated at the time of service calls construction or method invocation enclosed with {{ }}. - </xs:documentation> - </xs:annotation> - <xs:simpleContent> - <xs:extension base="xs:string"> - <xs:attribute type="xs:string" name="name" use="required"/> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - -</xs:schema> \ No newline at end of file diff --git a/app/code/Magento/Customer/Block/Account/AuthorizationLink.php b/app/code/Magento/Customer/Block/Account/AuthorizationLink.php index 4c6cacd6a6a..3e2ea17d663 100644 --- a/app/code/Magento/Customer/Block/Account/AuthorizationLink.php +++ b/app/code/Magento/Customer/Block/Account/AuthorizationLink.php @@ -56,6 +56,7 @@ class AuthorizationLink extends \Magento\View\Element\Html\Link parent::__construct($context, $data); $this->_customerSession = $session; $this->_customerHelper = $customerHelper; + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Customer/Block/Account/Customer.php b/app/code/Magento/Customer/Block/Account/Customer.php index ae107157c36..4f8969ce874 100644 --- a/app/code/Magento/Customer/Block/Account/Customer.php +++ b/app/code/Magento/Customer/Block/Account/Customer.php @@ -45,6 +45,7 @@ class Customer extends \Magento\View\Element\Template ) { parent::__construct($context, $data); $this->_customerSession = $session; + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Customer/Block/Account/Dashboard.php b/app/code/Magento/Customer/Block/Account/Dashboard.php index 27730896096..2f5ce780529 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard.php @@ -65,6 +65,7 @@ class Dashboard extends \Magento\View\Element\Template $this->_customerSession = $customerSession; $this->_subscriberFactory = $subscriberFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } public function getCustomer() diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Address.php b/app/code/Magento/Customer/Block/Account/Dashboard/Address.php index b52cb9ffd1c..f3078cf1854 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Address.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Address.php @@ -53,6 +53,7 @@ class Address extends \Magento\View\Element\Template ) { $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } public function getCustomer() diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Block.php b/app/code/Magento/Customer/Block/Account/Dashboard/Block.php index f5bc0473d51..90b78723cd8 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Block.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Block.php @@ -29,5 +29,15 @@ namespace Magento\Customer\Block\Account\Dashboard; class Block extends \Magento\View\Element\Template { - + /** + * @param \Magento\View\Element\Template\Context $context + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + array $data = array() + ) { + parent::__construct($context, $data); + $this->_isScopePrivate = true; + } } diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Hello.php b/app/code/Magento/Customer/Block/Account/Dashboard/Hello.php index 18e429a03b7..67fa4726799 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Hello.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Hello.php @@ -46,6 +46,7 @@ class Hello extends \Magento\View\Element\Template ) { $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } public function getCustomerName() diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Info.php b/app/code/Magento/Customer/Block/Account/Dashboard/Info.php index 96651d3a827..1bf2eb1b99e 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Info.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Info.php @@ -68,6 +68,7 @@ class Info extends \Magento\View\Element\Template $this->_customerSession = $customerSession; $this->_subscriberFactory = $subscriberFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Newsletter.php b/app/code/Magento/Customer/Block/Account/Dashboard/Newsletter.php index 736d9a73c4a..9f811f948a9 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Newsletter.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Newsletter.php @@ -66,6 +66,7 @@ class Newsletter extends \Magento\View\Element\Template $this->_customerSession = $customerSession; $this->_subscriberFactory = $subscriberFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } public function getSubscriptionObject() diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php b/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php index 03fb4139923..1c7b6db8958 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php @@ -96,6 +96,7 @@ class Sidebar extends \Magento\View\Element\Template $this->_wishListFactory = $wishListFactory; $this->_itemsCompareFactory = $itemsCompareFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } @@ -172,7 +173,7 @@ class Sidebar extends \Magento\View\Element\Template public function getCompareAddUrlTemplate() { - return $this->getUrl('catalog/product_compare/add',array('product'=>'#{id}')); + return $this->getUrl('catalog/product_compare/add'); } public function getCompareUrl() diff --git a/app/code/Magento/Customer/Block/Account/Forgotpassword.php b/app/code/Magento/Customer/Block/Account/Forgotpassword.php index d27feab4981..a541d59fc9f 100644 --- a/app/code/Magento/Customer/Block/Account/Forgotpassword.php +++ b/app/code/Magento/Customer/Block/Account/Forgotpassword.php @@ -36,5 +36,15 @@ namespace Magento\Customer\Block\Account; class Forgotpassword extends \Magento\View\Element\Template { - + /** + * @param \Magento\View\Element\Template\Context $context + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + array $data = array() + ) { + parent::__construct($context, $data); + $this->_isScopePrivate = true; + } } diff --git a/app/code/Magento/Customer/Block/Account/Link.php b/app/code/Magento/Customer/Block/Account/Link.php index 33838933e26..7ceda267b5f 100644 --- a/app/code/Magento/Customer/Block/Account/Link.php +++ b/app/code/Magento/Customer/Block/Account/Link.php @@ -43,6 +43,7 @@ class Link extends \Magento\View\Element\Html\Link ) { $this->_customerHelper = $customerHelper; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Customer/Block/Account/RegisterLink.php b/app/code/Magento/Customer/Block/Account/RegisterLink.php index 26e392122ed..e86a803304f 100644 --- a/app/code/Magento/Customer/Block/Account/RegisterLink.php +++ b/app/code/Magento/Customer/Block/Account/RegisterLink.php @@ -56,6 +56,7 @@ class RegisterLink extends \Magento\View\Element\Html\Link parent::__construct($context, $data); $this->_customerSession = $session; $this->_customerHelper = $customerHelper; + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Customer/Block/Account/Resetpassword.php b/app/code/Magento/Customer/Block/Account/Resetpassword.php index d3c0638cc49..abf0f023048 100644 --- a/app/code/Magento/Customer/Block/Account/Resetpassword.php +++ b/app/code/Magento/Customer/Block/Account/Resetpassword.php @@ -36,5 +36,15 @@ namespace Magento\Customer\Block\Account; class Resetpassword extends \Magento\View\Element\Template { - + /** + * @param \Magento\View\Element\Template\Context $context + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + array $data = array() + ) { + parent::__construct($context, $data); + $this->_isScopePrivate = true; + } } diff --git a/app/code/Magento/Customer/Block/Address/Book.php b/app/code/Magento/Customer/Block/Address/Book.php index 875d7ad1ca8..6fa2ae4f80f 100644 --- a/app/code/Magento/Customer/Block/Address/Book.php +++ b/app/code/Magento/Customer/Block/Address/Book.php @@ -52,6 +52,7 @@ class Book extends \Magento\View\Element\Template ) { $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } protected function _prepareLayout() diff --git a/app/code/Magento/Customer/Block/Address/Edit.php b/app/code/Magento/Customer/Block/Address/Edit.php index b31c601dc14..ea81b4e0d19 100644 --- a/app/code/Magento/Customer/Block/Address/Edit.php +++ b/app/code/Magento/Customer/Block/Address/Edit.php @@ -55,8 +55,8 @@ class Edit extends \Magento\Directory\Block\Data * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Helper\Data $coreData * @param \Magento\App\Cache\Type\Config $configCacheType - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory * @param \Magento\Core\Model\Config $config * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\AddressFactory $addressFactory @@ -67,8 +67,8 @@ class Edit extends \Magento\Directory\Block\Data \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\App\Cache\Type\Config $configCacheType, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, \Magento\Core\Model\Config $config, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\AddressFactory $addressFactory, @@ -78,8 +78,9 @@ class Edit extends \Magento\Directory\Block\Data $this->_customerSession = $customerSession; $this->_addressFactory = $addressFactory; parent::__construct( - $context, $coreData, $jsonEncoder, $configCacheType, $regionCollFactory, $countryCollFactory, $data + $context, $coreData, $jsonEncoder, $configCacheType, $regionCollectionFactory, $countryCollectionFactory, $data ); + $this->_isScopePrivate = true; } protected function _prepareLayout() diff --git a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php index f5ee2a6ec0e..46406a31ba2 100644 --- a/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php +++ b/app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php @@ -72,6 +72,7 @@ class DefaultRenderer $this->_customerAddress = $customerAddress; $this->_attrDataFactory = $attrDataFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Customer/Block/Form/Edit.php b/app/code/Magento/Customer/Block/Form/Edit.php index 2ed667c1ea7..1fa35366a9e 100644 --- a/app/code/Magento/Customer/Block/Form/Edit.php +++ b/app/code/Magento/Customer/Block/Form/Edit.php @@ -35,5 +35,19 @@ namespace Magento\Customer\Block\Form; class Edit extends \Magento\Customer\Block\Account\Dashboard { - + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Customer\Model\Session $customerSession, + \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, + array $data = array() + ) { + parent::__construct($context, $customerSession, $subscriberFactory, $data); + $this->_isScopePrivate = true; + } } diff --git a/app/code/Magento/Customer/Block/Form/Login.php b/app/code/Magento/Customer/Block/Form/Login.php index 2fa00d7c4e2..568820e7b1c 100644 --- a/app/code/Magento/Customer/Block/Form/Login.php +++ b/app/code/Magento/Customer/Block/Form/Login.php @@ -62,6 +62,7 @@ class Login extends \Magento\View\Element\Template $this->_customerHelper = $customerHelper; $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } protected function _prepareLayout() diff --git a/app/code/Magento/Customer/Block/Form/Register.php b/app/code/Magento/Customer/Block/Form/Register.php index a1f7f65866d..48bdbaf3447 100644 --- a/app/code/Magento/Customer/Block/Form/Register.php +++ b/app/code/Magento/Customer/Block/Form/Register.php @@ -58,8 +58,8 @@ class Register extends \Magento\Directory\Block\Data * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\App\Cache\Type\Config $configCacheType - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory * @param \Magento\Module\Manager $moduleManager * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Customer\Model\AddressFactory $addressFactory @@ -73,8 +73,8 @@ class Register extends \Magento\Directory\Block\Data \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\App\Cache\Type\Config $configCacheType, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, \Magento\Module\Manager $moduleManager, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\AddressFactory $addressFactory, @@ -90,10 +90,11 @@ class Register extends \Magento\Directory\Block\Data $coreData, $jsonEncoder, $configCacheType, - $regionCollFactory, - $countryCollFactory, + $regionCollectionFactory, + $countryCollectionFactory, $data ); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Customer/Block/Newsletter.php b/app/code/Magento/Customer/Block/Newsletter.php index fe5dbc2e311..c24826046d5 100644 --- a/app/code/Magento/Customer/Block/Newsletter.php +++ b/app/code/Magento/Customer/Block/Newsletter.php @@ -36,9 +36,24 @@ namespace Magento\Customer\Block; class Newsletter extends \Magento\Customer\Block\Account\Dashboard { - protected $_template = 'form/newsletter.phtml'; + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Customer\Model\Session $customerSession, + \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, + array $data = array() + ) { + parent::__construct($context, $customerSession, $subscriberFactory, $data); + $this->_isScopePrivate = true; + } + public function getIsSubscribed() { return $this->getSubscriptionObject()->isSubscribed(); diff --git a/app/code/Magento/Customer/Block/Widget/AbstractWidget.php b/app/code/Magento/Customer/Block/Widget/AbstractWidget.php index b64c335764e..7999b1613a0 100644 --- a/app/code/Magento/Customer/Block/Widget/AbstractWidget.php +++ b/app/code/Magento/Customer/Block/Widget/AbstractWidget.php @@ -53,6 +53,7 @@ class AbstractWidget extends \Magento\View\Element\Template $this->_addressHelper = $addressHelper; $this->_eavConfig = $eavConfig; parent::__construct($context, $data); + $this->_isScopePrivate = true; } public function getConfig($key) diff --git a/app/code/Magento/Customer/Block/Widget/Dob.php b/app/code/Magento/Customer/Block/Widget/Dob.php index 28eb29c524a..aeeca73bbcb 100644 --- a/app/code/Magento/Customer/Block/Widget/Dob.php +++ b/app/code/Magento/Customer/Block/Widget/Dob.php @@ -41,6 +41,22 @@ class Dob extends \Magento\Customer\Block\Widget\AbstractWidget */ protected $_dateInputs = array(); + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Eav\Model\Config $eavConfig + * @param \Magento\Customer\Helper\Address $addressHelper + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Eav\Model\Config $eavConfig, + \Magento\Customer\Helper\Address $addressHelper, + array $data = array() + ) { + parent::__construct($context, $eavConfig, $addressHelper, $data); + $this->_isScopePrivate = true; + } + public function _construct() { parent::_construct(); diff --git a/app/code/Magento/Customer/Block/Widget/Gender.php b/app/code/Magento/Customer/Block/Widget/Gender.php index d753cbde5aa..0ba5a1a62c4 100644 --- a/app/code/Magento/Customer/Block/Widget/Gender.php +++ b/app/code/Magento/Customer/Block/Widget/Gender.php @@ -64,6 +64,7 @@ class Gender extends \Magento\Customer\Block\Widget\AbstractWidget $this->_customerSession = $customerSession; $this->_customerResource = $customerResource; parent::__construct($context, $eavConfig, $addressHelper, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Customer/Block/Widget/Name.php b/app/code/Magento/Customer/Block/Widget/Name.php index 65f2d3e0b6a..e2c3a004765 100644 --- a/app/code/Magento/Customer/Block/Widget/Name.php +++ b/app/code/Magento/Customer/Block/Widget/Name.php @@ -49,6 +49,7 @@ class Name extends \Magento\Customer\Block\Widget\AbstractWidget ) { $this->_customerHelper = $customerHelper; parent::__construct($context, $eavConfig, $addressHelper, $data); + $this->_isScopePrivate = true; } public function _construct() diff --git a/app/code/Magento/Customer/Block/Widget/Taxvat.php b/app/code/Magento/Customer/Block/Widget/Taxvat.php index 9b5ac635a2e..d02353b86bf 100644 --- a/app/code/Magento/Customer/Block/Widget/Taxvat.php +++ b/app/code/Magento/Customer/Block/Widget/Taxvat.php @@ -49,6 +49,7 @@ class Taxvat extends \Magento\Customer\Block\Widget\AbstractWidget ) { $this->_customerSession = $customerSession; parent::__construct($context, $eavConfig, $addressHelper, $data); + $this->_isScopePrivate = true; } public function _construct() diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index.php b/app/code/Magento/Customer/Controller/Adminhtml/Index.php index 046953d1a9d..ef0a546146e 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index.php @@ -474,7 +474,7 @@ class Index extends \Magento\Backend\App\Action $fileName = 'customers.csv'; $content = $this->_view->getLayout()->createBlock('Magento\Customer\Block\Adminhtml\Grid')->getCsvFile(); - return $this->_fileFactory->create($fileName, $content, \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } /** @@ -484,7 +484,7 @@ class Index extends \Magento\Backend\App\Action { $fileName = 'customers.xml'; $content = $this->_view->getLayout()->createBlock('Magento\Customer\Block\Adminhtml\Grid')->getExcelFile(); - return $this->_fileFactory->create($fileName, $content, \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } /** @@ -851,9 +851,9 @@ class Index extends \Magento\Backend\App\Action throw new NotFoundException(); } - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $this->_objectManager->get('Magento\Filesystem'); - $directory = $filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = $this->_objectManager->get('Magento\App\Filesystem'); + $directory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); $fileName = 'customer' . '/' . ltrim($file, '/'); $path = $directory->getAbsolutePath($fileName); if (!$directory->isFile($fileName) @@ -901,7 +901,7 @@ class Index extends \Magento\Backend\App\Action 'type' => 'filename', 'value' => $fileName ), - \Magento\Filesystem::MEDIA + \Magento\App\Filesystem::MEDIA_DIR )->sendResponse(); } diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php index d4d9204dde9..70c52cd84b2 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Group.php @@ -42,18 +42,18 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Source\Table /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory * @param \Magento\Customer\Model\Resource\Group\CollectionFactory $groupsFactory */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, \Magento\Customer\Model\Resource\Group\CollectionFactory $groupsFactory ) { $this->_groupsFactory = $groupsFactory; - parent::__construct($coreData, $attrOptCollFactory, $attrOptionFactory); + parent::__construct($coreData, $attrOptionCollectionFactory, $attrOptionFactory); } public function getAllOptions() diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Store.php b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Store.php index 36edde5fb1a..3199a21e8a1 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Store.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Store.php @@ -47,19 +47,19 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Source\Table /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory * @param \Magento\Core\Model\System\Store $store * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storesFactory */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, \Magento\Core\Model\System\Store $store, \Magento\Core\Model\Resource\Store\CollectionFactory $storesFactory ) { - parent::__construct($coreData, $attrOptCollFactory, $attrOptionFactory); + parent::__construct($coreData, $attrOptionCollectionFactory, $attrOptionFactory); $this->_store = $store; $this->_storesFactory = $storesFactory; } diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Website.php b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Website.php index b6914815505..5b9c3598e4d 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Source/Website.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Source/Website.php @@ -42,17 +42,17 @@ class Website extends \Magento\Eav\Model\Entity\Attribute\Source\Table /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory * @param \Magento\Core\Model\System\Store $store */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, \Magento\Core\Model\System\Store $store ) { - parent::__construct($coreData, $attrOptCollFactory, $attrOptionFactory); + parent::__construct($coreData, $attrOptionCollectionFactory, $attrOptionFactory); $this->_store = $store; } diff --git a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Source/Country.php b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Source/Country.php index 3ebaaa6156b..6d71547eb7a 100644 --- a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Source/Country.php +++ b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Source/Country.php @@ -43,18 +43,18 @@ class Country extends \Magento\Eav\Model\Entity\Attribute\Source\Table /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countriesFactory */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, \Magento\Directory\Model\Resource\Country\CollectionFactory $countriesFactory ) { $this->_countriesFactory = $countriesFactory; - parent::__construct($coreData, $attrOptCollFactory, $attrOptionFactory); + parent::__construct($coreData, $attrOptionCollectionFactory, $attrOptionFactory); } /** diff --git a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Source/Region.php b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Source/Region.php index 02c052f31ff..cb19eff2437 100644 --- a/app/code/Magento/Customer/Model/Resource/Address/Attribute/Source/Region.php +++ b/app/code/Magento/Customer/Model/Resource/Address/Attribute/Source/Region.php @@ -43,18 +43,18 @@ class Region extends \Magento\Eav\Model\Entity\Attribute\Source\Table /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionsFactory */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, \Magento\Directory\Model\Resource\Region\CollectionFactory $regionsFactory ) { $this->_regionsFactory = $regionsFactory; - parent::__construct($coreData, $attrOptCollFactory, $attrOptionFactory); + parent::__construct($coreData, $attrOptionCollectionFactory, $attrOptionFactory); } /** diff --git a/app/code/Magento/Customer/Model/Resource/Setup.php b/app/code/Magento/Customer/Model/Resource/Setup.php index 661a3361f71..26b71e2ee72 100644 --- a/app/code/Magento/Customer/Model/Resource/Setup.php +++ b/app/code/Magento/Customer/Model/Resource/Setup.php @@ -45,7 +45,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup * @param \Magento\Core\Model\Resource\Setup\Context $context * @param string $resourceName * @param \Magento\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory * @param \Magento\Eav\Model\Config $eavConfig * @param string $moduleName * @param string $connectionName @@ -54,13 +54,13 @@ class Setup extends \Magento\Eav\Model\Entity\Setup \Magento\Core\Model\Resource\Setup\Context $context, $resourceName, \Magento\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Eav\Model\Config $eavConfig, $moduleName = 'Magento_Customer', $connectionName = '' ) { $this->_eavConfig = $eavConfig; - parent::__construct($context, $resourceName, $cache, $attrGrCollFactory, $moduleName, $connectionName); + parent::__construct($context, $resourceName, $cache, $attrGroupCollectionFactory, $moduleName, $connectionName); } /** diff --git a/app/code/Magento/Customer/etc/module.xml b/app/code/Magento/Customer/etc/module.xml index d59bdfa3263..46d7f44c09a 100755 --- a/app/code/Magento/Customer/etc/module.xml +++ b/app/code/Magento/Customer/etc/module.xml @@ -41,6 +41,11 @@ <module name="Magento_Index"/> <module name="Magento_Log"/> <module name="Magento_Theme"/> + <module name="Magento_Backend"/> + <module name="Magento_Review"/> + <module name="Magento_Tax"/> + <module name="Magento_Email"/> + <module name="Magento_Service"/> </depends> </module> </config> diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php index 2fb637ac90f..9a466c482a2 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php @@ -54,7 +54,7 @@ class Configuration protected $_design; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -101,7 +101,7 @@ class Configuration /** * @param \Magento\View\DesignInterface $design - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Event\ManagerInterface $eventDispatcher * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\DesignEditor\Model\Config\Control\AbstractControl $configuration @@ -110,7 +110,7 @@ class Configuration */ public function __construct( \Magento\View\DesignInterface $design, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Event\ManagerInterface $eventDispatcher, \Magento\View\ConfigInterface $viewConfig, \Magento\DesignEditor\Model\Config\Control\AbstractControl $configuration = null, @@ -304,7 +304,7 @@ class Configuration protected function _saveViewConfiguration(\DOMDocument $config) { $targetPath = $this->_theme->getCustomization()->getCustomViewConfigPath(); - $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $directory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $directory->writeFile($directory->getRelativePath($targetPath), $config->saveXML()); return $this; } diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Factory.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Factory.php index 6fb3615313a..80cec9c726f 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Factory.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Factory.php @@ -64,7 +64,7 @@ class Factory protected $fileIteratorFactory; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -72,13 +72,13 @@ class Factory * @param \Magento\ObjectManager $objectManager * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\Config\FileIteratorFactory $fileIteratorFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\ObjectManager $objectManager, \Magento\View\FileSystem $viewFileSystem, \Magento\Config\FileIteratorFactory $fileIteratorFactory, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_objectManager = $objectManager; $this->_viewFileSystem = $viewFileSystem; @@ -133,7 +133,7 @@ class Factory throw new \Magento\Exception("Unknown control configuration type: \"{$type}\""); break; } - $rootDirectory = $this->filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $rootDirectory = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $paths = array(); foreach ($files as $file) { $paths[] = $rootDirectory->getRelativePath($file); diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php index 74686f76d2d..01268fb160d 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php @@ -44,7 +44,7 @@ class ImageUploader extends \Magento\Object protected $_storagePath; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -65,12 +65,12 @@ class ImageUploader extends \Magento\Object * Generic constructor of change instance * * @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param array $data */ public function __construct( \Magento\Core\Model\File\UploaderFactory $uploaderFactory, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, array $data = array() ) { $this->_uploaderFactory = $uploaderFactory; @@ -154,7 +154,7 @@ class ImageUploader extends \Magento\Object */ public function removeFile($file) { - $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $directory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $path = $directory->getRelativePath($this->getStoragePath() . '/' . $file); if ($directory->isExist($path)) { $directory->delete($path); diff --git a/app/code/Magento/Directory/Block/Currency.php b/app/code/Magento/Directory/Block/Currency.php index b4a0b701fe6..e56e81ec864 100644 --- a/app/code/Magento/Directory/Block/Currency.php +++ b/app/code/Magento/Directory/Block/Currency.php @@ -58,6 +58,7 @@ class Currency extends \Magento\View\Element\Template $this->_directoryUrl = $directoryUrl; $this->_currencyFactory = $currencyFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Directory/Block/Data.php b/app/code/Magento/Directory/Block/Data.php index 31f07b6f221..92cefbf0d96 100644 --- a/app/code/Magento/Directory/Block/Data.php +++ b/app/code/Magento/Directory/Block/Data.php @@ -39,12 +39,12 @@ class Data extends \Magento\View\Element\Template /** * @var \Magento\Directory\Model\Resource\Region\CollectionFactory */ - protected $_regionCollFactory; + protected $_regionCollectionFactory; /** * @var \Magento\Directory\Model\Resource\Country\CollectionFactory */ - protected $_countryCollFactory; + protected $_countryCollectionFactory; /** * @var \Magento\Json\EncoderInterface @@ -61,8 +61,8 @@ class Data extends \Magento\View\Element\Template * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\App\Cache\Type\Config $configCacheType - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory * @param array $data */ public function __construct( @@ -70,16 +70,16 @@ class Data extends \Magento\View\Element\Template \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\App\Cache\Type\Config $configCacheType, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, array $data = array() ) { parent::__construct($context, $data); $this->_coreData = $coreData; $this->_jsonEncoder = $jsonEncoder; $this->_configCacheType = $configCacheType; - $this->_regionCollFactory = $regionCollFactory; - $this->_countryCollFactory = $countryCollFactory; + $this->_regionCollectionFactory = $regionCollectionFactory; + $this->_countryCollectionFactory = $countryCollectionFactory; } /** @@ -97,7 +97,7 @@ class Data extends \Magento\View\Element\Template { $collection = $this->getData('country_collection'); if (is_null($collection)) { - $collection = $this->_countryCollFactory->create()->loadByStore(); + $collection = $this->_countryCollectionFactory->create()->loadByStore(); $this->setData('country_collection', $collection); } @@ -145,7 +145,7 @@ class Data extends \Magento\View\Element\Template { $collection = $this->getData('region_collection'); if (is_null($collection)) { - $collection = $this->_regionCollFactory->create() + $collection = $this->_regionCollectionFactory->create() ->addCountryFilter($this->getCountryId()) ->load(); @@ -204,7 +204,7 @@ class Data extends \Magento\View\Element\Template foreach ($this->getCountryCollection() as $country) { $countryIds[] = $country->getCountryId(); } - $collection = $this->_regionCollFactory->create() + $collection = $this->_regionCollectionFactory->create() ->addCountryFilter($countryIds) ->load(); $regions = array(); diff --git a/app/code/Magento/Directory/Helper/Data.php b/app/code/Magento/Directory/Helper/Data.php index 5dc8434aaa8..6ed3b6ffec1 100644 --- a/app/code/Magento/Directory/Helper/Data.php +++ b/app/code/Magento/Directory/Helper/Data.php @@ -89,7 +89,7 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * @var \Magento\Directory\Model\Resource\Region\CollectionFactory */ - protected $_regCollFactory; + protected $_regCollectionFactory; /** * @var \Magento\Core\Helper\Data @@ -115,7 +115,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\App\Helper\Context $context * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Directory\Model\Resource\Country\Collection $countryCollection - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regCollFactory, + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regCollectionFactory, * @param \Magento\Core\Helper\Data $coreHelper * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory @@ -125,7 +125,7 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\App\Helper\Context $context, \Magento\App\Cache\Type\Config $configCacheType, \Magento\Directory\Model\Resource\Country\Collection $countryCollection, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regCollFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regCollectionFactory, \Magento\Core\Helper\Data $coreHelper, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Directory\Model\CurrencyFactory $currencyFactory, @@ -134,7 +134,7 @@ class Data extends \Magento\App\Helper\AbstractHelper parent::__construct($context); $this->_configCacheType = $configCacheType; $this->_countryCollection = $countryCollection; - $this->_regCollFactory = $regCollFactory; + $this->_regCollectionFactory = $regCollectionFactory; $this->_coreHelper = $coreHelper; $this->_storeManager = $storeManager; $this->_currencyFactory = $currencyFactory; @@ -149,7 +149,7 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getRegionCollection() { if (!$this->_regionCollection) { - $this->_regionCollection = $this->_regCollFactory->create(); + $this->_regionCollection = $this->_regCollectionFactory->create(); $this->_regionCollection->addCountryFilter($this->getAddress()->getCountryId()) ->load(); } @@ -185,7 +185,7 @@ class Data extends \Magento\App\Helper\AbstractHelper foreach ($this->getCountryCollection() as $country) { $countryIds[] = $country->getCountryId(); } - $collection = $this->_regCollFactory->create(); + $collection = $this->_regCollectionFactory->create(); $collection->addCountryFilter($countryIds) ->load(); $regions = array( diff --git a/app/code/Magento/Directory/Model/Config/Source/Allregion.php b/app/code/Magento/Directory/Model/Config/Source/Allregion.php index c64b148da88..651cb23a0b1 100644 --- a/app/code/Magento/Directory/Model/Config/Source/Allregion.php +++ b/app/code/Magento/Directory/Model/Config/Source/Allregion.php @@ -41,29 +41,29 @@ class Allregion implements \Magento\Core\Model\Option\ArrayInterface /** * @var \Magento\Directory\Model\Resource\Country\CollectionFactory */ - protected $_countryCollFactory; + protected $_countryCollectionFactory; /** * @var \Magento\Directory\Model\Resource\Region\CollectionFactory */ - protected $_regionCollFactory; + protected $_regionCollectionFactory; /** - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory */ public function __construct( - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory ) { - $this->_countryCollFactory = $countryCollFactory; - $this->_regionCollFactory = $regionCollFactory; + $this->_countryCollectionFactory = $countryCollectionFactory; + $this->_regionCollectionFactory = $regionCollectionFactory; } public function toOptionArray($isMultiselect = false) { if (!$this->_options) { - $countriesArray = $this->_countryCollFactory->create()->load() + $countriesArray = $this->_countryCollectionFactory->create()->load() ->toOptionArray(false); $this->_countries = array(); foreach ($countriesArray as $a) { @@ -71,7 +71,7 @@ class Allregion implements \Magento\Core\Model\Option\ArrayInterface } $countryRegions = array(); - $regionsCollection = $this->_regionCollFactory->create()->load(); + $regionsCollection = $this->_regionCollectionFactory->create()->load(); foreach ($regionsCollection as $region) { $countryRegions[$region->getCountryId()][$region->getId()] = $region->getDefaultName(); } diff --git a/app/code/Magento/Directory/Model/Country.php b/app/code/Magento/Directory/Model/Country.php index aa31328668d..786ade7a464 100644 --- a/app/code/Magento/Directory/Model/Country.php +++ b/app/code/Magento/Directory/Model/Country.php @@ -58,14 +58,14 @@ class Country extends \Magento\Core\Model\AbstractModel /** * @var \Magento\Directory\Model\Resource\Region\CollectionFactory */ - protected $_regionCollFactory; + protected $_regionCollectionFactory; /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Directory\Model\Country\FormatFactory $formatFactory - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -75,7 +75,7 @@ class Country extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Registry $registry, \Magento\Core\Model\LocaleInterface $locale, \Magento\Directory\Model\Country\FormatFactory $formatFactory, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -85,7 +85,7 @@ class Country extends \Magento\Core\Model\AbstractModel ); $this->_locale = $locale; $this->_formatFactory = $formatFactory; - $this->_regionCollFactory = $regionCollFactory; + $this->_regionCollectionFactory = $regionCollectionFactory; } protected function _construct() @@ -126,7 +126,7 @@ class Country extends \Magento\Core\Model\AbstractModel */ public function getRegionCollection() { - $collection = $this->_regionCollFactory->create(); + $collection = $this->_regionCollectionFactory->create(); $collection->addCountryFilter($this->getId()); return $collection; } diff --git a/app/code/Magento/Directory/etc/module.xml b/app/code/Magento/Directory/etc/module.xml index 4d55b7882c7..ff57ec40fab 100755 --- a/app/code/Magento/Directory/etc/module.xml +++ b/app/code/Magento/Directory/etc/module.xml @@ -31,6 +31,7 @@ <depends> <module name="Magento_Core"/> <module name="Magento_Backend"/> + <module name="Magento_Email"/> </depends> </module> </config> diff --git a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php index 9b1dcffb29d..f0613c86c56 100644 --- a/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php +++ b/app/code/Magento/Downloadable/Block/Adminhtml/Catalog/Product/Edit/Tab/Downloadable.php @@ -47,6 +47,13 @@ class Downloadable protected $_template = 'product/edit/downloadable.phtml'; + /** + * Accordion block id + * + * @var string + */ + protected $accordionBlockId = 'downloadableInfo'; + /** * Core registry * @@ -136,6 +143,16 @@ class Downloadable return \Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs::ADVANCED_TAB_GROUP_CODE; } + /** + * Get downloadable tab content id + * + * @return string + */ + public function getContentTabId() + { + return 'tab_content_' . $this->accordionBlockId; + } + /** * Render block HTML * @@ -144,8 +161,7 @@ class Downloadable protected function _toHtml() { $accordion = $this->getLayout()->createBlock('Magento\Backend\Block\Widget\Accordion') - ->setId('downloadableInfo'); - + ->setId($this->accordionBlockId); $accordion->addItem('samples', array( 'title' => __('Samples'), 'content' => $this->getLayout() diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php index 785e5748243..9bef411e39c 100644 --- a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php +++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php @@ -66,6 +66,7 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Helper\Data $coreData * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -84,7 +85,8 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Tax\Model\Calculation $calculationModel, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Core\Helper\Data $coreData, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_calculationModel = $calculationModel; $this->jsonEncoder = $jsonEncoder; @@ -101,8 +103,10 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php b/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php index 9449224f0ab..3e4120bf820 100644 --- a/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php +++ b/app/code/Magento/Downloadable/Block/Customer/Products/ListProducts.php @@ -68,6 +68,7 @@ class ListProducts extends \Magento\View\Element\Template $this->_linksFactory = $linksFactory; $this->_itemsFactory = $itemsFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Core/Model/DataService/Config/Reader/Factory.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Downloadable.php similarity index 57% rename from app/code/Magento/Core/Model/DataService/Config/Reader/Factory.php rename to app/code/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Downloadable.php index eceb286d337..e20bcb4699b 100644 --- a/app/code/Magento/Core/Model/DataService/Config/Reader/Factory.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Downloadable.php @@ -1,7 +1,5 @@ <?php /** - * Factory for \Magento\Core\Model\DataService\Config\Reader - * * Magento * * NOTICE OF LICENSE @@ -23,32 +21,35 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\DataService\Config\Reader; -class Factory +namespace Magento\Downloadable\Controller\Adminhtml\Product\Initialization\Helper\Plugin; + +class Downloadable { /** - * @var \Magento\ObjectManager + * @var \Magento\App\RequestInterface */ - protected $_objectManager; + protected $request; /** - * @param \Magento\ObjectManager $objectManager + * @param \Magento\App\RequestInterface $request */ - public function __construct(\Magento\ObjectManager $objectManager) + public function __construct(\Magento\App\RequestInterface $request) { - $this->_objectManager = $objectManager; + $this->request = $request; } /** - * Create new \Magento\Core\Model\DataService\Config\Reader by array of configuration files + * Prepare product to save * - * @param array $configFiles - * @return \Magento\Core\Model\DataService\Config\Reader + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\Catalog\Model\Product */ - public function createReader($configFiles) + public function afterInitialize(\Magento\Catalog\Model\Product $product) { - return $this->_objectManager->create('Magento\Core\Model\DataService\Config\Reader', - array('configFiles' => $configFiles)); + if ($downloadable = $this->request->getPost('downloadable')) { + $product->setDownloadableData($downloadable); + } + return $product; } -} +} diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index b3df50a3d07..05c58c71b37 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -24,7 +24,7 @@ namespace Magento\Downloadable\Helper; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\Core\Exception as CoreException; /** @@ -123,7 +123,7 @@ class Download extends \Magento\App\Helper\AbstractHelper protected $_app; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -139,7 +139,7 @@ class Download extends \Magento\App\Helper\AbstractHelper * @param \Magento\Downloadable\Helper\File $downloadableFile * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\App\Helper\Context $context, @@ -147,7 +147,7 @@ class Download extends \Magento\App\Helper\AbstractHelper \Magento\Downloadable\Helper\File $downloadableFile, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_coreData = $coreData; $this->_downloadableFile = $downloadableFile; @@ -175,7 +175,7 @@ class Download extends \Magento\App\Helper\AbstractHelper if ($this->_linkType == self::LINK_TYPE_URL) { $this->_handle = $this->_filesystem->getRemoteResource($this->_resourceFile); } elseif ($this->_linkType == self::LINK_TYPE_FILE) { - $this->_workingDirectory = $this->_filesystem->getDirectoryRead(Filesystem::MEDIA); + $this->_workingDirectory = $this->_filesystem->getDirectoryRead(Filesystem::MEDIA_DIR); $fileExists = $this->_downloadableFile->ensureFileInFilesystem($this->_resourceFile); if ($fileExists) { $this->_handle = $this->_workingDirectory->openFile($this->_resourceFile); diff --git a/app/code/Magento/Downloadable/Helper/File.php b/app/code/Magento/Downloadable/Helper/File.php index 9b5e240bad5..d6d00b4947d 100644 --- a/app/code/Magento/Downloadable/Helper/File.php +++ b/app/code/Magento/Downloadable/Helper/File.php @@ -45,7 +45,7 @@ class File extends \Magento\App\Helper\AbstractHelper /** * Filesystem object. * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -60,18 +60,18 @@ class File extends \Magento\App\Helper\AbstractHelper * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param array $mimeTypes */ public function __construct( \Magento\App\Helper\Context $context, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, array $mimeTypes = array() ) { $this->_coreFileStorageDatabase = $coreFileStorageDatabase; $this->_filesystem = $filesystem; - $this->_mediaDirectory = $filesystem->getDirectoryWrite($filesystem::MEDIA); + $this->_mediaDirectory = $filesystem->getDirectoryWrite($filesystem::MEDIA_DIR); parent::__construct($context); if (!empty($mimeTypes)) { foreach ($mimeTypes as $key => $value) { diff --git a/app/code/Magento/Downloadable/Model/Observer.php b/app/code/Magento/Downloadable/Model/Observer.php index 2bd10908e7e..9be8023eda3 100644 --- a/app/code/Magento/Downloadable/Model/Observer.php +++ b/app/code/Magento/Downloadable/Model/Observer.php @@ -399,73 +399,6 @@ class Observer return $this; } - /** - * Duplicating downloadable product data - * - * @param \Magento\Event\Observer $observer - * @return \Magento\Downloadable\Model\Observer - */ - public function duplicateProduct($observer) - { - $currentProduct = $observer->getCurrentProduct(); - $newProduct = $observer->getNewProduct(); - if ($currentProduct->getTypeId() !== \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) { - //do nothing if not downloadable - return $this; - } - $downloadableData = array(); - $type = $currentProduct->getTypeInstance(); - foreach ($type->getLinks($currentProduct) as $link) { - $linkData = $link->getData(); - $downloadableData['link'][] = array( - 'is_delete' => false, - 'link_id' => null, - 'title' => $linkData['title'], - 'is_shareable' => $linkData['is_shareable'], - 'sample' => array( - 'type' => $linkData['sample_type'], - 'url' => $linkData['sample_url'], - 'file' => $this->_helper->jsonEncode(array(array( - 'file' => $linkData['sample_file'], - 'name' => $linkData['sample_file'], - 'size' => 0, - 'status' => null, - ))) - ), - 'file' => $this->_helper->jsonEncode(array(array( - 'file' => $linkData['link_file'], - 'name' => $linkData['link_file'], - 'size' => 0, - 'status' => null, - ))), - 'type' => $linkData['link_type'], - 'link_url' => $linkData['link_url'], - 'sort_order' => $linkData['sort_order'], - 'number_of_downloads' => $linkData['number_of_downloads'], - 'price' => $linkData['price'], - ); - } - foreach ($type->getSamples($currentProduct) as $sample) { - $sampleData = $sample->getData(); - $downloadableData['sample'][] = array( - 'is_delete' => false, - 'sample_id' => null, - 'title' => $sampleData['title'], - 'type' => $sampleData['sample_type'], - 'file' => $this->_helper->jsonEncode(array(array( - 'file' => $sampleData['sample_file'], - 'name' => $sampleData['sample_file'], - 'size' => 0, - 'status' => null, - ))), - 'sample_url' => $sampleData['sample_url'], - 'sort_order' => $sampleData['sort_order'], - ); - } - $newProduct->setDownloadableData($downloadableData); - return $this; - } - /** * @return \Magento\Downloadable\Model\Link\Purchased */ diff --git a/app/code/Magento/Downloadable/Model/Product/CopyConstructor/Downloadable.php b/app/code/Magento/Downloadable/Model/Product/CopyConstructor/Downloadable.php new file mode 100644 index 00000000000..36f5782507a --- /dev/null +++ b/app/code/Magento/Downloadable/Model/Product/CopyConstructor/Downloadable.php @@ -0,0 +1,109 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Downloadable\Model\Product\CopyConstructor; + +class Downloadable implements \Magento\Catalog\Model\Product\CopyConstructorInterface +{ + /** + * @var \Magento\Core\Helper\Data + */ + protected $encoder; + + /** + * @param \Magento\Core\Helper\Data $encoder + */ + public function __construct(\Magento\Core\Helper\Data $encoder) + { + $this->encoder = $encoder; + } + + /** + * Duplicating downloadable product data + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $duplicate + */ + public function build(\Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate) + { + if ($product->getTypeId() !== \Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) { + //do nothing if not downloadable + return; + } + $data = array(); + /** @var \Magento\Downloadable\Model\Product\Type $type */ + $type = $product->getTypeInstance(); + foreach ($type->getLinks($product) as $link) { + /* @var \Magento\Downloadable\Model\Link $link */ + $linkData = $link->getData(); + $data['link'][] = array( + 'is_delete' => false, + 'link_id' => null, + 'title' => $linkData['title'], + 'is_shareable' => $linkData['is_shareable'], + 'sample' => array( + 'type' => $linkData['sample_type'], + 'url' => $linkData['sample_url'], + 'file' => $this->encoder->jsonEncode(array(array( + 'file' => $linkData['sample_file'], + 'name' => $linkData['sample_file'], + 'size' => 0, + 'status' => null, + ))) + ), + 'file' => $this->encoder->jsonEncode(array(array( + 'file' => $linkData['link_file'], + 'name' => $linkData['link_file'], + 'size' => 0, + 'status' => null, + ))), + 'type' => $linkData['link_type'], + 'link_url' => $linkData['link_url'], + 'sort_order' => $linkData['sort_order'], + 'number_of_downloads' => $linkData['number_of_downloads'], + 'price' => $linkData['price'], + ); + } + + /** @var \Magento\Downloadable\Model\Sample $sample */ + foreach ($type->getSamples($product) as $sample) { + $sampleData = $sample->getData(); + $data['sample'][] = array( + 'is_delete' => false, + 'sample_id' => null, + 'title' => $sampleData['title'], + 'type' => $sampleData['sample_type'], + 'file' => $this->encoder->jsonEncode(array(array( + 'file' => $sampleData['sample_file'], + 'name' => $sampleData['sample_file'], + 'size' => 0, + 'status' => null, + ))), + 'sample_url' => $sampleData['sample_url'], + 'sort_order' => $sampleData['sort_order'], + ); + } + $duplicate->setDownloadableData($data); + } +} diff --git a/app/code/Magento/Downloadable/Model/Product/Type.php b/app/code/Magento/Downloadable/Model/Product/Type.php index be86336d5ca..72906e14cb0 100644 --- a/app/code/Magento/Downloadable/Model/Product/Type.php +++ b/app/code/Magento/Downloadable/Model/Product/Type.php @@ -85,7 +85,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual * @param \Magento\Downloadable\Helper\File $downloadableFile * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Logger $logger * @param \Magento\Downloadable\Model\Resource\SampleFactory $sampleResFactory @@ -104,7 +104,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\Data $coreData, \Magento\Core\Helper\File\Storage\Database $fileStorageDb, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, \Magento\Logger $logger, \Magento\Downloadable\Helper\File $downloadableFile, diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php index 52f5ec3ce7c..026763a80bc 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php @@ -59,7 +59,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory @@ -71,7 +71,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php index 539be499cf2..9247d08ef73 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -41,7 +41,7 @@ class Creditmemo * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory @@ -54,7 +54,7 @@ class Creditmemo \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php index 7750ee749f6..0b515c173fa 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php @@ -46,7 +46,7 @@ class Invoice * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory @@ -59,7 +59,7 @@ class Invoice \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, diff --git a/app/code/Magento/PageCache/etc/frontend/di.xml b/app/code/Magento/Downloadable/etc/adminhtml/di.xml similarity index 68% rename from app/code/Magento/PageCache/etc/frontend/di.xml rename to app/code/Magento/Downloadable/etc/adminhtml/di.xml index bd7d73e6bdb..8e4ced5f6ab 100644 --- a/app/code/Magento/PageCache/etc/frontend/di.xml +++ b/app/code/Magento/Downloadable/etc/adminhtml/di.xml @@ -24,19 +24,14 @@ */ --> <config> - <type name="Magento\PageCache\Model\Observer"> - <param name="allowedCache"> + <type name="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper"> + <plugin name="Downloadable" type="Magento\Downloadable\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Downloadable" sortOrder="70" /> + </type> + <type name="Magento\Catalog\Model\Product\CopyConstructor\Composite"> + <param name="constructors"> <value> - <cms>true</cms> - <catalog> - <category> - <view>true</view> - </category> - <product> - <view>true</view> - </product> - </catalog> + <downloadable>Magento\Downloadable\Model\Product\CopyConstructor\Downloadable</downloadable> </value> </param> </type> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Downloadable/etc/adminhtml/events.xml b/app/code/Magento/Downloadable/etc/adminhtml/events.xml index b2e3fe4ca1a..6c175d47eca 100644 --- a/app/code/Magento/Downloadable/etc/adminhtml/events.xml +++ b/app/code/Magento/Downloadable/etc/adminhtml/events.xml @@ -24,12 +24,6 @@ */ --> <config> - <event name="catalog_product_prepare_save"> - <observer name="downloadable_observer" instance="Magento\Downloadable\Model\Observer" method="prepareProductSave" /> - </event> - <event name="catalog_model_product_duplicate"> - <observer name="downloadable_observer" instance="Magento\Downloadable\Model\Observer" method="duplicateProduct" /> - </event> <event name="sales_order_item_save_commit_after"> <observer name="downloadable_observer" instance="Magento\Downloadable\Model\Observer" method="saveDownloadableOrderItem" /> </event> diff --git a/app/code/Magento/Downloadable/etc/module.xml b/app/code/Magento/Downloadable/etc/module.xml index 1de608ef7d9..617c9b1f864 100755 --- a/app/code/Magento/Downloadable/etc/module.xml +++ b/app/code/Magento/Downloadable/etc/module.xml @@ -27,6 +27,7 @@ <module name="Magento_Downloadable" version="1.6.0.0.3" active="true"> <sequence> <module name="Magento_Catalog"/> + <module name="Magento_GroupedProduct" /> </sequence> <depends> <module name="Magento_Catalog"/> diff --git a/app/code/Magento/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/Magento/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php index 1f4c80b8bf6..b840edd97d6 100644 --- a/app/code/Magento/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php +++ b/app/code/Magento/Downloadable/sql/downloadable_setup/mysql4-upgrade-1.6.0.0.1-1.6.0.0.2.php @@ -29,7 +29,7 @@ $installFile = __DIR__ . '/upgrade-1.6.0.0.1-1.6.0.0.2.php'; /** @var \Magento\Filesystem\Directory\Read $moduleDirectory */ -$moduleDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\Filesystem::MODULES); +$moduleDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); if ($moduleDirectory->isExist($moduleDirectory->getRelativePath($installFile))) { include $installFile; } diff --git a/app/code/Magento/Downloadable/view/adminhtml/product/edit/downloadable.phtml b/app/code/Magento/Downloadable/view/adminhtml/product/edit/downloadable.phtml index 9914fc5d923..7609651e5f0 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/product/edit/downloadable.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/product/edit/downloadable.phtml @@ -222,7 +222,7 @@ jQuery.mage.extend('validation', 'validation', </div> <?php if ($this->isReadonly()): ?> <script type="text/javascript"> -$('downloadableInfo').select('input', 'select', 'textarea', 'button').each(function (item){ +$(<?= $this->getContentTabId(); ?>).select('input', 'select', 'textarea', 'button').each(function (item){ item.disabled = true; if (item.tagName.toLowerCase() == 'button') { item.addClassName('disabled'); diff --git a/app/code/Magento/Downloadable/view/frontend/checkout/cart/item/default.phtml b/app/code/Magento/Downloadable/view/frontend/checkout/cart/item/default.phtml index 4262743082a..ce8deef606a 100644 --- a/app/code/Magento/Downloadable/view/frontend/checkout/cart/item/default.phtml +++ b/app/code/Magento/Downloadable/view/frontend/checkout/cart/item/default.phtml @@ -292,7 +292,7 @@ $canApplyMsrp = $this->helper('Magento\Catalog\Helper\Data')->canApplyMsrp($_ite <div class="actions"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllowInCart()) : ?> <?php if ($isVisibleProduct): ?> - <a href="<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getMoveFromCartUrl($_item->getId()); ?>" class="use-ajax action towishlist"> + <a href="#" data-post='<?php echo $this->helper('Magento\Wishlist\Helper\Data')->getMoveFromCartParams($_item->getId()); ?>' class="use-ajax action towishlist"> <span><?php echo __('Move to Wishlist'); ?></span> </a> <?php endif ?> diff --git a/app/code/Magento/Downloadable/view/frontend/layout/checkout_multishipping_addresses.xml b/app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_addresses.xml similarity index 100% rename from app/code/Magento/Downloadable/view/frontend/layout/checkout_multishipping_addresses.xml rename to app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_addresses.xml diff --git a/app/code/Magento/Downloadable/view/frontend/layout/checkout_multishipping_overview.xml b/app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_overview.xml similarity index 100% rename from app/code/Magento/Downloadable/view/frontend/layout/checkout_multishipping_overview.xml rename to app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_overview.xml diff --git a/app/code/Magento/Downloadable/view/frontend/layout/checkout_multishipping_shipping.xml b/app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_shipping.xml similarity index 100% rename from app/code/Magento/Downloadable/view/frontend/layout/checkout_multishipping_shipping.xml rename to app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_shipping.xml diff --git a/app/code/Magento/Downloadable/view/frontend/layout/checkout_multishipping_success.xml b/app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_success.xml similarity index 100% rename from app/code/Magento/Downloadable/view/frontend/layout/checkout_multishipping_success.xml rename to app/code/Magento/Downloadable/view/frontend/layout/multishipping_checkout_success.xml diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php index 076e822bb53..460faf3c31b 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Options/Options.php @@ -39,7 +39,7 @@ class Options extends \Magento\Backend\Block\Template protected $_registry; /** @var \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory */ - protected $_attrOptCollFactory; + protected $_attrOptionCollectionFactory; /** * @inheritdoc @@ -54,20 +54,20 @@ class Options extends \Magento\Backend\Block\Template /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Validator\UniversalFactory $universalFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Validator\UniversalFactory $universalFactory, array $data = array() ) { parent::__construct($context, $data); $this->_registry = $registry; - $this->_attrOptCollFactory = $attrOptCollFactory; + $this->_attrOptionCollectionFactory = $attrOptionCollectionFactory; $this->_universalFactory = $universalFactory; } @@ -165,7 +165,7 @@ class Options extends \Magento\Backend\Block\Template ->getAllOptions(); return $options; } else { - return $this->_attrOptCollFactory->create() + return $this->_attrOptionCollectionFactory->create() ->setAttributeFilter($attribute->getId()) ->setPositionOrder('asc', true) ->load(); @@ -248,7 +248,7 @@ class Options extends \Magento\Backend\Block\Template $values = $this->getData('store_option_values_'.$storeId); if (is_null($values)) { $values = array(); - $valuesCollection = $this->_attrOptCollFactory->create() + $valuesCollection = $this->_attrOptionCollectionFactory->create() ->setAttributeFilter($this->getAttributeObject()->getId()) ->setStoreFilter($storeId, false) ->load(); diff --git a/app/code/Magento/Eav/Model/Attribute/Data/File.php b/app/code/Magento/Eav/Model/Attribute/Data/File.php index 79d9b04d817..a4744e929ee 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/File.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/File.php @@ -64,19 +64,19 @@ class File extends \Magento\Eav\Model\Attribute\Data\AbstractData * @param \Magento\Logger $logger * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Model\File\Validator\NotProtectedExtension $fileValidator - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Core\Model\LocaleInterface $locale, \Magento\Logger $logger, \Magento\Core\Helper\Data $coreData, \Magento\Core\Model\File\Validator\NotProtectedExtension $fileValidator, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { parent::__construct($locale, $logger); $this->_coreData = $coreData; $this->_fileValidator = $fileValidator; - $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); } /** diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Store.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Store.php index fb99670e70b..dd3751e8777 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Store.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Store.php @@ -38,22 +38,22 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Source\Table /** * @var \Magento\Core\Model\Resource\Store\CollectionFactory */ - protected $_storeCollFactory; + protected $_storeCollectionFactory; /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory - * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollFactory + * @param \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory, - \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollFactory + \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory ) { - parent::__construct($coreData, $attrOptCollFactory, $attrOptionFactory); - $this->_storeCollFactory = $storeCollFactory; + parent::__construct($coreData, $attrOptionCollectionFactory, $attrOptionFactory); + $this->_storeCollectionFactory = $storeCollectionFactory; } /** @@ -64,7 +64,7 @@ class Store extends \Magento\Eav\Model\Entity\Attribute\Source\Table public function getAllOptions() { if ($this->_options === null) { - $this->_options = $this->_storeCollFactory->create() + $this->_options = $this->_storeCollectionFactory->create() ->load() ->toOptionArray(); } diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php index bd36815ec3f..c829baf787a 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php @@ -46,7 +46,7 @@ class Table extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource /** * @var \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory */ - protected $_attrOptCollFactory; + protected $_attrOptionCollectionFactory; /** * @var \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory @@ -55,16 +55,16 @@ class Table extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource /** * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory */ public function __construct( \Magento\Core\Helper\Data $coreData, - \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory, \Magento\Eav\Model\Resource\Entity\Attribute\OptionFactory $attrOptionFactory ) { $this->_coreData = $coreData; - $this->_attrOptCollFactory = $attrOptCollFactory; + $this->_attrOptionCollectionFactory = $attrOptionCollectionFactory; $this->_attrOptionFactory = $attrOptionFactory; } @@ -85,7 +85,7 @@ class Table extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource $this->_optionsDefault = array(); } if (!isset($this->_options[$storeId])) { - $collection = $this->_attrOptCollFactory->create() + $collection = $this->_attrOptionCollectionFactory->create() ->setPositionOrder('asc') ->setAttributeFilter($this->getAttribute()->getId()) ->setStoreFilter($this->getAttribute()->getStoreId()) diff --git a/app/code/Magento/Eav/Model/Entity/Setup.php b/app/code/Magento/Eav/Model/Entity/Setup.php index dbde73d66f4..be3acbc6c25 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup.php +++ b/app/code/Magento/Eav/Model/Entity/Setup.php @@ -44,13 +44,13 @@ class Setup extends \Magento\Core\Model\Resource\Setup /** * @var \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory */ - protected $_attrGrCollFactory; + protected $_attrGroupCollectionFactory; /** * @param \Magento\Core\Model\Resource\Setup\Context $context * @param string $resourceName * @param \Magento\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory * @param string $moduleName * @param string $connectionName */ @@ -58,13 +58,13 @@ class Setup extends \Magento\Core\Model\Resource\Setup \Magento\Core\Model\Resource\Setup\Context $context, $resourceName, \Magento\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, $moduleName = 'Magento_Eav', $connectionName = '' ) { $this->_cache = $cache; - $this->_attrGrCollFactory = $attrGrCollFactory; + $this->_attrGroupCollectionFactory = $attrGroupCollectionFactory; parent::__construct($context, $resourceName, $moduleName, $connectionName); } @@ -114,7 +114,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup */ public function getAttributeGroupCollectionFactory() { - return $this->_attrGrCollFactory->create(); + return $this->_attrGroupCollectionFactory->create(); } /** diff --git a/app/code/Magento/Email/Model/BackendTemplate.php b/app/code/Magento/Email/Model/BackendTemplate.php index 1165d9c2cbc..e5bb5f40689 100644 --- a/app/code/Magento/Email/Model/BackendTemplate.php +++ b/app/code/Magento/Email/Model/BackendTemplate.php @@ -47,7 +47,7 @@ class BackendTemplate extends Template * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\App\Emulation $appEmulation * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Url $viewUrl * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\Core\Model\Store\Config $coreStoreConfig @@ -65,7 +65,7 @@ class BackendTemplate extends Template \Magento\Core\Model\Registry $registry, \Magento\Core\Model\App\Emulation $appEmulation, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\Url $viewUrl, \Magento\View\FileSystem $viewFileSystem, \Magento\Core\Model\Store\Config $coreStoreConfig, diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php index e5c9a9a81db..21138b2d6e4 100644 --- a/app/code/Magento/Email/Model/Template.php +++ b/app/code/Magento/Email/Model/Template.php @@ -94,7 +94,7 @@ class Template extends \Magento\Core\Model\Template protected $_sendingException = null; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -141,7 +141,7 @@ class Template extends \Magento\Core\Model\Template * @param \Magento\Core\Model\Registry $registry * @param \Magento\Core\Model\App\Emulation $appEmulation * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Url $viewUrl * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig @@ -158,7 +158,7 @@ class Template extends \Magento\Core\Model\Template \Magento\Core\Model\Registry $registry, \Magento\Core\Model\App\Emulation $appEmulation, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\Url $viewUrl, \Magento\View\FileSystem $viewFileSystem, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, @@ -198,7 +198,7 @@ class Template extends \Magento\Core\Model\Template $fileName = $store->getConfig(self::XML_PATH_DESIGN_EMAIL_LOGO); if ($fileName) { $uploadDir = \Magento\Backend\Model\Config\Backend\Email\Logo::UPLOAD_DIR; - $mediaDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); + $mediaDirectory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); if ($mediaDirectory->isFile($uploadDir . '/' . $fileName)) { return $this->_storeManager->getStore()->getBaseUrl('media') . $uploadDir . '/' . $fileName; } @@ -284,7 +284,7 @@ class Template extends \Magento\Core\Model\Template $templateTypeCode = $templateType == 'html' ? self::TYPE_HTML : self::TYPE_TEXT; $this->setTemplateType($templateTypeCode); - $modulesDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $modulesDirectory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $templateText = $modulesDirectory->readFile($modulesDirectory->getRelativePath($templateFile)); if (preg_match('/<!--@subject\s*(.*?)\s*@-->/u', $templateText, $matches)) { diff --git a/app/code/Magento/Email/Model/Template/Config/FileResolver.php b/app/code/Magento/Email/Model/Template/Config/FileResolver.php index ff2dd57f152..e62fa17c373 100644 --- a/app/code/Magento/Email/Model/Template/Config/FileResolver.php +++ b/app/code/Magento/Email/Model/Template/Config/FileResolver.php @@ -38,14 +38,14 @@ class FileResolver implements \Magento\Config\FileResolverInterface protected $iteratorFactory; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Email\Model\Template\Config\FileIteratorFactory $iteratorFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Email\Model\Template\Config\FileIteratorFactory $iteratorFactory ) { - $this->directoryRead = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $this->directoryRead = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $this->iteratorFactory = $iteratorFactory; } diff --git a/app/code/Magento/Email/etc/module.xml b/app/code/Magento/Email/etc/module.xml index 56b37bfd6b2..eea112e8314 100644 --- a/app/code/Magento/Email/etc/module.xml +++ b/app/code/Magento/Email/etc/module.xml @@ -32,6 +32,8 @@ <depends> <module name="Magento_Core"/> <module name="Magento_Cms" /> + <module name="Magento_Backend" /> + <module name="Magento_Theme" /> </depends> </module> </config> diff --git a/app/code/Magento/GiftMessage/Block/Message/Inline.php b/app/code/Magento/GiftMessage/Block/Message/Inline.php index 9451ed4601c..44c99564404 100644 --- a/app/code/Magento/GiftMessage/Block/Message/Inline.php +++ b/app/code/Magento/GiftMessage/Block/Message/Inline.php @@ -77,6 +77,7 @@ class Inline extends \Magento\View\Element\Template $this->_giftMessageMessage = $giftMessageMessage; $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php b/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php new file mode 100644 index 00000000000..05163ed7ced --- /dev/null +++ b/app/code/Magento/GiftMessage/Block/Message/Multishipping/Plugin/ItemsBox.php @@ -0,0 +1,63 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GiftMessage\Block\Message\Multishipping\Plugin; + +use Magento\Code\Plugin\InvocationChain; + +/** + * Multishipping items box plugin + */ +class ItemsBox +{ + /** + * Gift message helper + * + * @var \Magento\GiftMessage\Helper\Message + */ + protected $helper; + + /** + * Construct + * + * @param \Magento\GiftMessage\Helper\Message $helper + */ + public function __construct(\Magento\GiftMessage\Helper\Message $helper) + { + $this->helper = $helper; + } + + /** + * Get items box message text for multishipping + * + * @param array $arguments + * @param InvocationChain $invocationChain + * @return string + */ + public function aroundGetItemsBoxTextAfter(array $arguments, InvocationChain $invocationChain) + { + $itemsBoxText = $invocationChain->proceed($arguments); + return $itemsBoxText . $this->helper->getInline('multishipping_address', $arguments[0]); + } +} diff --git a/app/code/Magento/GiftMessage/Helper/Message.php b/app/code/Magento/GiftMessage/Helper/Message.php index 54ff60f04e2..18a1cbc38f7 100644 --- a/app/code/Magento/GiftMessage/Helper/Message.php +++ b/app/code/Magento/GiftMessage/Helper/Message.php @@ -120,9 +120,7 @@ class Message extends \Magento\Core\Helper\Data */ public function getInline($type, \Magento\Object $entity, $dontDisplayContainer = false) { - if (!in_array($type, array('onepage_checkout', 'multishipping_address')) - && !$this->isMessagesAvailable($type, $entity) - ) { + if (!$this->isMessagesAvailable($type, $entity)) { return ''; } return $this->_layoutFactory->create()->createBlock('Magento\GiftMessage\Block\Message\Inline') diff --git a/app/code/Magento/GiftMessage/Model/Resource/Setup.php b/app/code/Magento/GiftMessage/Model/Resource/Setup.php index 7d2de59769c..7257cdae693 100644 --- a/app/code/Magento/GiftMessage/Model/Resource/Setup.php +++ b/app/code/Magento/GiftMessage/Model/Resource/Setup.php @@ -40,7 +40,7 @@ class Setup extends \Magento\Sales\Model\Resource\Setup * @param \Magento\Core\Model\Resource\Setup\Context $context * @param string $resourceName * @param \Magento\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory * @param \Magento\Core\Model\Config $config * @param \Magento\Catalog\Model\Resource\SetupFactory $catalogSetupFactory * @param string $moduleName @@ -50,14 +50,14 @@ class Setup extends \Magento\Sales\Model\Resource\Setup \Magento\Core\Model\Resource\Setup\Context $context, $resourceName, \Magento\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Core\Model\Config $config, \Magento\Catalog\Model\Resource\SetupFactory $catalogSetupFactory, $moduleName = 'Magento_GiftMessage', $connectionName = '' ) { $this->_catalogSetupFactory = $catalogSetupFactory; - parent::__construct($context, $resourceName, $cache, $attrGrCollFactory, $config, $moduleName, $connectionName); + parent::__construct($context, $resourceName, $cache, $attrGroupCollectionFactory, $config, $moduleName, $connectionName); } /** diff --git a/app/code/Magento/GiftMessage/etc/frontend/di.xml b/app/code/Magento/GiftMessage/etc/frontend/di.xml index 2e154abbd84..c5ccd5d4c4f 100644 --- a/app/code/Magento/GiftMessage/etc/frontend/di.xml +++ b/app/code/Magento/GiftMessage/etc/frontend/di.xml @@ -28,4 +28,7 @@ <type name="Magento\Sales\Model\Convert\Quote"> <plugin name="gift_message_quote_item_conversion" type="Magento\GiftMessage\Model\Plugin\QuoteItem"/> </type> + <type name="Magento\Multishipping\Block\Checkout\Shipping"> + <plugin name="getItemsBoxTextAfter" type="Magento\GiftMessage\Block\Message\Multishipping\Plugin\ItemsBox"/> + </type> </config> diff --git a/app/code/Magento/GiftMessage/view/frontend/inline.phtml b/app/code/Magento/GiftMessage/view/frontend/inline.phtml index d9deed84ce8..a64b5f0a369 100644 --- a/app/code/Magento/GiftMessage/view/frontend/inline.phtml +++ b/app/code/Magento/GiftMessage/view/frontend/inline.phtml @@ -162,8 +162,6 @@ }); </script> <?php break; ?> -<?php case 'multishipping_adress_checkbox': ?> -<?php break; ?> <?php case 'multishipping_address': ?> <fieldset id="add-gift-options-<?php echo $this->getEntity()->getId() ?>" class="fieldset gift message"> diff --git a/app/code/Magento/GoogleAdwords/etc/frontend/events.xml b/app/code/Magento/GoogleAdwords/etc/frontend/events.xml index 7e6483d63bd..a74209ba25e 100644 --- a/app/code/Magento/GoogleAdwords/etc/frontend/events.xml +++ b/app/code/Magento/GoogleAdwords/etc/frontend/events.xml @@ -27,7 +27,7 @@ <event name="checkout_onepage_controller_success_action"> <observer name="googleadwords_order_success" instance="Magento\GoogleAdwords\Model\Observer" method="setConversionValue" /> </event> - <event name="checkout_multishipping_controller_success_action"> + <event name="multishipping_checkout_controller_success_action"> <observer name="googleadwords_order_success" instance="Magento\GoogleAdwords\Model\Observer" method="setConversionValue" /> </event> </config> diff --git a/app/code/Magento/GoogleAnalytics/etc/frontend/events.xml b/app/code/Magento/GoogleAnalytics/etc/frontend/events.xml index 0f7da9497d7..f8751cd1209 100644 --- a/app/code/Magento/GoogleAnalytics/etc/frontend/events.xml +++ b/app/code/Magento/GoogleAnalytics/etc/frontend/events.xml @@ -27,7 +27,7 @@ <event name="checkout_onepage_controller_success_action"> <observer name="googleanalytics_order_success" instance="Magento\GoogleAnalytics\Model\Observer" method="setGoogleAnalyticsOnOrderSuccessPageView" /> </event> - <event name="checkout_multishipping_controller_success_action"> + <event name="multishipping_checkout_controller_success_action"> <observer name="googleanalytics_order_success" instance="Magento\GoogleAnalytics\Model\Observer" method="setGoogleAnalyticsOnOrderSuccessPageView" /> </event> <event name="googlecheckout_block_link_html_before"> diff --git a/app/code/Magento/GoogleCheckout/Block/Link.php b/app/code/Magento/GoogleCheckout/Block/Link.php index 3829a4e0c44..d86a2f0bf16 100644 --- a/app/code/Magento/GoogleCheckout/Block/Link.php +++ b/app/code/Magento/GoogleCheckout/Block/Link.php @@ -60,6 +60,7 @@ class Link extends \Magento\View\Element\Template $this->paymentFactory = $paymentFactory; $this->checkoutSession = $checkoutSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } public function getImageStyle() diff --git a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php index 9589b61b91a..6a290b079ce 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php +++ b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php @@ -58,6 +58,11 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml */ protected $_eventManager = null; + /** + * @var \Magento\Shipping\Model\CarrierFactory + */ + protected $_carrierFactory; + /** * @var \Magento\Stdlib\String */ @@ -72,6 +77,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml * @param \Magento\GoogleCheckout\Helper\Data $googleCheckoutData * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Stdlib\String $string + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param array $data */ public function __construct( @@ -83,6 +89,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml \Magento\GoogleCheckout\Helper\Data $googleCheckoutData, \Magento\Tax\Helper\Data $taxData, \Magento\Stdlib\String $string, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, array $data = array() ) { $this->_eventManager = $eventManager; @@ -90,6 +97,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml $this->_googleCheckoutData = $googleCheckoutData; $this->_taxData = $taxData; $this->string = $string; + $this->_carrierFactory = $carrierFactory; parent::__construct($objectManager, $translator, $coreStoreConfig, $data); } @@ -282,7 +290,7 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml $address->setCollectShippingRates(true) ->collectShippingRates(); foreach ($address->getAllShippingRates() as $rate) { - if ($rate instanceof \Magento\Shipping\Model\Rate\Result\Error) { + if ($rate instanceof \Magento\Sales\Model\Quote\Address\RateResult\Error) { continue; } $methodName = sprintf('%s - %s', $rate->getCarrierTitle(), $rate->getMethodTitle()); @@ -643,13 +651,11 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml { $cacheKey = ($storeId === null) ? 'nofilter' : $storeId; if (!isset($this->_cachedShippingInfo[$cacheKey])) { - /* @var $shipping \Magento\Shipping\Model\Shipping */ - $shipping = $this->objectManager->create('Magento\Shipping\Model\Shipping'); $carriers = $this->_coreStoreConfig->getConfig('carriers', $storeId); $infos = array(); foreach (array_keys($carriers) as $carrierCode) { - $carrier = $shipping->getCarrierByCode($carrierCode); + $carrier = $this->_carrierFactory->getIfActive($carrierCode); if (!$carrier) { continue; } diff --git a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Checkout.php b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Checkout.php index 75b24778215..c3fd8c39b3e 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Checkout.php +++ b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Checkout.php @@ -92,6 +92,11 @@ class Checkout extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml */ protected $_eventManager = null; + /** + * @var \Magento\Shipping\Model\CarrierFactory + */ + protected $_carrierFactory; + /** * @param \Magento\ObjectManager $objectManager * @param \Magento\Core\Model\Translate $translator @@ -101,6 +106,7 @@ class Checkout extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml * @param \Magento\GoogleCheckout\Helper\Data $googleCheckoutData * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Weee\Helper\Data $weeeData + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param array $data */ public function __construct( @@ -112,6 +118,7 @@ class Checkout extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml \Magento\GoogleCheckout\Helper\Data $googleCheckoutData, \Magento\Tax\Helper\Data $taxData, \Magento\Weee\Helper\Data $weeeData, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, array $data = array() ) { $this->_eventManager = $eventManager; @@ -119,6 +126,7 @@ class Checkout extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml $this->_googleCheckoutData = $googleCheckoutData; $this->_taxData = $taxData; $this->_weeeData = $weeeData; + $this->_carrierFactory = $carrierFactory; parent::__construct($objectManager, $translator, $coreStoreConfig, $data); } @@ -736,7 +744,6 @@ EOT; $xml = ''; $methods = unserialize($methods); $taxHelper = $this->_taxData; - $shippingModel = $this->objectManager->create('Magento\Shipping\Model\Shipping'); foreach ($methods['method'] as $i => $method) { if (!$i || !$method) { @@ -744,7 +751,7 @@ EOT; } list($carrierCode, $methodCode) = explode('/', $method); if ($carrierCode) { - $carrier = $shippingModel->getCarrierByCode($carrierCode); + $carrier = $this->_carrierFactory->getIfActive($carrierCode); if ($carrier) { $allowedMethods = $carrier->getAllowedMethods(); diff --git a/app/code/Magento/GoogleCheckout/Model/Shipping.php b/app/code/Magento/GoogleCheckout/Model/Shipping.php index 76eea4bcba8..481763b06e0 100644 --- a/app/code/Magento/GoogleCheckout/Model/Shipping.php +++ b/app/code/Magento/GoogleCheckout/Model/Shipping.php @@ -40,10 +40,10 @@ class Shipping extends \Magento\Shipping\Model\Carrier\AbstractCarrier /** * Collects rates for user request * - * @param \Magento\Shipping\Model\Rate\Request $data + * @param \Magento\Sales\Model\Quote\Address\RateRequest $data * @return \Magento\Shipping\Model\Rate\Result */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { // dummy placeholder return $this; diff --git a/app/code/Magento/GoogleShopping/Helper/Price.php b/app/code/Magento/GoogleShopping/Helper/Price.php index bcb2a42fb23..9796713956b 100644 --- a/app/code/Magento/GoogleShopping/Helper/Price.php +++ b/app/code/Magento/GoogleShopping/Helper/Price.php @@ -74,7 +74,7 @@ class Price public function getCatalogPrice(\Magento\Catalog\Model\Product $product, $store = null, $inclTax = null) { switch ($product->getTypeId()) { - case \Magento\Catalog\Model\Product\Type::TYPE_GROUPED: + case \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE: // Workaround to avoid loading stock status by admin's website if ($store instanceof \Magento\Core\Model\Store) { $oldStore = $this->_storeManager->getStore(); @@ -136,7 +136,7 @@ class Price public function getCatalogRegularPrice(\Magento\Catalog\Model\Product $product, $store = null) { switch ($product->getTypeId()) { - case \Magento\Catalog\Model\Product\Type::TYPE_GROUPED: + case \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE: case \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE: case 'giftcard': return null; diff --git a/app/code/Magento/GoogleShopping/Model/Service.php b/app/code/Magento/GoogleShopping/Model/Service.php index a93e6a5f2cb..4f9a47d2a89 100644 --- a/app/code/Magento/GoogleShopping/Model/Service.php +++ b/app/code/Magento/GoogleShopping/Model/Service.php @@ -63,6 +63,18 @@ class Service extends \Magento\Object */ protected $_logAdapterFactory; + /** + * Service + * @var \Magento\Gdata\Gshopping\Content + */ + protected $_service; + + /** + * Content factory + * @var \Magento\Gdata\Gshopping\ContentFactory + */ + protected $_contentFactory; + /** * Constructor * @@ -72,17 +84,20 @@ class Service extends \Magento\Object * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\GoogleShopping\Model\Config $config + * @param \Magento\Gdata\Gshopping\ContentFactory $contentFactory * @param array $data */ public function __construct( \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Core\Model\Registry $coreRegistry, \Magento\GoogleShopping\Model\Config $config, + \Magento\Gdata\Gshopping\ContentFactory $contentFactory, array $data = array() ) { $this->_logAdapterFactory = $logAdapterFactory; $this->_coreRegistry = $coreRegistry; $this->_config = $config; + $this->_contentFactory = $contentFactory; parent::__construct($data); } @@ -92,6 +107,7 @@ class Service extends \Magento\Object * @param int $storeId * @param string $loginToken * @param string $loginCaptcha + * @throws \Magento\Core\Exception on http connection failure * @return \Zend_Http_Client */ public function getClient($storeId = null, $loginToken = null, $loginCaptcha = null) @@ -188,7 +204,12 @@ class Service extends \Magento\Object { $accountId = $this->getConfig()->getAccountId($storeId); $client = $this->getClient($storeId); - $service = new \Magento\Gdata\Gshopping\Content($client, $accountId); + $service = $this->_contentFactory->create( + array( + 'client' => $client, + 'accountId' => $accountId + ) + ); return $service; } } diff --git a/app/code/Magento/GoogleShopping/Model/Service/Item.php b/app/code/Magento/GoogleShopping/Model/Service/Item.php index d71dc5a077d..7bb83c7f890 100644 --- a/app/code/Magento/GoogleShopping/Model/Service/Item.php +++ b/app/code/Magento/GoogleShopping/Model/Service/Item.php @@ -51,6 +51,7 @@ class Item extends \Magento\GoogleShopping\Model\Service * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\GoogleShopping\Model\Config $config + * @param \Magento\Gdata\Gshopping\ContentFactory $contentFactory * @param \Magento\Core\Model\Date $date * @param \Magento\GoogleShopping\Helper\Data $gsData * @param array $data @@ -59,13 +60,14 @@ class Item extends \Magento\GoogleShopping\Model\Service \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Core\Model\Registry $coreRegistry, \Magento\GoogleShopping\Model\Config $config, + \Magento\Gdata\Gshopping\ContentFactory $contentFactory, \Magento\Core\Model\Date $date, \Magento\GoogleShopping\Helper\Data $gsData, array $data = array() ) { $this->_date = $date; $this->_gsData = $gsData; - parent::__construct($logAdapterFactory, $coreRegistry, $config, $data); + parent::__construct($logAdapterFactory, $coreRegistry, $config, $contentFactory, $data); } /** diff --git a/app/code/Magento/GoogleShopping/etc/module.xml b/app/code/Magento/GoogleShopping/etc/module.xml index 711ea845370..397874cb81e 100755 --- a/app/code/Magento/GoogleShopping/etc/module.xml +++ b/app/code/Magento/GoogleShopping/etc/module.xml @@ -37,6 +37,8 @@ <module name="Magento_Eav"/> <module name="Magento_Tax"/> <module name="Magento_Theme"/> + <module name="Magento_GoogleCheckout"/> + <module name="Magento_GroupedProduct"/> </depends> </module> </config> diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php similarity index 84% rename from app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php rename to app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php index 8093c5b421f..267ebe36897 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php @@ -27,15 +27,19 @@ /** * Adminhtml block for fieldset of grouped product */ -namespace Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset; +namespace Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Grouped - extends \Magento\Catalog\Block\Product\View\Type\Grouped + extends \Magento\GroupedProduct\Block\Product\View\Type\Grouped { + /** - * @var \Magento\Tax\Model\Calculation + * @var \Magento\Catalog\Helper\Product\Price */ - protected $_taxCalculation; + protected $priceHelper; protected $_priceBlockDefaultTemplate = 'catalog/product/price.phtml'; @@ -57,9 +61,10 @@ class Grouped * @param \Magento\Theme\Helper\Layout $layoutHelper * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Stdlib\ArrayUtils $arrayUtils - * @param \Magento\Tax\Model\Calculation $taxCalculation + * @param \Magento\Catalog\Helper\Product\Price $priceHelper * @param \Magento\Core\Helper\Data $coreHelper * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -76,12 +81,13 @@ class Grouped \Magento\Theme\Helper\Layout $layoutHelper, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Stdlib\ArrayUtils $arrayUtils, - \Magento\Tax\Model\Calculation $taxCalculation, + \Magento\Catalog\Helper\Product\Price $priceHelper, \Magento\Core\Helper\Data $coreHelper, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_coreHelper = $coreHelper; - $this->_taxCalculation = $taxCalculation; + $this->priceHelper = $priceHelper; parent::__construct( $context, $catalogConfig, @@ -95,7 +101,8 @@ class Grouped $layoutHelper, $imageHelper, $arrayUtils, - $data + $data, + $priceBlockTypes ); } @@ -110,8 +117,8 @@ class Grouped $this->_block = 'Magento\Catalog\Block\Adminhtml\Product\Price'; $this->_useLinkForAsLowAs = false; - if (!$this->_taxCalculation->getCustomer() && $this->_coreRegistry->registry('current_customer')) { - $this->_taxCalculation->setCustomer($this->_coreRegistry->registry('current_customer')); + if (!$this->priceHelper->getCustomer() && $this->_coreRegistry->registry('current_customer')) { + $this->priceHelper->setCustomer($this->_coreRegistry->registry('current_customer')); } } @@ -159,9 +166,10 @@ class Grouped /** * Set preconfigured values to grouped associated products * - * @return \Magento\Catalog\Block\Product\View\Type\Grouped + * @return \Magento\GroupedProduct\Block\Product\View\Type\Grouped */ - public function setPreconfiguredValue() { + public function setPreconfiguredValue() + { $configValues = $this->getProduct()->getPreconfiguredValues()->getSuperGroup(); if (is_array($configValues)) { $associatedProducts = $this->getAssociatedProducts(); @@ -179,6 +187,9 @@ class Grouped * * @param \Magento\Catalog\Model\Product $product * @return bool + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ public function getCanShowProductPrice($product) { @@ -189,6 +200,8 @@ class Grouped * Checks whether block is last fieldset in popup * * @return bool + * + * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ public function getIsLastFieldset() { diff --git a/app/code/Magento/Catalog/Block/Product/Grouped/AssociatedProducts.php b/app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts.php similarity index 96% rename from app/code/Magento/Catalog/Block/Product/Grouped/AssociatedProducts.php rename to app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts.php index dbd83506c0d..2bf5d644e64 100644 --- a/app/code/Magento/Catalog/Block/Product/Grouped/AssociatedProducts.php +++ b/app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts.php @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Block\Product\Grouped; +namespace Magento\GroupedProduct\Block\Product\Grouped; class AssociatedProducts extends \Magento\Backend\Block\Catalog\Product\Tab\Container diff --git a/app/code/Magento/Catalog/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php b/app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php similarity index 97% rename from app/code/Magento/Catalog/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php rename to app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php index d27e1e54d2f..312717b8692 100644 --- a/app/code/Magento/Catalog/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php +++ b/app/code/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProducts.php @@ -31,7 +31,7 @@ * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Block\Product\Grouped\AssociatedProducts; +namespace Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts; class ListAssociatedProducts extends \Magento\Backend\Block\Template { diff --git a/app/code/Magento/Catalog/Block/Product/View/Type/Grouped.php b/app/code/Magento/GroupedProduct/Block/Product/View/Type/Grouped.php similarity index 68% rename from app/code/Magento/Catalog/Block/Product/View/Type/Grouped.php rename to app/code/Magento/GroupedProduct/Block/Product/View/Type/Grouped.php index 13dca25f09b..53490947c06 100644 --- a/app/code/Magento/Catalog/Block/Product/View/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Product/View/Type/Grouped.php @@ -1,5 +1,7 @@ <?php /** + * Catalog grouped product info block + * * Magento * * NOTICE OF LICENSE @@ -18,21 +20,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Catalog * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - - -/** - * Catalog grouped product info block - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Catalog\Block\Product\View\Type; +namespace Magento\GroupedProduct\Block\Product\View\Type; class Grouped extends \Magento\Catalog\Block\Product\View\AbstractView { @@ -42,13 +33,13 @@ class Grouped extends \Magento\Catalog\Block\Product\View\AbstractView ->getAssociatedProducts($this->getProduct()); } - /** * Set preconfigured values to grouped associated products * - * @return \Magento\Catalog\Block\Product\View\Type\Grouped + * @return \Magento\GroupedProduct\Block\Product\View\Type\Grouped */ - public function setPreconfiguredValue() { + public function setPreconfiguredValue() + { $configValues = $this->getProduct()->getPreconfiguredValues()->getSuperGroup(); if (is_array($configValues)) { $associatedProducts = $this->getAssociatedProducts(); @@ -60,4 +51,24 @@ class Grouped extends \Magento\Catalog\Block\Product\View\AbstractView } return $this; } + + /** + * Returns product tier price block html + * + * @param \Magento\Catalog\Model\Product $product + * @return string + */ + public function getTierPriceHtml($product = null) + { + if (is_null($product)) { + $product = $this->getProduct(); + } + return $this->_getPriceBlock($product->getTypeId()) + ->setTemplate($this->getTierPriceTemplate()) + ->setProduct($product) + ->setListClass('tier prices grouped items') + ->setShowDetailedPrice(false) + ->setCanDisplayQty(false) + ->toHtml(); + } } diff --git a/app/code/Magento/GroupedProduct/Controller/Adminhtml/Edit.php b/app/code/Magento/GroupedProduct/Controller/Adminhtml/Edit.php new file mode 100644 index 00000000000..57a627c6b53 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Controller/Adminhtml/Edit.php @@ -0,0 +1,107 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Controller\Adminhtml; + +class Edit extends \Magento\Backend\App\AbstractAction +{ + /** + * @var \Magento\Core\Model\Registry + */ + protected $registry; + + /** + * @var \Magento\Catalog\Model\ProductFactory + */ + protected $factory; + + /** + * @var \Magento\Logger + */ + protected $logger; + + /** + * @param \Magento\Backend\App\Action\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Catalog\Model\ProductFactory $factory + * @param \Magento\Logger $logger + */ + public function __construct( + \Magento\Backend\App\Action\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Catalog\Model\ProductFactory $factory, + \Magento\Logger $logger + ) { + $this->registry = $registry; + $this->factory = $factory; + $this->logger = $logger; + parent::__construct($context); + } + + /** + * Check for is allowed + * + * @return boolean + */ + protected function _isAllowed() + { + return $this->_authorization->isAllowed('Magento_Catalog::products'); + } + + /** + * Get associated grouped products grid popup + */ + public function popupAction() + { + $productId = (int)$this->getRequest()->getParam('id'); + + /** @var $product \Magento\Catalog\Model\Product */ + $product = $this->factory->create(); + $product->setStoreId($this->getRequest()->getParam('store', 0)); + + $typeId = $this->getRequest()->getParam('type'); + if (!$productId && $typeId) { + $product->setTypeId($typeId); + } + $product->setData('_edit_mode', true); + + if ($productId) { + try { + $product->load($productId); + } catch (\Exception $e) { + $product->setTypeId(\Magento\Catalog\Model\Product\Type::DEFAULT_TYPE); + $this->logger->logException($e); + } + } + + $setId = (int)$this->getRequest()->getParam('set'); + if ($setId) { + $product->setAttributeSetId($setId); + } + $this->registry->register('current_product', $product); + + $this->_view->loadLayout(false); + $this->_view->renderLayout(); + } +} diff --git a/app/code/Magento/GroupedProduct/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks/Plugin/Grouped.php b/app/code/Magento/GroupedProduct/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks/Plugin/Grouped.php new file mode 100644 index 00000000000..a02edc6ad23 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks/Plugin/Grouped.php @@ -0,0 +1,58 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Controller\Adminhtml\Product\Initialization\Helper\ProductLinks\Plugin; + +class Grouped +{ + /** + * @var \Magento\App\RequestInterface + */ + protected $request; + + /** + * @param \Magento\App\RequestInterface $request + */ + public function __construct(\Magento\App\RequestInterface $request) + { + $this->request = $request; + } + + /** + * Initialize grouped product links + * + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\Catalog\Model\Product + */ + public function afterInitializeLinks(\Magento\Catalog\Model\Product $product) + { + $links = $this->request->getPost('links'); + + if (isset($links['grouped']) && !$product->getGroupedReadonly()) { + $product->setGroupedLinkData((array)$links['grouped']); + } + + return $product; + } +} diff --git a/app/code/Magento/GroupedProduct/Helper/Product/Configuration/Plugin/Grouped.php b/app/code/Magento/GroupedProduct/Helper/Product/Configuration/Plugin/Grouped.php new file mode 100644 index 00000000000..abab75e6fb1 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Helper/Product/Configuration/Plugin/Grouped.php @@ -0,0 +1,71 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Helper\Product\Configuration\Plugin; + +class Grouped +{ + /** + * Retrieves grouped product options list + * + * @param array $arguments + * @param \Magento\Code\Plugin\InvocationChain $invocationChain + * @return mixed + */ + public function aroundGetOptions(array $arguments, \Magento\Code\Plugin\InvocationChain $invocationChain) + { + /** @var \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface $item */ + $item = $arguments['item']; + $product = $item->getProduct(); + $typeId = $product->getTypeId(); + if ($typeId == \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) { + $options = array(); + /** @var \Magento\GroupedProduct\Model\Product\Type\Grouped $typeInstance */ + $typeInstance = $product->getTypeInstance(); + $associatedProducts = $typeInstance->getAssociatedProducts($product); + + if ($associatedProducts) { + foreach ($associatedProducts as $associatedProduct) { + $qty = $item->getOptionByCode('associated_product_' . $associatedProduct->getId()); + $option = array( + 'label' => $associatedProduct->getName(), + 'value' => ($qty && $qty->getValue()) ? $qty->getValue() : 0 + ); + $options[] = $option; + } + } + + $options = array_merge($options, $invocationChain->proceed($arguments)); + $isUnConfigured = true; + foreach ($options as &$option) { + if ($option['value']) { + $isUnConfigured = false; + break; + } + } + return $isUnConfigured ? array() : $options; + } + return $invocationChain->proceed($arguments); + } +} diff --git a/app/code/Magento/GroupedProduct/Model/Product/CopyConstructor/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/CopyConstructor/Grouped.php new file mode 100644 index 00000000000..aeaca6f3098 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Model/Product/CopyConstructor/Grouped.php @@ -0,0 +1,78 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Model\Product\CopyConstructor; + +class Grouped implements \Magento\Catalog\Model\Product\CopyConstructorInterface +{ + /** + * Retrieve collection grouped link + * + * @param \Magento\Catalog\Model\Product $product + * @return \Magento\Catalog\Model\Resource\Product\Link\Collection + */ + protected function _getGroupedLinkCollection(\Magento\Catalog\Model\Product $product) + { + /** @var \Magento\Catalog\Model\Product\Link $links */ + $links = $product->getLinkInstance(); + $links->setLinkTypeId(\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED); + + $collection = $links->getLinkCollection(); + $collection->setProduct($product); + $collection->addLinkTypeIdFilter(); + $collection->addProductIdFilter(); + $collection->joinAttributes(); + return $collection; + } + + /** + * Build product links + * + * @param \Magento\Catalog\Model\Product $product + * @param \Magento\Catalog\Model\Product $duplicate + */ + public function build(\Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate) + { + if ($product->getTypeId() !== \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) { + //do nothing if not grouped product + return; + } + + $data = array(); + $attributes = array(); + $link = $product->getLinkInstance(); + $link->setLinkTypeId(\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED); + foreach ($link->getAttributes() as $attribute) { + if (isset($attribute['code'])) { + $attributes[] = $attribute['code']; + } + } + + /** @var \Magento\Catalog\Model\Product\Link $link */ + foreach ($this->_getGroupedLinkCollection($product) as $link) { + $data[$link->getLinkedProductId()] = $link->toArray($attributes); + } + $duplicate->setGroupedLinkData($data); + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php similarity index 85% rename from app/code/Magento/Catalog/Model/Product/Type/Grouped.php rename to app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php index 9d758ad65c1..d5c0707de2f 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Grouped.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php @@ -1,5 +1,7 @@ <?php /** + * Grouped product type implementation + * * Magento * * NOTICE OF LICENSE @@ -19,20 +21,15 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Catalog + * @package Magento_GroupedProduct * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\GroupedProduct\Model\Product\Type; /** - * Grouped product type implementation - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -namespace Magento\Catalog\Model\Product\Type; - class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType { const TYPE_CODE = 'grouped'; @@ -89,9 +86,9 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType /** * Catalog product link * - * @var \Magento\Catalog\Model\Resource\Product\Link + * @var \Magento\GroupedProduct\Model\Resource\Product\Link */ - protected $_catalogProductLink; + protected $productLinks; /** * @var \Magento\App\State @@ -106,15 +103,15 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Logger $logger - * @param \Magento\Catalog\Model\Resource\Product\Link $catalogProductLink + * @param \Magento\GroupedProduct\Model\Resource\Product\Link $catalogProductLink * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\Status $catalogProductStatus * @param \Magento\App\State $appState * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -125,16 +122,16 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\Data $coreData, \Magento\Core\Helper\File\Storage\Database $fileStorageDb, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, \Magento\Logger $logger, - \Magento\Catalog\Model\Resource\Product\Link $catalogProductLink, + \Magento\GroupedProduct\Model\Resource\Product\Link $catalogProductLink, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\Status $catalogProductStatus, \Magento\App\State $appState, array $data = array() ) { - $this->_catalogProductLink = $catalogProductLink; + $this->productLinks = $catalogProductLink; $this->_storeManager = $storeManager; $this->_catalogProductStatus = $catalogProductStatus; $this->_appState = $appState; @@ -164,7 +161,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType $info->setTable('catalog_product_link') ->setParentFieldName('product_id') ->setChildFieldName('linked_product_id') - ->setWhere('link_type_id=' . \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED); + ->setWhere('link_type_id=' . \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED); return $info; } @@ -177,25 +174,31 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * @param int $parentId * @param bool $required * @return array + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function getChildrenIds($parentId, $required = true) { - return $this->_catalogProductLink - ->getChildrenIds($parentId, - \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED); + return $this->productLinks + ->getChildrenIds( + $parentId, + \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED + ); } /** - * Retrieve parent ids array by requered child + * Retrieve parent ids array by requested child * * @param int|array $childId * @return array */ public function getParentIdsByChild($childId) { - return $this->_catalogProductLink - ->getParentIdsByChild($childId, - \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED); + return $this->productLinks + ->getParentIdsByChild( + $childId, + \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED + ); } /** @@ -232,7 +235,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * * @param int $status * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Catalog\Model\Product\Type\Grouped + * @return \Magento\GroupedProduct\Model\Product\Type\Grouped */ public function addStatusFilter($status, $product) { @@ -251,12 +254,11 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * Set only saleable filter * * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Catalog\Model\Product\Type\Grouped + * @return \Magento\GroupedProduct\Model\Product\Type\Grouped */ public function setSaleableStatus($product) { - $product->setData($this->_keyStatusFilters, - $this->_catalogProductStatus->getSaleableStatusIds()); + $product->setData($this->_keyStatusFilters, $this->_catalogProductStatus->getSaleableStatusIds()); return $this; } @@ -287,6 +289,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType { if (!$product->hasData($this->_keyAssociatedProductIds)) { $associatedProductIds = array(); + /** @var $item \Magento\Catalog\Model\Product */ foreach ($this->getAssociatedProducts($product) as $item) { $associatedProductIds[] = $item->getId(); } @@ -303,8 +306,10 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType */ public function getAssociatedProductCollection($product) { - $collection = $product->getLinkInstance()->useGroupedLinks() - ->getProductCollection() + /** @var \Magento\Catalog\Model\Product\Link $links */ + $links = $product->getLinkInstance(); + $links->setLinkTypeId(\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED); + $collection = $links->getProductCollection() ->setFlag('require_stock_items', true) ->setFlag('product_children', true) ->setIsStrongMode(); @@ -312,36 +317,20 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType return $collection; } - /** - * Check is product available for sale - * - * @param \Magento\Catalog\Model\Product $product - * @return bool - */ - public function isSalable($product) - { - $salable = parent::isSalable($product); - if (!is_null($salable)) { - return $salable; - } - - $salable = false; - foreach ($this->getAssociatedProducts($product) as $associatedProduct) { - $salable = $salable || $associatedProduct->isSalable(); - } - return $salable; - } - /** * Save type related data * * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Catalog\Model\Product\Type\Grouped + * @return \Magento\GroupedProduct\Model\Product\Type\Grouped */ public function save($product) { parent::save($product); - $product->getLinkInstance()->saveGroupedLinks($product); + + $data = $product->getGroupedLinkData(); + if (!is_null($data)) { + $this->productLinks->saveGroupedLinks($product, $data); + } return $this; } @@ -353,6 +342,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Catalog\Model\Product $product * @param string $processMode * @return array|string + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ protected function _prepareProduct(\Magento\Object $buyRequest, $product, $processMode) { @@ -366,7 +356,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType if ($associatedProducts || !$isStrictProcessMode) { foreach ($associatedProducts as $subProduct) { $subProductId = $subProduct->getId(); - if(isset($productsInfo[$subProductId])) { + if (isset($productsInfo[$subProductId])) { $qty = $productsInfo[$subProductId]; if (!empty($qty) && is_numeric($qty)) { @@ -434,6 +424,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Catalog\Model\Product $product * @param \Magento\Object $buyRequest * @return array + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function processBuyRequest($product, $buyRequest) { @@ -459,6 +450,7 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType * Delete data specific for Grouped product type * * @param \Magento\Catalog\Model\Product $product + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function deleteTypeSpecificData(\Magento\Catalog\Model\Product $product) { diff --git a/app/code/Magento/Catalog/Model/Product/Type/Grouped/Backend.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped/Backend.php similarity index 83% rename from app/code/Magento/Catalog/Model/Product/Type/Grouped/Backend.php rename to app/code/Magento/GroupedProduct/Model/Product/Type/Grouped/Backend.php index 93507485b3c..7d7c5917b33 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Grouped/Backend.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped/Backend.php @@ -19,23 +19,23 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Catalog + * @package Magento_GroupedProduct * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Model\Product\Type\Grouped; +namespace Magento\GroupedProduct\Model\Product\Type\Grouped; /** * Grouped product type implementation for backend */ -class Backend extends \Magento\Catalog\Model\Product\Type\Grouped +class Backend extends \Magento\GroupedProduct\Model\Product\Type\Grouped { /** * No filters required in backend * * @param \Magento\Catalog\Model\Product $product - * @return \Magento\Catalog\Model\Product\Type\Grouped + * @return \Magento\GroupedProduct\Model\Product\Type\Grouped */ public function setSaleableStatus($product) { diff --git a/app/code/Magento/Catalog/Model/Product/Type/Grouped/Price.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped/Price.php similarity index 89% rename from app/code/Magento/Catalog/Model/Product/Type/Grouped/Price.php rename to app/code/Magento/GroupedProduct/Model/Product/Type/Grouped/Price.php index aba1591e1d8..730b64e8685 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Grouped/Price.php +++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped/Price.php @@ -1,5 +1,7 @@ <?php /** + * Grouped product price model + * * Magento * * NOTICE OF LICENSE @@ -19,19 +21,12 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Catalog + * @package Magento_GroupedProduct * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Grouped product price model - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Catalog\Model\Product\Type\Grouped; +namespace Magento\GroupedProduct\Model\Product\Type\Grouped; class Price extends \Magento\Catalog\Model\Product\Type\Price { @@ -50,7 +45,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price $finalPrice = parent::getFinalPrice($qty, $product); if ($product->hasCustomOptions()) { - /* @var $typeInstance \Magento\Catalog\Model\Product\Type\Grouped */ + /* @var $typeInstance \Magento\GroupedProduct\Model\Product\Type\Grouped */ $typeInstance = $product->getTypeInstance(); $associatedProducts = $typeInstance->setStoreFilter($product->getStore(), $product) ->getAssociatedProducts($product); diff --git a/app/code/Magento/PageCache/Model/Control/Zend.php b/app/code/Magento/GroupedProduct/Model/ProductTypes/Config/Converter/Plugin/Grouped.php similarity index 62% rename from app/code/Magento/PageCache/Model/Control/Zend.php rename to app/code/Magento/GroupedProduct/Model/ProductTypes/Config/Converter/Plugin/Grouped.php index beafe3c44f1..1869b53a1f3 100644 --- a/app/code/Magento/PageCache/Model/Control/Zend.php +++ b/app/code/Magento/GroupedProduct/Model/ProductTypes/Config/Converter/Plugin/Grouped.php @@ -1,5 +1,7 @@ <?php /** + * Plugin for product type configuration converter + * * Magento * * NOTICE OF LICENSE @@ -18,32 +20,25 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_PageCache * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Zend server page cache control model - * - * @category Magento - * @package Magento_PageCache - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\PageCache\Model\Control; +namespace Magento\GroupedProduct\Model\ProductTypes\Config\Converter\Plugin; -class Zend implements \Magento\PageCache\Model\Control\ControlInterface +class Grouped { /** - * Clean zend server page cache + * Set value to product type configuration data that grouped product type is a set of products * - * @return void + * @param array $config + * @return array */ - public function clean() + public function afterConvert(array $config) { - if (extension_loaded('Zend Page Cache') && function_exists('page_cache_remove_all_cached_contents')) { - page_cache_remove_all_cached_contents(); + if (isset($config[\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE])) { + $config[\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE]['is_product_set'] = true; } + return $config; } -} +} diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/Grouped.php b/app/code/Magento/GroupedProduct/Model/Resource/Product/Indexer/Price/Grouped.php similarity index 89% rename from app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/Grouped.php rename to app/code/Magento/GroupedProduct/Model/Resource/Product/Indexer/Price/Grouped.php index a5e76a66eec..8ec870d149a 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/Grouped.php +++ b/app/code/Magento/GroupedProduct/Model/Resource/Product/Indexer/Price/Grouped.php @@ -1,5 +1,7 @@ <?php /** + * Grouped Products Price Indexer Resource model + * * Magento * * NOTICE OF LICENSE @@ -19,20 +21,11 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Catalog + * @package Magento_GroupedProduct * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - - -/** - * Configurable Products Price Indexer Resource model - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Catalog\Model\Resource\Product\Indexer\Price; +namespace Magento\GroupedProduct\Model\Resource\Product\Indexer\Price; class Grouped extends \Magento\Catalog\Model\Resource\Product\Indexer\Price\DefaultPrice @@ -40,7 +33,7 @@ class Grouped /** * Reindex temporary (price result data) for all products * - * @return \Magento\Catalog\Model\Resource\Product\Indexer\Price\Grouped + * @return \Magento\GroupedProduct\Model\Resource\Product\Indexer\Price\Grouped */ public function reindexAll() { @@ -60,7 +53,7 @@ class Grouped * Reindex temporary (price result data) for defined product(s) * * @param int|array $entityIds - * @return \Magento\Catalog\Model\Resource\Product\Indexer\Price\Grouped + * @return \Magento\GroupedProduct\Model\Resource\Product\Indexer\Price\Grouped */ public function reindexEntity($entityIds) { @@ -74,7 +67,7 @@ class Grouped * Use calculated price for relation products * * @param int|array $entityIds the parent entity ids limitation - * @return \Magento\Catalog\Model\Resource\Product\Indexer\Price\Grouped + * @return \Magento\GroupedProduct\Model\Resource\Product\Indexer\Price\Grouped */ protected function _prepareGroupedProductPriceData($entityIds = null) { @@ -85,7 +78,8 @@ class Grouped ->from(array('e' => $this->getTable('catalog_product_entity')), 'entity_id') ->joinLeft( array('l' => $this->getTable('catalog_product_link')), - 'e.entity_id = l.product_id AND l.link_type_id=' . \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED, + 'e.entity_id = l.product_id AND l.link_type_id=' + . \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, array()) ->join( array('cg' => $this->getTable('customer_group')), diff --git a/app/code/Magento/GroupedProduct/Model/Resource/Product/Link.php b/app/code/Magento/GroupedProduct/Model/Resource/Product/Link.php new file mode 100644 index 00000000000..36845c5bc09 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Model/Resource/Product/Link.php @@ -0,0 +1,104 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Model\Resource\Product; + +class Link extends \Magento\Catalog\Model\Resource\Product\Link +{ + const LINK_TYPE_GROUPED = 3; + + /** + * Save grouped product relations + * + * @param \Magento\Catalog\Model\Product $product + * @param array $data + * + * @return \Magento\GroupedProduct\Model\Resource\Product\Link + */ + public function saveGroupedLinks($product, $data) + { + $adapter = $this->_getWriteAdapter(); + // check for change relations + $bind = array( + 'product_id' => (int)$product->getId(), + 'link_type_id' => self::LINK_TYPE_GROUPED + ); + $select = $adapter->select() + ->from($this->getMainTable(), array('linked_product_id')) + ->where('product_id = :product_id') + ->where('link_type_id = :link_type_id'); + $old = $adapter->fetchCol($select, $bind); + $new = array_keys($data); + + if (array_diff($old, $new) || array_diff($new, $old)) { + $product->setIsRelationsChanged(true); + } + + // save product links attributes + $this->saveProductLinks($product, $data, self::LINK_TYPE_GROUPED); + + // Grouped product relations should be added to relation table + $this->_catalogProductRelation->processRelations($product->getId(), $new); + + return $this; + } + + /** + * Retrieve Required children ids + * Return grouped array, ex array( + * group => array(ids) + * ) + * + * @param int $parentId + * @param int $typeId + * @return array + */ + public function getChildrenIds($parentId, $typeId) + { + $adapter = $this->_getReadAdapter(); + $childrenIds = array(); + $bind = array( + ':product_id' => (int)$parentId, + ':link_type_id' => (int)$typeId + ); + $select = $adapter->select() + ->from(array('l' => $this->getMainTable()), array('linked_product_id')) + ->where('product_id = :product_id') + ->where('link_type_id = :link_type_id'); + + $select->join( + array('e' => $this->getTable('catalog_product_entity')), + 'e.entity_id = l.linked_product_id AND e.required_options = 0', + array() + ); + + $childrenIds[$typeId] = array(); + $result = $adapter->fetchAll($select, $bind); + foreach ($result as $row) { + $childrenIds[$typeId][$row['linked_product_id']] = $row['linked_product_id']; + } + + return $childrenIds; + } +} diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php b/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php similarity index 96% rename from app/code/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php rename to app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php index 7bf223b2ba4..e6a4f07bba8 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php +++ b/app/code/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollection.php @@ -1,5 +1,7 @@ <?php /** + * Associated products collection + * * Magento * * NOTICE OF LICENSE @@ -19,20 +21,16 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Catalog + * @package Magento_GroupedProduct * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\GroupedProduct\Model\Resource\Product\Type\Grouped; + /** - * Associated products collection - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -namespace Magento\Catalog\Model\Resource\Product\Type\Grouped; - class AssociatedProductsCollection extends \Magento\Catalog\Model\Resource\Product\Link\Product\Collection { diff --git a/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-0.0.1.php b/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-0.0.1.php new file mode 100644 index 00000000000..eddeef59cb4 --- /dev/null +++ b/app/code/Magento/GroupedProduct/data/groupedproduct_setup/data-install-0.0.1.php @@ -0,0 +1,62 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** @var $installer \Magento\Catalog\Model\Resource\Setup */ +$installer = $this; + +/** + * Install grouped product link type + */ +$data = array( + 'link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, + 'code' => 'super' +); +$installer->getConnection()->insertOnDuplicate($installer->getTable('catalog_product_link_type'), $data); + +/** + * Install grouped product link attributes + */ +$select = $installer->getConnection() + ->select() + ->from(array('c' => $installer->getTable('catalog_product_link_attribute'))) + ->where("c.link_type_id=?", \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED); +$result = $installer->getConnection()->fetchAll($select); + +if (!$result) { + + $data = array( + array( + 'link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, + 'product_link_attribute_code' => 'position', + 'data_type' => 'int' + ), + array( + 'link_type_id' => \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, + 'product_link_attribute_code' => 'qty', + 'data_type' => 'decimal' + ) + ); + + $installer->getConnection()->insertMultiple($installer->getTable('catalog_product_link_attribute'), $data); +} diff --git a/app/code/Magento/GroupedProduct/etc/adminhtml/di.xml b/app/code/Magento/GroupedProduct/etc/adminhtml/di.xml new file mode 100644 index 00000000000..5ee459ff6b1 --- /dev/null +++ b/app/code/Magento/GroupedProduct/etc/adminhtml/di.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <preference for="Magento\GroupedProduct\Model\Product\Type\Grouped" type="Magento\GroupedProduct\Model\Product\Type\Grouped\Backend" /> + <type name="Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\ProductLinks"> + <plugin name="GroupedProduct" type="Magento\GroupedProduct\Controller\Adminhtml\Product\Initialization\Helper\ProductLinks\Plugin\Grouped" /> + </type> + <type name="Magento\Catalog\Model\Product\CopyConstructor\Composite"> + <param name="constructors"> + <value> + <grouped>Magento\GroupedProduct\Model\Product\CopyConstructor\Grouped</grouped> + </value> + </param> + </type> +</config> diff --git a/app/code/Magento/PageCache/etc/adminhtml/routes.xml b/app/code/Magento/GroupedProduct/etc/adminhtml/routes.xml similarity index 89% rename from app/code/Magento/PageCache/etc/adminhtml/routes.xml rename to app/code/Magento/GroupedProduct/etc/adminhtml/routes.xml index 56861269b0f..7504e143f13 100644 --- a/app/code/Magento/PageCache/etc/adminhtml/routes.xml +++ b/app/code/Magento/GroupedProduct/etc/adminhtml/routes.xml @@ -25,8 +25,8 @@ --> <config> <router id="admin"> - <route id="adminhtml"> - <module name="Magento_PageCache" before="Magento_Adminhtml" /> + <route id="groupedProduct" frontName="groupedProduct"> + <module name="Magento_GroupedProduct" /> </route> </router> </config> diff --git a/app/code/Magento/Paygate/etc/frontend/di.xml b/app/code/Magento/GroupedProduct/etc/di.xml similarity index 73% rename from app/code/Magento/Paygate/etc/frontend/di.xml rename to app/code/Magento/GroupedProduct/etc/di.xml index b8963ac937d..87eca94a6e5 100644 --- a/app/code/Magento/Paygate/etc/frontend/di.xml +++ b/app/code/Magento/GroupedProduct/etc/di.xml @@ -24,16 +24,16 @@ */ --> <config> - <type name="Magento\Core\Model\Url\SecurityInfo"> - <param name="secureUrlList"> + <type name="Magento\Catalog\Model\ProductTypes\Config\Converter"> + <plugin name="groupedProductType" type="Magento\GroupedProduct\Model\ProductTypes\Config\Converter\Plugin\Grouped" /> + </type> + <type name="Magento\Module\Updater\SetupFactory"> + <param name="resourceTypes"> <value> - <authorizenet_paygate>/paygate/authorizenet_payment</authorizenet_paygate> + <groupedproduct_setup>Magento\Catalog\Model\Resource\Setup</groupedproduct_setup> </value> </param> </type> - <type name="Magento\Paygate\Model\Authorizenet"> - <param name="session"> - <instance type="Magento\Checkout\Model\Session" /> - </param> - </type> </config> + + diff --git a/app/code/Magento/GroupedProduct/etc/frontend/di.xml b/app/code/Magento/GroupedProduct/etc/frontend/di.xml new file mode 100644 index 00000000000..4e79f98ef09 --- /dev/null +++ b/app/code/Magento/GroupedProduct/etc/frontend/di.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <type name="Magento\Catalog\Block\Product\AbstractProduct"> + <param name="priceBlockTypes"> + <value> + <grouped> + <block>Magento\Catalog\Block\Product\Price</block> + <template>Magento_GroupedProduct::product/price.phtml</template> + </grouped> + </value> + </param> + </type> + <type name="Magento\Catalog\Block\Product\Price\Template"> + <param name="priceBlockTypes"> + <value> + <grouped> + <block>Magento\Catalog\Block\Product\Price</block> + <template>Magento_GroupedProduct::product/price.phtml</template> + </grouped> + </value> + </param> + </type> +</config> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Last/etc/module.xml b/app/code/Magento/GroupedProduct/etc/module.xml old mode 100755 new mode 100644 similarity index 62% rename from dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Last/etc/module.xml rename to app/code/Magento/GroupedProduct/etc/module.xml index 8d46a062cee..dc97cb05954 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Last/etc/module.xml +++ b/app/code/Magento/GroupedProduct/etc/module.xml @@ -24,9 +24,21 @@ */ --> <config> - <module name="Magento_Last" version="1.6.0.0.23" active="true"> + <module name="Magento_GroupedProduct" version="0.0.1" active="true"> <sequence> - <module name="Magento_Test"/> + <module name="Magento_Catalog" /> + <module name="Magento_CatalogInventory" /> </sequence> + <depends> + <module name="Magento_Catalog" /> + <module name="Magento_Core" /> + <module name="Magento_Tax" /> + <module name="Magento_Checkout" /> + <module name="Magento_Wishlist" /> + <module name="Magento_Backend" /> + <module name="Magento_Eav" /> + <module name="Magento_Customer" /> + <module name="Magento_Theme" /> + </depends> </module> </config> diff --git a/app/code/Magento/PageCache/etc/events.xml b/app/code/Magento/GroupedProduct/etc/product_types.xml similarity index 62% rename from app/code/Magento/PageCache/etc/events.xml rename to app/code/Magento/GroupedProduct/etc/product_types.xml index 30dbc16805b..b5620233e5c 100644 --- a/app/code/Magento/PageCache/etc/events.xml +++ b/app/code/Magento/GroupedProduct/etc/product_types.xml @@ -24,10 +24,13 @@ */ --> <config> - <event name="design_editor_activate"> - <observer name="magento_pagecache" instance="Magento\PageCache\Model\Observer" method="setNoCacheCookie" /> - </event> - <event name="design_editor_deactivate"> - <observer name="magento_pagecache" instance="Magento\PageCache\Model\Observer" method="deleteNoCacheCookie" /> - </event> + <type name="grouped" label="Grouped Product" modelInstance="Magento\GroupedProduct\Model\Product\Type\Grouped" composite='true' indexPriority="50"> + <priceModel instance="Magento\GroupedProduct\Model\Product\Type\Grouped\Price" /> + <indexerModel instance="Magento\GroupedProduct\Model\Resource\Product\Indexer\Price\Grouped" /> + <stockIndexerModel instance="Magento\CatalogInventory\Model\Resource\Indexer\Stock\Grouped" /> + <allowProductTypes> + <type name="simple" /> + <type name="virtual" /> + </allowProductTypes> + </type> </config> diff --git a/app/code/Magento/GroupedProduct/i18n/de_DE.csv b/app/code/Magento/GroupedProduct/i18n/de_DE.csv new file mode 100644 index 00000000000..c7768a0a21d --- /dev/null +++ b/app/code/Magento/GroupedProduct/i18n/de_DE.csv @@ -0,0 +1,2 @@ +"Catalog Product View (Grouped)","Produktansicht des Katalogs (in Gruppen)" +"Grouped Product","Gruppiertes Produkt" diff --git a/app/code/Magento/GroupedProduct/i18n/en_US.csv b/app/code/Magento/GroupedProduct/i18n/en_US.csv new file mode 100644 index 00000000000..f0c636a3c8e --- /dev/null +++ b/app/code/Magento/GroupedProduct/i18n/en_US.csv @@ -0,0 +1,2 @@ +"Catalog Product View (Grouped)","Catalog Product View (Grouped)" +"Grouped Product","Grouped Product" diff --git a/app/code/Magento/GroupedProduct/i18n/es_ES.csv b/app/code/Magento/GroupedProduct/i18n/es_ES.csv new file mode 100644 index 00000000000..3ee3ba2a1f5 --- /dev/null +++ b/app/code/Magento/GroupedProduct/i18n/es_ES.csv @@ -0,0 +1,2 @@ +"Catalog Product View (Grouped)","Vista del Catálogo de Producto (Agrupada)" +"Grouped Product","Producto agrupado" diff --git a/app/code/Magento/GroupedProduct/i18n/fr_FR.csv b/app/code/Magento/GroupedProduct/i18n/fr_FR.csv new file mode 100644 index 00000000000..b0d1941b978 --- /dev/null +++ b/app/code/Magento/GroupedProduct/i18n/fr_FR.csv @@ -0,0 +1,2 @@ +"Catalog Product View (Grouped)","Affichage du Produit Catalogue (Groupé)" +"Grouped Product","Produits groupés" diff --git a/app/code/Magento/GroupedProduct/i18n/nl_NL.csv b/app/code/Magento/GroupedProduct/i18n/nl_NL.csv new file mode 100644 index 00000000000..410a26f0142 --- /dev/null +++ b/app/code/Magento/GroupedProduct/i18n/nl_NL.csv @@ -0,0 +1,2 @@ +"Catalog Product View (Grouped)","Catalogus Product Bezichtiging (Gegroepeerd)" +"Grouped Product","Gegroepeerd Product" diff --git a/app/code/Magento/GroupedProduct/i18n/pt_BR.csv b/app/code/Magento/GroupedProduct/i18n/pt_BR.csv new file mode 100644 index 00000000000..d4585d81ed4 --- /dev/null +++ b/app/code/Magento/GroupedProduct/i18n/pt_BR.csv @@ -0,0 +1,2 @@ +"Catalog Product View (Grouped)","Visualizar Produto de Catálogo (Agrupado)" +"Grouped Product","Produto Agrupado" diff --git a/app/code/Magento/GroupedProduct/i18n/zh_CN.csv b/app/code/Magento/GroupedProduct/i18n/zh_CN.csv new file mode 100644 index 00000000000..416c91d0186 --- /dev/null +++ b/app/code/Magento/GroupedProduct/i18n/zh_CN.csv @@ -0,0 +1,2 @@ +"Catalog Product View (Grouped)","分类产å“视图(分组)" +"Grouped Product","分组产å“" diff --git a/app/code/Magento/Paygate/sql/paygate_setup/install-1.6.0.0.php b/app/code/Magento/GroupedProduct/sql/groupedproduct_setup/install-0.0.1.php similarity index 70% rename from app/code/Magento/Paygate/sql/paygate_setup/install-1.6.0.0.php rename to app/code/Magento/GroupedProduct/sql/groupedproduct_setup/install-0.0.1.php index 1dff0b54670..2973162b448 100644 --- a/app/code/Magento/Paygate/sql/paygate_setup/install-1.6.0.0.php +++ b/app/code/Magento/GroupedProduct/sql/groupedproduct_setup/install-0.0.1.php @@ -18,11 +18,16 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Paygate * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var $installer \Magento\Core\Model\Resource\Setup */ +/** @var $installer \Magento\Catalog\Model\Resource\Setup */ $installer = $this; + +$field = 'country_of_manufacture'; +$applyTo = explode(',', $installer->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to')); +if (!in_array('grouped', $applyTo)) { + $applyTo[] = 'grouped'; + $installer->updateAttribute(\Magento\Catalog\Model\Product::ENTITY, $field, 'apply_to', implode(',', $applyTo)); +} diff --git a/app/code/Magento/Catalog/view/adminhtml/catalog/product/composite/fieldset/grouped.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/catalog/product/composite/fieldset/grouped.phtml similarity index 96% rename from app/code/Magento/Catalog/view/adminhtml/catalog/product/composite/fieldset/grouped.phtml rename to app/code/Magento/GroupedProduct/view/adminhtml/catalog/product/composite/fieldset/grouped.phtml index 8f20a88832d..69728afe86d 100644 --- a/app/code/Magento/Catalog/view/adminhtml/catalog/product/composite/fieldset/grouped.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/catalog/product/composite/fieldset/grouped.phtml @@ -25,7 +25,7 @@ */ ?> -<?php /* @var $this \Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset\Grouped */ ?> +<?php /* @var $this \Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped */ ?> <?php $_skipSaleableCheck = $this->helper('Magento\Catalog\Helper\Product')->getSkipSaleableCheck(); ?> <div id="catalog_product_composite_configure_fields_grouped" class="grid <?php echo $this->getIsLastFieldset() ? 'last-fieldset' : '' ?>"> <h4><?php echo __('Associated Products') ?></h4> @@ -60,7 +60,7 @@ <?php if ($_hasAssociatedProducts): ?> <?php $i = 0 ?> <?php foreach ($_associatedProducts as $_item): ?> - <?php $_finalPriceInclTax = $this->helper('Magento\Tax\Helper\Data')->getPrice($_item, $_item->getFinalPrice(), true) ?> + <?php $_finalPriceInclTax = $this->helper('Magento\Catalog\Helper\Product\Price')->getPrice($_item, $_item->getFinalPrice(), true) ?> <tr class="<?php echo (++$i % 2) ? 'even' : 'odd' ?>"> <td><?php echo $_item->getId() ?></td> <td><?php echo $this->escapeHtml($_item->getSku()) ?></td> diff --git a/app/code/Magento/GroupedProduct/view/adminhtml/css/grouped-product.css b/app/code/Magento/GroupedProduct/view/adminhtml/css/grouped-product.css new file mode 100644 index 00000000000..a3ebc2baf5a --- /dev/null +++ b/app/code/Magento/GroupedProduct/view/adminhtml/css/grouped-product.css @@ -0,0 +1,42 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +#grouped_grid .col-name { + width: 25%; +} + +#grouped_grid .col-sku { + width: 10%; +} + +#grouped_grid .col-qty { + width: 7%; +} + +.ui-dialog.grouped .massaction { + display: none; +} + +.ui-dialog.grouped .col-entity_id { + width: 2%; +} diff --git a/app/code/Magento/Catalog/view/adminhtml/js/grouped-product.js b/app/code/Magento/GroupedProduct/view/adminhtml/js/grouped-product.js similarity index 100% rename from app/code/Magento/Catalog/view/adminhtml/js/grouped-product.js rename to app/code/Magento/GroupedProduct/view/adminhtml/js/grouped-product.js diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grouped.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml similarity index 54% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grouped.xml rename to app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml index 4fe9dfb32e5..c3a2e591ba8 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grouped.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_grouped.xml @@ -24,11 +24,18 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="catalog_product_grouped_grid_popup"/> + <update handle="groupedproduct_popup_grid"/> + <referenceBlock name="head"> + <block class="Magento\Theme\Block\Html\Head\Css" name="magento-grouped-product-css-grouped-product-css"> + <arguments> + <argument name="file" xsi:type="string">Magento_GroupedProduct::css/grouped-product.css</argument> + </arguments> + </block> + </referenceBlock> <referenceBlock name="product_tabs"> - <block class="Magento\Catalog\Block\Product\Grouped\AssociatedProducts" name="catalog.product.edit.grouped.container" template="Magento_Catalog::product/grouped/container.phtml"> - <block class="Magento\View\Element\Template" name="catalog.product.edit.tab.super.container" template="Magento_Catalog::product/grouped/grouped.phtml"> - <block class="Magento\Catalog\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts" name="catalog.product.edit.tab.super.list" as="list" template="Magento_Catalog::product/grouped/list.phtml"> + <block class="Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts" name="catalog.product.edit.grouped.container" template="product/grouped/container.phtml"> + <block class="Magento\View\Element\Template" name="catalog.product.edit.tab.super.container" template="Magento_GroupedProduct::product/grouped/grouped.phtml"> + <block class="Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts" name="catalog.product.edit.tab.super.list" as="list" template="product/grouped/list.phtml"> </block> <block class="Magento\View\Element\Template" name="catalog.product.edit.tab.super.grid.popup.container" as="catalog.product.group.grid.popup.container"/> </block> @@ -37,5 +44,15 @@ <argument name="name" xsi:type="string">grouped</argument> <argument name="block" xsi:type="string">catalog.product.edit.grouped.container</argument> </action> + <referenceBlock name="product_tabs.customer_options"> + <arguments> + <argument name="can_show" xsi:type="boolean">false</argument> + </arguments> + </referenceBlock> + <referenceBlock name="product_tabs.product-alerts"> + <arguments> + <argument name="can_show" xsi:type="boolean">false</argument> + </arguments> + </referenceBlock> </referenceBlock> </layout> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_view_type_grouped.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_view_type_grouped.xml similarity index 82% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_view_type_grouped.xml rename to app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_view_type_grouped.xml index 6bba2b25387..6f2026deca8 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_view_type_grouped.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/catalog_product_view_type_grouped.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="product.composite.fieldset"> - <block class="Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset\Grouped" name="product.composite.fieldset.grouped" before="product.composite.fieldset.options" template="catalog/product/composite/fieldset/grouped.phtml"/> + <block class="Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped" name="product.composite.fieldset.grouped" before="product.composite.fieldset.options" template="catalog/product/composite/fieldset/grouped.phtml"/> <remove name="product.composite.fieldset.qty"/> </referenceBlock> </layout> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_supergrouppopup.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_edit_popup.xml similarity index 96% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_supergrouppopup.xml rename to app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_edit_popup.xml index c4c35e6e866..0dc6a947c2b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_supergrouppopup.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_edit_popup.xml @@ -24,6 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="catalog_product_grouped"/> + <update handle="catalog_product_grouped" /> <block class="Magento\Backend\Block\Widget\Grid\Container" name="catalog.product.edit.tab.super.grid.popup.container" template="Magento_Backend::widget/grid/container/empty.phtml" output="1"/> </layout> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grouped_grid_popup.xml b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml similarity index 95% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grouped_grid_popup.xml rename to app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml index fdca16f4bd8..e211f37cd0e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_grouped_grid_popup.xml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/layout/groupedproduct_popup_grid.xml @@ -28,12 +28,12 @@ <block class="Magento\Backend\Block\Widget\Grid" name="catalog.product.edit.tab.super.group.popup" as="grid"> <arguments> <argument name="id" xsi:type="string">grouped_grid_popup</argument> - <argument name="dataSource" xsi:type="object">Magento\Catalog\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection</argument> + <argument name="dataSource" xsi:type="object">Magento\GroupedProduct\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection</argument> <argument name="use_ajax" xsi:type="string">1</argument> <argument name="default_sort" xsi:type="string">id</argument> <argument name="default_dir" xsi:type="string">ASC</argument> <argument name="save_parameters_in_session" xsi:type="string">0</argument> - <argument name="grid_url" xsi:type="url" path="*/*/superGroupPopup"> + <argument name="grid_url" xsi:type="url" path="groupedProduct/edit/popup"> <param name="_current">1</param> </argument> </arguments> diff --git a/app/code/Magento/Catalog/view/adminhtml/product/grouped/container.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/container.phtml similarity index 94% rename from app/code/Magento/Catalog/view/adminhtml/product/grouped/container.phtml rename to app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/container.phtml index 4fab9f23739..945dd4a6e87 100644 --- a/app/code/Magento/Catalog/view/adminhtml/product/grouped/container.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/container.phtml @@ -25,7 +25,7 @@ */ ?> -<?php /* @var $this \Magento\Catalog\Block\Product\Grouped\AssociatedProducts */ ?> +<?php /* @var $this \Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts */ ?> <div class="entry-edit" id="<?php echo $this->getId() ?>"> <div class="fieldset-wrapper collapsable-wrapper" id="<?php echo $this->getId() ?>-wrapper"> <div class="fieldset-wrapper-title"> diff --git a/app/code/Magento/Catalog/view/adminhtml/product/grouped/grouped.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/grouped.phtml similarity index 94% rename from app/code/Magento/Catalog/view/adminhtml/product/grouped/grouped.phtml rename to app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/grouped.phtml index 5f4b3469a0d..e759f76c824 100644 --- a/app/code/Magento/Catalog/view/adminhtml/product/grouped/grouped.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/grouped.phtml @@ -43,7 +43,7 @@ $_helper = $this->helper('Magento\Core\Helper\Data'); <button type="button" data-role="add-product">Add Products to Group</button> <script type="text/javascript"> jQuery(function($) { - head.js("<?php echo $this->getViewFileUrl('Magento_Catalog::js/grouped-product.js') ?>", function() { + head.js("<?php echo $this->getViewFileUrl('Magento_GroupedProduct::js/grouped-product.js') ?>", function() { $('#grouped-product-container').mage('groupedProduct', { gridPopup: window.<?php echo $_gridPopupBlock->getJsObjectName() ?> }); diff --git a/app/code/Magento/Catalog/view/adminhtml/product/grouped/list.phtml b/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/list.phtml similarity index 96% rename from app/code/Magento/Catalog/view/adminhtml/product/grouped/list.phtml rename to app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/list.phtml index 05095c4ff92..aa3be6ac9e3 100644 --- a/app/code/Magento/Catalog/view/adminhtml/product/grouped/list.phtml +++ b/app/code/Magento/GroupedProduct/view/adminhtml/product/grouped/list.phtml @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ -/* @var $this \Magento\Catalog\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts */ +/* @var $this \Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts */ ?> <script type="text/x-jquery-tmpl" id="group-product-template"> <tr title="#" class="pointer" data-role="row"> diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_grouped.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_view_type_grouped.xml similarity index 87% rename from app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_grouped.xml rename to app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_view_type_grouped.xml index adf68a42692..1b3d0eb71b2 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view_type_grouped.xml +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_view_type_grouped.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="product.info.form.content"> - <block class="Magento\Catalog\Block\Product\View\Type\Grouped" name="product.info.grouped" before="product.info.addtocart" template="product/view/type/grouped.phtml"/> + <block class="Magento\GroupedProduct\Block\Product\View\Type\Grouped" name="product.info.grouped" before="product.info.addtocart" template="product/view/type/grouped.phtml"/> <container name="product.info.grouped.extra" after="product.info.grouped" before="product.info.grouped" as="product_type_data_extra" label="Product Extra Info"/> </referenceContainer> </layout> diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/rss_catalog_category.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/rss_catalog_category.xml new file mode 100644 index 00000000000..efd78c1b381 --- /dev/null +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/rss_catalog_category.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="rss.catalog.category"> + <action method="addPriceBlockType"> + <argument name="type" xsi:type="string">grouped</argument> + <argument name="block" xsi:type="string">Magento\Catalog\Block\Product\Price</argument> + <argument name="template" xsi:type="string">Magento_GroupedProduct::rss/product/price.phtml</argument> + </action> + </referenceBlock> +</layout> diff --git a/app/code/Magento/GroupedProduct/view/frontend/layout/rss_catalog_new.xml b/app/code/Magento/GroupedProduct/view/frontend/layout/rss_catalog_new.xml new file mode 100644 index 00000000000..974fd752c71 --- /dev/null +++ b/app/code/Magento/GroupedProduct/view/frontend/layout/rss_catalog_new.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="rss.catalog.new"> + <action method="addPriceBlockType"> + <argument name="type" xsi:type="string">grouped</argument> + <argument name="block" xsi:type="string">Magento\Catalog\Block\Product\Price</argument> + <argument name="template" xsi:type="string">Magento_GroupedProduct::rss/product/price.phtml</argument> + </action> + </referenceBlock> +</layout> diff --git a/app/code/Magento/GroupedProduct/view/frontend/product/price.phtml b/app/code/Magento/GroupedProduct/view/frontend/product/price.phtml new file mode 100644 index 00000000000..111c5b4780f --- /dev/null +++ b/app/code/Magento/GroupedProduct/view/frontend/product/price.phtml @@ -0,0 +1,83 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +/** + * Template for displaying grouped product price in different places (products grid, product view page etc) + */ +?> +<?php +/* @var $_coreHelper \Magento\Core\Helper\Data */ +$_coreHelper = $this->helper('Magento\Core\Helper\Data'); +/* @var $priceHelper \Magento\Catalog\Helper\Product\Price */ +$priceHelper = $this->helper('Magento\Catalog\Helper\Product\Price'); + +$_product = $this->getProduct(); +$_id = $_product->getId(); +$_minimalPriceValue = $_product->getMinimalPrice(); +$showMinPrice = $this->getDisplayMinimalPrice(); + +if ($showMinPrice && $_minimalPriceValue) { + $_exclTax = $priceHelper->getPrice($_product, $_minimalPriceValue); + $_inclTax = $priceHelper->getPrice($_product, $_minimalPriceValue, true); + $price = $showMinPrice ? $_minimalPriceValue : 0; +} else { + $price = $_product->getFinalPrice(); + $_exclTax = $priceHelper->getPrice($_product, $price); + $_inclTax = $priceHelper->getPrice($_product, $price, true); +} +?> + +<?php if ($price): ?> + <div class="price-box" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> + <p<?php if ($showMinPrice): ?> class="minimal-price"<?php endif ?>> + <?php if ($showMinPrice): ?> + <span class="price-label"><?php echo __('Starting at:') ?></span> + <?php endif ?> + <?php if ($priceHelper->displayBothPrices()): ?> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>" itemprop="price"> + <?php echo $_coreHelper->currency($_exclTax, true, false) ?> + </span> + </span> + <span class="price-including-tax"> + <span class="label"><?php echo __('Incl. Tax:') ?></span> + <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"> + <?php echo $_coreHelper->currency($_inclTax, true, false) ?> + </span> + </span> + <?php else: ?> + <?php + $_showPrice = $_inclTax; + if (!$priceHelper->displayPriceIncludingTax()) { + $_showPrice = $_exclTax; + } + ?> + <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>" itemprop="price"> + <?php echo $_coreHelper->currency($_showPrice, true, false) ?> + </span> + <?php endif; ?> + </p> + </div> +<?php endif; ?> diff --git a/app/code/Magento/Catalog/view/frontend/product/view/type/grouped.phtml b/app/code/Magento/GroupedProduct/view/frontend/product/view/type/grouped.phtml similarity index 95% rename from app/code/Magento/Catalog/view/frontend/product/view/type/grouped.phtml rename to app/code/Magento/GroupedProduct/view/frontend/product/view/type/grouped.phtml index 073475a699d..e609f0b4048 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/type/grouped.phtml +++ b/app/code/Magento/GroupedProduct/view/frontend/product/view/type/grouped.phtml @@ -26,7 +26,7 @@ * Grouped product data template * * @var $this \Magento\Catalog\Block\Product\View\BaseImage - * @var $this \Magento\Catalog\Block\Product\View\Type\Grouped + * @var $this \Magento\GroupedProduct\Block\Product\View\Type\Grouped */ ?> <?php $this->setPreconfiguredValue(); ?> @@ -80,7 +80,8 @@ value="<?php echo $_item->getQty() * 1 ?>" title="<?php echo __('Qty') ?>" class="input-text qty" - data-validate="{'validate-grouped-qty':'#super-product-table'}"/> + data-validate="{'validate-grouped-qty':'#super-product-table'}" + data-validate-message-box="#validate-message-box"/> </div> <?php else: ?> <p class="stock unavailable" title="<?php echo __('Availability') ?>"> @@ -101,3 +102,4 @@ <?php endif; ?> </tbody> </table> +<div id="validation-message-box"></div> diff --git a/app/code/Magento/GroupedProduct/view/frontend/rss/product/price.phtml b/app/code/Magento/GroupedProduct/view/frontend/rss/product/price.phtml new file mode 100644 index 00000000000..ef9c29e5e04 --- /dev/null +++ b/app/code/Magento/GroupedProduct/view/frontend/rss/product/price.phtml @@ -0,0 +1,67 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +/** + * Template for displaying product price in RSS feeds + * + * @var $this \Magento\Catalog\Block\Product\Price + */ +?> +<?php +$_product = $this->getProduct(); +$_id = $_product->getId(); +$_minimalPriceValue = $_product->getMinimalPrice(); + +/** @var \Magento\Catalog\Helper\Product\Price $priceHelper */ +$priceHelper = $this->helper('Magento\Catalog\Helper\Product\Price'); +$_exclTax = $priceHelper->getPrice($_product, $_minimalPriceValue, $includingTax = null); +$_inclTax = $priceHelper->getPrice($_product, $_minimalPriceValue, $includingTax = true); +?> + +<?php if ($_product->getCanShowPrice() !== false):?> + <?php if ($this->getDisplayMinimalPrice() && $_minimalPriceValue): ?> + <div class="price-box"> + <p class="minimal-price"> + <span class="price-label"><?php echo __('Starting at:') ?></span> + <?php if ($this->helper('Magento\Tax\Helper\Data')->displayBothPrices()): ?> + <span class="price-excluding-tax"> + <span class="label"><?php echo __('Excl. Tax:') ?></span> + <span class="price" id="price-excluding-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_exclTax, true, false) ?></span> + </span> + <span class="price-including-tax"> + <span class="label"><?php echo __('Incl. Tax:') ?></span> + <span class="price" id="price-including-tax-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_inclTax, true, false) ?></span> + </span> + <?php else: ?> + <?php + $_showPrice = $_inclTax; + if (!$priceHelper->displayPriceIncludingTax()) { + $_showPrice = $_exclTax; + } + ?> + <span class="price" id="product-minimal-price-<?php echo $_id ?><?php echo $this->getIdSuffix() ?>"><?php echo $this->helper('Magento\Core\Helper\Data')->currency($_showPrice, true, false) ?></span> + <?php endif; ?> + </p> + </div> + <?php endif; ?> +<?php endif; ?> diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php index 03e67a9fbd9..45c7456ec2b 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php @@ -92,7 +92,7 @@ class Export extends \Magento\Backend\App\Action return $this->_fileFactory->create( $model->getFileName(), $model->export(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, $model->getContentType() ); } catch (\Magento\Core\Exception $e) { diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Import.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Import.php index 585cf25a0e4..b4df770b8db 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Import.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Import.php @@ -134,7 +134,8 @@ class Import extends \Magento\Backend\App\Action $import = $this->_objectManager->create('Magento\ImportExport\Model\Import')->setData($data); $source = \Magento\ImportExport\Model\Import\Adapter::findAdapterFor( $import->uploadSource(), - $this->_objectManager->create('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::ROOT) + $this->_objectManager->create('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR) ); $validationResult = $import->validateSource($source); diff --git a/app/code/Magento/ImportExport/Model/AbstractModel.php b/app/code/Magento/ImportExport/Model/AbstractModel.php index 33a13a97182..03cd96f6f3b 100644 --- a/app/code/Magento/ImportExport/Model/AbstractModel.php +++ b/app/code/Magento/ImportExport/Model/AbstractModel.php @@ -79,18 +79,18 @@ abstract class AbstractModel extends \Magento\Object /** * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory * @param array $data */ public function __construct( \Magento\Logger $logger, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Log\AdapterFactory $adapterFactory, array $data = array() ) { $this->_logger = $logger; - $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $this->_adapterFactory = $adapterFactory; parent::__construct($data); } diff --git a/app/code/Magento/ImportExport/Model/Export.php b/app/code/Magento/ImportExport/Model/Export.php index 13acf89f630..e4f8bcd7e8f 100644 --- a/app/code/Magento/ImportExport/Model/Export.php +++ b/app/code/Magento/ImportExport/Model/Export.php @@ -77,7 +77,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel /** * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory * @param \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig * @param \Magento\ImportExport\Model\Export\Entity\Factory $entityFactory @@ -86,7 +86,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel */ public function __construct( \Magento\Logger $logger, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Log\AdapterFactory $adapterFactory, \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig, \Magento\ImportExport\Model\Export\Entity\Factory $entityFactory, diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php index 85f88718e9f..449cf6ec2ac 100644 --- a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php +++ b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php @@ -57,13 +57,13 @@ abstract class AbstractAdapter /** * Constructor * - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param null $destination * @throws \Magento\Core\Exception */ - public function __construct(\Magento\Filesystem $filesystem, $destination = null) + public function __construct(\Magento\App\Filesystem $filesystem, $destination = null) { - $this->_directoryHandle = $filesystem->getDirectoryWrite(\Magento\Filesystem::SYS_TMP); + $this->_directoryHandle = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::SYS_TMP_DIR); if (!$destination) { $destination = uniqid('importexport_'); $this->_directoryHandle->touch($destination); diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php index 04c36d20d6f..af6a748089c 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php @@ -527,7 +527,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, - \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED + \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED, )) ->where('cpl.product_id IN (?)', $productIds); @@ -825,7 +825,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED => '_links_related_', \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL => '_links_upsell_', \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL => '_links_crosssell_', - \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED => '_associated_' + \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED => '_associated_' ); $configurableProductsCollection = $this->_entityCollection; $configurableProductsCollection->addAttributeToFilter( diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php index ff9f7e40ff3..0d8dd9299f0 100644 --- a/app/code/Magento/ImportExport/Model/Import.php +++ b/app/code/Magento/ImportExport/Model/Import.php @@ -133,13 +133,13 @@ class Import extends \Magento\ImportExport\Model\AbstractModel protected $_behaviorFactory; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; /** * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Log\AdapterFactory $adapterFactory * @param \Magento\ImportExport\Helper\Data $importExportData * @param \Magento\Core\Model\Config $coreConfig @@ -155,7 +155,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel */ public function __construct( \Magento\Logger $logger, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Log\AdapterFactory $adapterFactory, \Magento\ImportExport\Helper\Data $importExportData, \Magento\Core\Model\Config $coreConfig, @@ -236,7 +236,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel { return \Magento\ImportExport\Model\Import\Adapter::findAdapterFor( $sourceFile, - $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT) + $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR) ); } diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php index 4449f311ec6..5a6bffeb3ac 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php @@ -425,7 +425,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * @param \Magento\Catalog\Model\Resource\Product\LinkFactory $linkFactory * @param \Magento\ImportExport\Model\Import\Proxy\ProductFactory $proxyProdFactory * @param \Magento\ImportExport\Model\Import\UploaderFactory $uploaderFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\CatalogInventory\Model\Resource\Stock\ItemFactory $stockResItemFac * @param \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory * @param \Magento\Core\Model\LocaleInterface $locale @@ -456,7 +456,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity \Magento\Catalog\Model\Resource\Product\LinkFactory $linkFactory, \Magento\ImportExport\Model\Import\Proxy\ProductFactory $proxyProdFactory, \Magento\ImportExport\Model\Import\UploaderFactory $uploaderFactory, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\CatalogInventory\Model\Resource\Stock\ItemFactory $stockResItemFac, \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory, \Magento\Core\Model\LocaleInterface $locale, @@ -478,7 +478,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $this->_linkFactory = $linkFactory; $this->_proxyProdFactory = $proxyProdFactory; $this->_uploaderFactory = $uploaderFactory; - $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_stockResItemFac = $stockResItemFac; $this->_stockItemFactory = $stockItemFactory; $this->_locale = $locale; @@ -1254,13 +1254,13 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity if (!is_null($productType)) { $previousType = $productType; } - if (!is_null($rowData[self::COL_ATTR_SET])) { - $prevAttributeSet = $rowData[\Magento\ImportExport\Model\Import\Entity\Product::COL_ATTR_SET]; + if (isset($rowData[self::COL_ATTR_SET])) { + $prevAttributeSet = $rowData[self::COL_ATTR_SET]; } if (self::SCOPE_NULL == $rowScope) { // for multiselect attributes only if (!is_null($prevAttributeSet)) { - $rowData[\Magento\ImportExport\Model\Import\Entity\Product::COL_ATTR_SET] = $prevAttributeSet; + $rowData[self::COL_ATTR_SET] = $prevAttributeSet; } if (is_null($productType) && !is_null($previousType)) { $productType = $previousType; diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php index f6aad4ebf51..4ddcf479a9f 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php @@ -109,7 +109,7 @@ class Grouped */ public function saveData() { - $groupedLinkId = \Magento\Catalog\Model\Product\Link::LINK_TYPE_GROUPED; + $groupedLinkId = \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED; $connection = $this->_resource->getConnection('write'); $resource = $this->_productLinkFactory->create(); $mainTable = $resource->getMainTable(); diff --git a/app/code/Magento/ImportExport/Model/Import/Uploader.php b/app/code/Magento/ImportExport/Model/Import/Uploader.php index bb17d269b0e..c5829d581ca 100644 --- a/app/code/Magento/ImportExport/Model/Import/Uploader.php +++ b/app/code/Magento/ImportExport/Model/Import/Uploader.php @@ -67,7 +67,7 @@ class Uploader extends \Magento\Core\Model\File\Uploader \Magento\Core\Helper\File\Storage $coreFileStorage, \Magento\Image\AdapterFactory $imageFactory, \Magento\Core\Model\File\Validator\NotProtectedExtension $validator, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, $filePath = null ) { if (!is_null($filePath)) { @@ -77,7 +77,7 @@ class Uploader extends \Magento\Core\Model\File\Uploader $this->_coreFileStorageDb = $coreFileStorageDb; $this->_coreFileStorage = $coreFileStorage; $this->_validator = $validator; - $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); } /** diff --git a/app/code/Magento/ImportExport/etc/module.xml b/app/code/Magento/ImportExport/etc/module.xml index b5bfb7199eb..c5b14149ce8 100755 --- a/app/code/Magento/ImportExport/etc/module.xml +++ b/app/code/Magento/ImportExport/etc/module.xml @@ -37,6 +37,7 @@ <module name="Magento_CatalogInventory"/> <module name="Magento_Customer"/> <module name="Magento_Directory"/> + <module name="Magento_GroupedProduct"/> </depends> </module> </config> diff --git a/app/code/Magento/Index/App/Indexer.php b/app/code/Magento/Index/App/Indexer.php index 924ddf0dea6..5f9826cc567 100644 --- a/app/code/Magento/Index/App/Indexer.php +++ b/app/code/Magento/Index/App/Indexer.php @@ -25,6 +25,7 @@ */ namespace Magento\Index\App; +use Magento\App\Console\Response; use Magento\AppInterface; class Indexer implements AppInterface @@ -37,7 +38,7 @@ class Indexer implements AppInterface protected $_reportDir; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -46,30 +47,38 @@ class Indexer implements AppInterface */ protected $_indexerFactory; + /** + * @var \Magento\App\Console\Response + */ + protected $_response; + /** * @param string $reportDir - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Index\Model\IndexerFactory $indexerFactory + * @param Response $response */ public function __construct( $reportDir, - \Magento\Filesystem $filesystem, - \Magento\Index\Model\IndexerFactory $indexerFactory + \Magento\App\Filesystem $filesystem, + \Magento\Index\Model\IndexerFactory $indexerFactory, + Response $response ) { $this->_reportDir = $reportDir; $this->_filesystem = $filesystem; $this->_indexerFactory = $indexerFactory; + $this->_response = $response; } /** * Run application * - * @return int + * @return \Magento\App\ResponseInterface */ public function execute() { /* Clean reports */ - $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $directory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $path = $directory->getRelativePath($this->_reportDir); if ($directory->isExist($path)) { $directory->delete($path); @@ -84,7 +93,8 @@ class Indexer implements AppInterface $process->reindexEverything(); } } - return 0; + $this->_response->setCode(0); + return $this->_response; } } diff --git a/app/code/Magento/Index/App/Shell.php b/app/code/Magento/Index/App/Shell.php index 60c1c33b70e..fc90a602167 100644 --- a/app/code/Magento/Index/App/Shell.php +++ b/app/code/Magento/Index/App/Shell.php @@ -25,8 +25,8 @@ */ namespace Magento\Index\App; -use Magento\AppInterface, - Magento\Index\App\Shell\ErrorHandler; +use Magento\App\Console\Response; +use Magento\AppInterface; class Shell implements AppInterface { @@ -38,34 +38,34 @@ class Shell implements AppInterface protected $_entryFileName; /** - * @var \Magento\Index\App\Shell\ErrorHandler + * @var \Magento\Index\Model\ShellFactory */ - protected $_errorHandler; + protected $_shellFactory; /** - * @var \Magento\Index\Model\ShellFactory + * @var \Magento\App\Console\Response */ - protected $_shellFactory; + protected $_response; /** * @param string $entryFileName * @param \Magento\Index\Model\ShellFactory $shellFactory - * @param ErrorHandler $errorHandler + * @param Response $response */ public function __construct( $entryFileName, \Magento\Index\Model\ShellFactory $shellFactory, - ErrorHandler $errorHandler + Response $response ) { $this->_entryFileName = $entryFileName; $this->_shellFactory = $shellFactory; - $this->_errorHandler = $errorHandler; + $this->_response = $response; } /** * Run application * - * @return int + * @return \Magento\App\ResponseInterface */ public function execute() { @@ -73,8 +73,10 @@ class Shell implements AppInterface $shell = $this->_shellFactory->create(array('entryPoint' => $this->_entryFileName)); $shell->run(); if ($shell->hasErrors()) { - $this->_errorHandler->terminate(1); + $this->_response->setCode(-1); + } else { + $this->_response->setCode(0); } - return 0; + return $this->_response; } } diff --git a/app/code/Magento/Index/Model/Lock/Storage.php b/app/code/Magento/Index/Model/Lock/Storage.php index 832dbe2d907..e0e783d8c77 100644 --- a/app/code/Magento/Index/Model/Lock/Storage.php +++ b/app/code/Magento/Index/Model/Lock/Storage.php @@ -52,14 +52,14 @@ class Storage /** * @param \Magento\Index\Model\Process\FileFactory $fileFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Index\Model\Process\FileFactory $fileFactory, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_fileFactory = $fileFactory; - $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); } /** diff --git a/app/code/Magento/Index/Model/Shell.php b/app/code/Magento/Index/Model/Shell.php index cfdbf181f91..cc69d816146 100644 --- a/app/code/Magento/Index/Model/Shell.php +++ b/app/code/Magento/Index/Model/Shell.php @@ -48,12 +48,12 @@ class Shell extends \Magento\Core\Model\AbstractShell protected $_indexer; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param string $entryPoint * @param Indexer $indexer */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, $entryPoint, \Magento\Index\Model\Indexer $indexer ) { diff --git a/app/code/Magento/Install/App/Action/Plugin/Dir.php b/app/code/Magento/Install/App/Action/Plugin/Dir.php index 780e00ffd36..348085244ff 100644 --- a/app/code/Magento/Install/App/Action/Plugin/Dir.php +++ b/app/code/Magento/Install/App/Action/Plugin/Dir.php @@ -25,7 +25,7 @@ namespace Magento\Install\App\Action\Plugin; -use Magento\Filesystem, +use Magento\App\Filesystem, Magento\Filesystem\FilesystemException, Magento\Filesystem\Directory\Write, Magento\App\State, diff --git a/app/code/Magento/Install/App/Console.php b/app/code/Magento/Install/App/Console.php index 99a673f7e44..e35f7491681 100644 --- a/app/code/Magento/Install/App/Console.php +++ b/app/code/Magento/Install/App/Console.php @@ -25,6 +25,8 @@ */ namespace Magento\Install\App; +use Magento\App\Console\Response; + class Console implements \Magento\AppInterface { /** @@ -58,13 +60,19 @@ class Console implements \Magento\AppInterface */ protected $rootDirectory; + /** + * @var \Magento\App\Console\Response + */ + protected $_response; + /** * @param \Magento\Install\Model\Installer\ConsoleFactory $installerFactory * @param Output $output * @param \Magento\App\State $state * @param \Magento\App\ObjectManager\ConfigLoader $loader * @param \Magento\ObjectManager $objectManager - * @param \Magento\Filesystem $filesystem + * @param Response $response + * @param \Magento\App\Filesystem $filesystem * @param array $arguments */ public function __construct( @@ -73,15 +81,17 @@ class Console implements \Magento\AppInterface \Magento\App\State $state, \Magento\App\ObjectManager\ConfigLoader $loader, \Magento\ObjectManager $objectManager, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, + Response $response, array $arguments = array() ) { - $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->_loader = $loader; $this->_state = $state; $this->_installerFactory = $installerFactory; $this->_arguments = $this->_buildInitArguments($arguments); $this->_output = $output; + $this->_response = $response; $this->_objectManager = $objectManager; } @@ -97,13 +107,13 @@ class Console implements \Magento\AppInterface if (!empty($args[\Magento\Install\Model\Installer\Console::OPTION_URIS])) { $uris = unserialize(base64_decode($args[\Magento\Install\Model\Installer\Console::OPTION_URIS])); foreach ($uris as $code => $uri) { - $args[\Magento\Filesystem::PARAM_APP_DIRS][$code]['uri'] = $uri; + $args[\Magento\App\Filesystem::PARAM_APP_DIRS][$code]['uri'] = $uri; } } if (!empty($args[\Magento\Install\Model\Installer\Console::OPTION_DIRS])) { $dirs = unserialize(base64_decode($args[\Magento\Install\Model\Installer\Console::OPTION_DIRS])); foreach ($dirs as $code => $dir) { - $args[\Magento\Filesystem::PARAM_APP_DIRS][$code]['path'] = $dir; + $args[\Magento\App\Filesystem::PARAM_APP_DIRS][$code]['path'] = $dir; } } return $args; @@ -141,8 +151,9 @@ class Console implements \Magento\AppInterface } /** - * Execute application - * @return int + * Run application + * + * @return \Magento\App\ResponseInterface */ public function execute() { @@ -162,6 +173,7 @@ class Console implements \Magento\AppInterface } else { $this->_handleInstall($installer); } - return 0; + $this->_response->setCode(0); + return $this->_response; } } diff --git a/app/code/Magento/Install/Block/AbstractBlock.php b/app/code/Magento/Install/Block/AbstractBlock.php index 72028f87e58..67a06eb1470 100644 --- a/app/code/Magento/Install/Block/AbstractBlock.php +++ b/app/code/Magento/Install/Block/AbstractBlock.php @@ -72,6 +72,7 @@ abstract class AbstractBlock extends \Magento\View\Element\Template $this->_installer = $installer; $this->_installWizard = $installWizard; $this->_session = $session; + $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Install/Block/Begin.php b/app/code/Magento/Install/Block/Begin.php index e407601b5bf..a88d772ad91 100644 --- a/app/code/Magento/Install/Block/Begin.php +++ b/app/code/Magento/Install/Block/Begin.php @@ -79,7 +79,7 @@ class Begin extends \Magento\Install\Block\AbstractBlock public function getLicenseHtml() { return ($this->_eulaFile) - ? $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT)->readFile($this->_eulaFile) + ? $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR)->readFile($this->_eulaFile) : ''; } } diff --git a/app/code/Magento/Install/Block/Download.php b/app/code/Magento/Install/Block/Download.php index 195e888cd34..9b53e921fc3 100644 --- a/app/code/Magento/Install/Block/Download.php +++ b/app/code/Magento/Install/Block/Download.php @@ -89,7 +89,7 @@ class Download extends \Magento\Install\Block\AbstractBlock public function hasLocalCopy() { $path = $this->_moduleReader->getModuleDir('etc', 'Magento_Adminhtml'); - $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $directory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); if ($path && $directory->isDirectory($directory->getRelativePath($path))) { return true; diff --git a/app/code/Magento/Install/Block/State.php b/app/code/Magento/Install/Block/State.php index eabe10c20a9..72f503e6258 100644 --- a/app/code/Magento/Install/Block/State.php +++ b/app/code/Magento/Install/Block/State.php @@ -54,7 +54,7 @@ class State extends \Magento\View\Element\Template array $data = array() ) { parent::__construct($context, $data); - + $this->_isScopePrivate = true; $this->assign('steps', $wizard->getSteps()); } diff --git a/app/code/Magento/Install/Model/Config.php b/app/code/Magento/Install/Model/Config.php index 0a2ba993d10..f95272ee31d 100644 --- a/app/code/Magento/Install/Model/Config.php +++ b/app/code/Magento/Install/Model/Config.php @@ -46,7 +46,7 @@ class Config /** * Filesystem * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -54,11 +54,11 @@ class Config * Constructor * * @param Config\Data $dataStorage - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Install\Model\Config\Data $dataStorage, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_dataStorage = $dataStorage; $this->filesystem = $filesystem; diff --git a/app/code/Magento/Install/Model/Installer/Config.php b/app/code/Magento/Install/Model/Installer/Config.php index 3cc67560343..3ac38179221 100644 --- a/app/code/Magento/Install/Model/Installer/Config.php +++ b/app/code/Magento/Install/Model/Installer/Config.php @@ -49,7 +49,7 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller protected $_configData = array(); /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -78,14 +78,14 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller /** * @param \Magento\Install\Model\Installer $installer * @param \Magento\App\RequestInterface $request - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Install\Model\Installer $installer, \Magento\App\RequestInterface $request, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Message\ManagerInterface $messageManager ) { @@ -93,8 +93,8 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller $this->_request = $request; $this->_storeManager = $storeManager; $this->_filesystem = $filesystem; - $this->_pubDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::PUB_LIB); - $this->_configDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::CONFIG); + $this->_pubDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::PUB_LIB_DIR); + $this->_configDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::CONFIG_DIR); $this->messageManager = $messageManager; } @@ -119,9 +119,9 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller $data = $this->getConfigData(); $defaults = array( - 'root_dir' => $this->_filesystem->getPath(\Magento\Filesystem::ROOT), - 'app_dir' => $this->_filesystem->getPath(\Magento\Filesystem::APP), - 'var_dir' => $this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR), + 'root_dir' => $this->_filesystem->getPath(\Magento\App\Filesystem::ROOT_DIR), + 'app_dir' => $this->_filesystem->getPath(\Magento\App\Filesystem::APP_DIR), + 'var_dir' => $this->_filesystem->getPath(\Magento\App\Filesystem::VAR_DIR), 'base_url' => $this->_request->getDistroBaseUrl(), ); foreach ($defaults as $index => $value) { @@ -205,7 +205,7 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller { try { $staticFile = $this->_findFirstFileRelativePath('', '/.+\.(html?|js|css|gif|jpe?g|png)$/'); - $staticUrl = $baseUrl . $this->_filesystem->getUri(\Magento\Filesystem::PUB_LIB) . '/' . $staticFile; + $staticUrl = $baseUrl . $this->_filesystem->getUri(\Magento\App\Filesystem::PUB_LIB_DIR) . '/' . $staticFile; $client = new \Magento\HTTP\ZendClient($staticUrl); $response = $client->request('GET'); } catch (\Exception $e){ diff --git a/app/code/Magento/Install/Model/Installer/Console.php b/app/code/Magento/Install/Model/Installer/Console.php index a5fef73d0c2..761c921c3b1 100644 --- a/app/code/Magento/Install/Model/Installer/Console.php +++ b/app/code/Magento/Install/Model/Installer/Console.php @@ -75,7 +75,7 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller ); /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -132,7 +132,7 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller * @param \Magento\Install\Model\Installer $installer * @param \Magento\App\Resource\Config $resourceConfig * @param \Magento\Module\UpdaterInterface $dbUpdater - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Install\Model\Installer\Data $installerData * @param \Magento\App\State $appState * @param \Magento\Core\Model\LocaleInterface $locale @@ -142,7 +142,7 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller \Magento\Install\Model\Installer $installer, \Magento\App\Resource\Config $resourceConfig, \Magento\Module\UpdaterInterface $dbUpdater, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Install\Model\Installer\Data $installerData, \Magento\App\State $appState, \Magento\Core\Model\LocaleInterface $locale, @@ -361,7 +361,7 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller * Change directories mode to be writable by apache user */ $this->_filesystem - ->getDirectoryWrite(\Magento\Filesystem::VAR_DIR) + ->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR) ->changePermissions('', 0777); return $encryptionKey; @@ -402,13 +402,13 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller $this->_cleanUpDatabase(); /* Remove temporary directories and local.xml */ - $varDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $varDirectory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); foreach ($varDirectory->read() as $path) { if ($varDirectory->isDirectory($path)) { $varDirectory->delete($path); } } - $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::CONFIG)->delete('local.xml'); + $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::CONFIG_DIR)->delete('local.xml'); return true; } diff --git a/app/code/Magento/Install/Model/Installer/Filesystem.php b/app/code/Magento/Install/Model/Installer/Filesystem.php index 641fd7a6414..15c629a5118 100644 --- a/app/code/Magento/Install/Model/Installer/Filesystem.php +++ b/app/code/Magento/Install/Model/Installer/Filesystem.php @@ -39,7 +39,7 @@ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller /**#@- */ /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -64,13 +64,13 @@ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller /** * @param \Magento\Install\Model\Installer $installer - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Install\Model\Config $installConfig * @param \Magento\Message\ManagerInterface $messageManager */ public function __construct( \Magento\Install\Model\Installer $installer, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Install\Model\Config $installConfig, \Magento\Message\ManagerInterface $messageManager ) { @@ -124,7 +124,7 @@ class Filesystem extends \Magento\Install\Model\Installer\AbstractInstaller protected function _checkFullPath($fullPath, $recursive, $existence) { $result = true; - $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $directory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $path = $directory->getRelativePath($fullPath); if ($recursive && $directory->isDirectory($path)) { $pathsToCheck = $directory->read($path); diff --git a/app/code/Magento/Install/etc/module.xml b/app/code/Magento/Install/etc/module.xml index b64b00ab7fe..6856394109a 100755 --- a/app/code/Magento/Install/etc/module.xml +++ b/app/code/Magento/Install/etc/module.xml @@ -34,6 +34,7 @@ <module name="Magento_Directory"/> <module name="Magento_User"/> <module name="Magento_Backend"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Integration/etc/module.xml b/app/code/Magento/Integration/etc/module.xml index c6d174207db..8205cd2e4c4 100755 --- a/app/code/Magento/Integration/etc/module.xml +++ b/app/code/Magento/Integration/etc/module.xml @@ -31,6 +31,8 @@ <depends> <module name="Magento_Core"/> <module name="Magento_Backend"/> + <module name="Magento_Customer"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Log/App/Shell.php b/app/code/Magento/Log/App/Shell.php index 809d740fcb7..fb56d6e8004 100644 --- a/app/code/Magento/Log/App/Shell.php +++ b/app/code/Magento/Log/App/Shell.php @@ -25,6 +25,7 @@ */ namespace Magento\Log\App; +use Magento\App\Console\Response; use Magento\AppInterface; class Shell implements AppInterface @@ -41,29 +42,38 @@ class Shell implements AppInterface */ protected $_shellFactory; + /** + * @var \Magento\App\Console\Response + */ + protected $_response; + /** * @param string $entryFileName * @param \Magento\Log\Model\ShellFactory $shellFactory + * @param Response $response */ public function __construct( $entryFileName, - \Magento\Log\Model\ShellFactory $shellFactory + \Magento\Log\Model\ShellFactory $shellFactory, + Response $response ) { $this->_entryFileName = $entryFileName; $this->_shellFactory = $shellFactory; + $this->_response = $response; } /** * Run application * - * @return int + * @return \Magento\App\ResponseInterface */ public function execute() { /** @var $shell \Magento\Log\Model\Shell */ $shell = $this->_shellFactory->create(array('entryPoint' => $this->_entryFileName)); $shell->run(); - return 0; + $this->_response->setCode(0); + return $this->_response; } } diff --git a/app/code/Magento/Log/Model/Shell.php b/app/code/Magento/Log/Model/Shell.php index c2bb07aabad..2fa004b9672 100644 --- a/app/code/Magento/Log/Model/Shell.php +++ b/app/code/Magento/Log/Model/Shell.php @@ -41,12 +41,12 @@ class Shell extends \Magento\Core\Model\AbstractShell protected $_commandFactory; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param string $entryPoint * @param Shell\Command\Factory $commandFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, $entryPoint, \Magento\Log\Model\Shell\Command\Factory $commandFactory ) { diff --git a/app/code/Magento/Log/etc/module.xml b/app/code/Magento/Log/etc/module.xml index 5a11ddf352b..f3d7e8dd56d 100755 --- a/app/code/Magento/Log/etc/module.xml +++ b/app/code/Magento/Log/etc/module.xml @@ -34,6 +34,7 @@ <module name="Magento_Customer"/> <module name="Magento_Sales"/> <module name="Magento_Backend"/> + <module name="Magento_Email"/> </depends> </module> </config> diff --git a/app/code/Magento/Checkout/Block/Multishipping/AbstractMultishipping.php b/app/code/Magento/Multishipping/Block/Checkout/AbstractMultishipping.php similarity index 83% rename from app/code/Magento/Checkout/Block/Multishipping/AbstractMultishipping.php rename to app/code/Magento/Multishipping/Block/Checkout/AbstractMultishipping.php index 04a71946dca..b1d755d62db 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/AbstractMultishipping.php +++ b/app/code/Magento/Multishipping/Block/Checkout/AbstractMultishipping.php @@ -31,23 +31,23 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping; +namespace Magento\Multishipping\Block\Checkout; class AbstractMultishipping extends \Magento\View\Element\Template { /** - * @var \Magento\Checkout\Model\Type\Multishipping + * @var \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected $_multishipping; /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Checkout\Model\Type\Multishipping $multishipping + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Checkout\Model\Type\Multishipping $multishipping, + \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, array $data = array() ) { $this->_multishipping = $multishipping; @@ -57,7 +57,7 @@ class AbstractMultishipping extends \Magento\View\Element\Template /** * Retrieve multishipping checkout model * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function getCheckout() { diff --git a/app/code/Magento/Checkout/Block/Multishipping/Address/Select.php b/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php similarity index 91% rename from app/code/Magento/Checkout/Block/Multishipping/Address/Select.php rename to app/code/Magento/Multishipping/Block/Checkout/Address/Select.php index aa64538839d..38abc957847 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Address/Select.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Address/Select.php @@ -31,10 +31,15 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping\Address; +namespace Magento\Multishipping\Block\Checkout\Address; -class Select extends \Magento\Checkout\Block\Multishipping\AbstractMultishipping +class Select extends \Magento\Multishipping\Block\Checkout\AbstractMultishipping { + /** + * @var bool + */ + protected $_isScopePrivate = true; + protected function _prepareLayout() { if ($headBlock = $this->getLayout()->getBlock('head')) { @@ -80,6 +85,6 @@ class Select extends \Magento\Checkout\Block\Multishipping\AbstractMultishipping public function getBackUrl() { - return $this->getUrl('*/multishipping/billing'); + return $this->getUrl('*/checkout/billing'); } } diff --git a/app/code/Magento/Checkout/Block/Multishipping/Addresses.php b/app/code/Magento/Multishipping/Block/Checkout/Addresses.php similarity index 91% rename from app/code/Magento/Checkout/Block/Multishipping/Addresses.php rename to app/code/Magento/Multishipping/Block/Checkout/Addresses.php index 549994f1555..6c089de62af 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Addresses.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Addresses.php @@ -31,7 +31,7 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping; +namespace Magento\Multishipping\Block\Checkout; class Addresses extends \Magento\Sales\Block\Items\AbstractItems { @@ -41,31 +41,32 @@ class Addresses extends \Magento\Sales\Block\Items\AbstractItems protected $_filterGridFactory; /** - * @var \Magento\Checkout\Model\Type\Multishipping + * @var \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected $_multishipping; /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Filter\Object\GridFactory $filterGridFactory - * @param \Magento\Checkout\Model\Type\Multishipping $multishipping + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Filter\Object\GridFactory $filterGridFactory, - \Magento\Checkout\Model\Type\Multishipping $multishipping, + \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, array $data = array() ) { $this->_filterGridFactory = $filterGridFactory; $this->_multishipping = $multishipping; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** * Retrieve multishipping checkout model * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function getCheckout() { @@ -175,7 +176,7 @@ class Addresses extends \Magento\Sales\Block\Items\AbstractItems */ public function getNewAddressUrl() { - return $this->getUrl('*/multishipping_address/newShipping'); + return $this->getUrl('*/checkout_address/newShipping'); } /** diff --git a/app/code/Magento/Checkout/Block/Multishipping/Billing.php b/app/code/Magento/Multishipping/Block/Checkout/Billing.php similarity index 91% rename from app/code/Magento/Checkout/Block/Multishipping/Billing.php rename to app/code/Magento/Multishipping/Block/Checkout/Billing.php index c487dd9ac52..55fc5a4cf35 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Billing.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Billing.php @@ -31,12 +31,12 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping; +namespace Magento\Multishipping\Block\Checkout; class Billing extends \Magento\Payment\Block\Form\Container { /** - * @var \Magento\Checkout\Model\Type\Multishipping + * @var \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected $_multishipping; @@ -48,20 +48,21 @@ class Billing extends \Magento\Payment\Block\Form\Container /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Payment\Helper\Data $paymentHelper - * @param \Magento\Checkout\Model\Type\Multishipping $multishipping + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Payment\Helper\Data $paymentHelper, - \Magento\Checkout\Model\Type\Multishipping $multishipping, + \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, \Magento\Checkout\Model\Session $checkoutSession, array $data = array() ) { $this->_multishipping = $multishipping; $this->_checkoutSession = $checkoutSession; parent::__construct($context, $paymentHelper, $data); + $this->_isScopePrivate = true; } /** @@ -146,7 +147,7 @@ class Billing extends \Magento\Payment\Block\Form\Container */ public function getSelectAddressUrl() { - return $this->getUrl('*/multishipping_address/selectBilling'); + return $this->getUrl('*/checkout_address/selectBilling'); } /** diff --git a/app/code/Magento/Checkout/Block/Multishipping/Billing/Items.php b/app/code/Magento/Multishipping/Block/Checkout/Billing/Items.php similarity index 87% rename from app/code/Magento/Checkout/Block/Multishipping/Billing/Items.php rename to app/code/Magento/Multishipping/Block/Checkout/Billing/Items.php index 61042a2145a..45f53e4f86e 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Billing/Items.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Billing/Items.php @@ -31,12 +31,12 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping\Billing; +namespace Magento\Multishipping\Block\Checkout\Billing; class Items extends \Magento\Sales\Block\Items\AbstractItems { /** - * @var \Magento\Checkout\Model\Type\Multishipping + * @var \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected $_multishipping; @@ -47,25 +47,26 @@ class Items extends \Magento\Sales\Block\Items\AbstractItems /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Checkout\Model\Type\Multishipping $multishipping + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Checkout\Model\Type\Multishipping $multishipping, + \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, \Magento\Checkout\Model\Session $checkoutSession, array $data = array() ) { $this->_multishipping = $multishipping; $this->_checkoutSession = $checkoutSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** * Get multishipping checkout model * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function getCheckout() { diff --git a/app/code/Magento/Checkout/Block/Multishipping/Link.php b/app/code/Magento/Multishipping/Block/Checkout/Link.php similarity index 94% rename from app/code/Magento/Checkout/Block/Multishipping/Link.php rename to app/code/Magento/Multishipping/Block/Checkout/Link.php index 141d68e941c..3e905e54906 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Link.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Link.php @@ -27,7 +27,7 @@ /** * Multishipping cart link */ -namespace Magento\Checkout\Block\Multishipping; +namespace Magento\Multishipping\Block\Checkout; class Link extends \Magento\View\Element\Template { @@ -58,6 +58,7 @@ class Link extends \Magento\View\Element\Template $this->_checkoutData = $checkoutData; $this->_checkoutSession = $checkoutSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** @@ -65,7 +66,7 @@ class Link extends \Magento\View\Element\Template */ public function getCheckoutUrl() { - return $this->getUrl('checkout/multishipping', array('_secure'=>true)); + return $this->getUrl('multishipping/checkout', array('_secure'=>true)); } /** diff --git a/app/code/Magento/Checkout/Block/Multishipping/Overview.php b/app/code/Magento/Multishipping/Block/Checkout/Overview.php similarity index 93% rename from app/code/Magento/Checkout/Block/Multishipping/Overview.php rename to app/code/Magento/Multishipping/Block/Checkout/Overview.php index 9b569070834..9e1caad6699 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Overview.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Overview.php @@ -31,7 +31,7 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping; +namespace Magento\Multishipping\Block\Checkout; class Overview extends \Magento\Sales\Block\Items\AbstractItems { @@ -41,7 +41,7 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems const DEFAULT_TYPE = 'default'; /** - * @var \Magento\Checkout\Model\Type\Multishipping + * @var \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected $_multishipping; @@ -52,19 +52,20 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Checkout\Model\Type\Multishipping $multishipping + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param \Magento\Tax\Helper\Data $taxHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Checkout\Model\Type\Multishipping $multishipping, + \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, \Magento\Tax\Helper\Data $taxHelper, array $data = array() ) { $this->_taxHelper = $taxHelper; $this->_multishipping = $multishipping; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** @@ -77,7 +78,7 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems $this->addChild( $rowItemType, 'Magento\Checkout\Block\Cart\Item\Renderer', - array('template' => 'multishipping/overview/item.phtml') + array('template' => 'Magento_Multishipping::checkout/overview/item.phtml') ); } $headBlock = $this->getLayout()->getBlock('head'); @@ -92,7 +93,7 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems /** * Get multishipping checkout model * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function getCheckout() { @@ -243,7 +244,7 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems */ public function getEditShippingAddressUrl($address) { - return $this->getUrl('*/multishipping_address/editShipping', array('id'=>$address->getCustomerAddressId())); + return $this->getUrl('*/checkout_address/editShipping', array('id'=>$address->getCustomerAddressId())); } /** @@ -252,7 +253,7 @@ class Overview extends \Magento\Sales\Block\Items\AbstractItems */ public function getEditBillingAddressUrl($address) { - return $this->getUrl('*/multishipping_address/editBilling', array('id'=>$address->getCustomerAddressId())); + return $this->getUrl('*/checkout_address/editBilling', array('id'=>$address->getCustomerAddressId())); } /** diff --git a/app/code/Magento/Checkout/Block/Multishipping/Payment/Info.php b/app/code/Magento/Multishipping/Block/Checkout/Payment/Info.php similarity index 88% rename from app/code/Magento/Checkout/Block/Multishipping/Payment/Info.php rename to app/code/Magento/Multishipping/Block/Checkout/Payment/Info.php index b89d53e1310..35021a7c5dd 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Payment/Info.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Payment/Info.php @@ -31,25 +31,25 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping\Payment; +namespace Magento\Multishipping\Block\Checkout\Payment; class Info extends \Magento\Payment\Block\Info\AbstractContainer { /** - * @var \Magento\Checkout\Model\Type\Multishipping + * @var \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected $_multishipping; /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Checkout\Model\Type\Multishipping $multishipping + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Payment\Helper\Data $paymentData, - \Magento\Checkout\Model\Type\Multishipping $multishipping, + \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, array $data = array() ) { $this->_multishipping = $multishipping; diff --git a/app/code/Magento/Checkout/Block/Multishipping/Shipping.php b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php similarity index 86% rename from app/code/Magento/Checkout/Block/Multishipping/Shipping.php rename to app/code/Magento/Multishipping/Block/Checkout/Shipping.php index 2c8cf055332..1325daba0e8 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Shipping.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Shipping.php @@ -31,7 +31,7 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping; +namespace Magento\Multishipping\Block\Checkout; class Shipping extends \Magento\Sales\Block\Items\AbstractItems { @@ -48,14 +48,14 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Filter\Object\GridFactory $filterGridFactory - * @param \Magento\Checkout\Model\Type\Multishipping $multishipping + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param \Magento\Tax\Helper\Data $taxHelper * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, \Magento\Filter\Object\GridFactory $filterGridFactory, - \Magento\Checkout\Model\Type\Multishipping $multishipping, + \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, \Magento\Tax\Helper\Data $taxHelper, array $data = array() ) { @@ -63,12 +63,13 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems $this->_filterGridFactory = $filterGridFactory; $this->_multishipping = $multishipping; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** * Get multishipping checkout model * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function getCheckout() { @@ -134,7 +135,7 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems public function getAddressEditUrl($address) { - return $this->getUrl('*/multishipping_address/editShipping', array('id'=>$address->getCustomerAddressId())); + return $this->getUrl('*/checkout_address/editShipping', array('id'=>$address->getCustomerAddressId())); } public function getItemsEditUrl() @@ -156,4 +157,17 @@ class Shipping extends \Magento\Sales\Block\Items\AbstractItems { return $address->getQuote()->getStore()->convertPrice($this->_taxHelper->getShippingPrice($price, $flag, $address), true); } + + /** + * Retrieve text for items box + * + * @param \Magento\Object $addressEntity + * @return string + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function getItemsBoxTextAfter(\Magento\Object $addressEntity) + { + return ''; + } } diff --git a/app/code/Magento/Checkout/Block/Multishipping/State.php b/app/code/Magento/Multishipping/Block/Checkout/State.php similarity index 84% rename from app/code/Magento/Checkout/Block/Multishipping/State.php rename to app/code/Magento/Multishipping/Block/Checkout/State.php index 209f7145527..75aed072f01 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/State.php +++ b/app/code/Magento/Multishipping/Block/Checkout/State.php @@ -31,23 +31,23 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping; +namespace Magento\Multishipping\Block\Checkout; class State extends \Magento\View\Element\Template { /** - * @var \Magento\Checkout\Model\Type\Multishipping\State + * @var \Magento\Multishipping\Model\Checkout\Type\Multishipping\State */ protected $_multishippingState; /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Checkout\Model\Type\Multishipping\State $multishippingState + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping\State $multishippingState * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Checkout\Model\Type\Multishipping\State $multishippingState, + \Magento\Multishipping\Model\Checkout\Type\Multishipping\State $multishippingState, array $data = array() ) { $this->_multishippingState = $multishippingState; diff --git a/app/code/Magento/Checkout/Block/Multishipping/Success.php b/app/code/Magento/Multishipping/Block/Checkout/Success.php similarity index 87% rename from app/code/Magento/Checkout/Block/Multishipping/Success.php rename to app/code/Magento/Multishipping/Block/Checkout/Success.php index 5f27e8d0f9d..da4cb2c1d35 100644 --- a/app/code/Magento/Checkout/Block/Multishipping/Success.php +++ b/app/code/Magento/Multishipping/Block/Checkout/Success.php @@ -31,21 +31,22 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Block\Multishipping; +namespace Magento\Multishipping\Block\Checkout; -class Success extends \Magento\Checkout\Block\Multishipping\AbstractMultishipping +class Success extends \Magento\Multishipping\Block\Checkout\AbstractMultishipping { /** * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Checkout\Model\Type\Multishipping $multishipping + * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping * @param array $data */ public function __construct( \Magento\View\Element\Template\Context $context, - \Magento\Checkout\Model\Type\Multishipping $multishipping, + \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, array $data = array() ) { parent::__construct($context, $multishipping, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Checkout/Controller/Multishipping.php b/app/code/Magento/Multishipping/Controller/Checkout.php similarity index 82% rename from app/code/Magento/Checkout/Controller/Multishipping.php rename to app/code/Magento/Multishipping/Controller/Checkout.php index c51a1d2ec7a..b63b4d91fe4 100644 --- a/app/code/Magento/Checkout/Controller/Multishipping.php +++ b/app/code/Magento/Multishipping/Controller/Checkout.php @@ -29,41 +29,42 @@ * * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Controller; +namespace Magento\Multishipping\Controller; use Magento\App\Action\NotFoundException; use Magento\App\RequestInterface; +use Magento\Multishipping\Model\Checkout\Type\Multishipping\State; -class Multishipping extends \Magento\Checkout\Controller\Action +class Checkout extends \Magento\Checkout\Controller\Action { /** * Retrieve checkout model * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected function _getCheckout() { - return $this->_objectManager->get('Magento\Checkout\Model\Type\Multishipping'); + return $this->_objectManager->get('Magento\Multishipping\Model\Checkout\Type\Multishipping'); } /** * Retrieve checkout state model * - * @return \Magento\Checkout\Model\Type\Multishipping\State + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping\State */ protected function _getState() { - return $this->_objectManager->get('Magento\Checkout\Model\Type\Multishipping\State'); + return $this->_objectManager->get('Magento\Multishipping\Model\Checkout\Type\Multishipping\State'); } /** * Retrieve checkout url helper * - * @return \Magento\Checkout\Helper\Url + * @return \Magento\Multishipping\Helper\Url */ protected function _getHelper() { - return $this->_objectManager->get('Magento\Checkout\Helper\Url'); + return $this->_objectManager->get('Magento\Multishipping\Helper\Url'); } /** @@ -229,17 +230,13 @@ class Multishipping extends \Magento\Checkout\Controller\Action { // If customer do not have addresses if (!$this->_getCheckout()->getCustomerDefaultShippingAddress()) { - $this->_redirect('*/multishipping_address/newShipping'); + $this->_redirect('*/checkout_address/newShipping'); return; } - $this->_getState()->unsCompleteStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING - ); + $this->_getState()->unsCompleteStep(State::STEP_SHIPPING); - $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SELECT_ADDRESSES - ); + $this->_getState()->setActiveStep(State::STEP_SELECT_ADDRESSES); if (!$this->_getCheckout()->validateMinimumAmount()) { $message = $this->_getCheckout()->getMinimumAmountDescription(); $this->messageManager->addNotice($message); @@ -255,21 +252,17 @@ class Multishipping extends \Magento\Checkout\Controller\Action public function addressesPostAction() { if (!$this->_getCheckout()->getCustomerDefaultShippingAddress()) { - $this->_redirect('*/multishipping_address/newShipping'); + $this->_redirect('*/checkout_address/newShipping'); return; } try { if ($this->getRequest()->getParam('continue', false)) { $this->_getCheckout()->setCollectRatesFlag(true); - $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING - ); - $this->_getState()->setCompleteStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SELECT_ADDRESSES - ); + $this->_getState()->setActiveStep(State::STEP_SHIPPING); + $this->_getState()->setCompleteStep(State::STEP_SELECT_ADDRESSES); $this->_redirect('*/*/shipping'); } elseif ($this->getRequest()->getParam('new_address')) { - $this->_redirect('*/multishipping_address/newShipping'); + $this->_redirect('*/checkout_address/newShipping'); } else { $this->_redirect('*/*/addresses'); } @@ -290,12 +283,8 @@ class Multishipping extends \Magento\Checkout\Controller\Action public function backToAddressesAction() { - $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SELECT_ADDRESSES - ); - $this->_getState()->unsCompleteStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING - ); + $this->_getState()->setActiveStep(State::STEP_SELECT_ADDRESSES); + $this->_getState()->unsCompleteStep(State::STEP_SHIPPING); $this->_redirect('*/*/addresses'); } @@ -338,13 +327,11 @@ class Multishipping extends \Magento\Checkout\Controller\Action return; } - if (!$this->_getState()->getCompleteStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_SELECT_ADDRESSES)) { + if (!$this->_getState()->getCompleteStep(State::STEP_SELECT_ADDRESSES)) { return $this->_redirect('*/*/addresses'); } - $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING - ); + $this->_getState()->setActiveStep(State::STEP_SHIPPING); $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); @@ -352,12 +339,8 @@ class Multishipping extends \Magento\Checkout\Controller\Action public function backToShippingAction() { - $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING - ); - $this->_getState()->unsCompleteStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_BILLING - ); + $this->_getState()->setActiveStep(State::STEP_SHIPPING); + $this->_getState()->unsCompleteStep(State::STEP_BILLING); $this->_redirect('*/*/shipping'); } @@ -370,12 +353,8 @@ class Multishipping extends \Magento\Checkout\Controller\Action array('request'=>$this->getRequest(), 'quote'=>$this->_getCheckout()->getQuote()) ); $this->_getCheckout()->setShippingMethods($shippingMethods); - $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_BILLING - ); - $this->_getState()->setCompleteStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING - ); + $this->_getState()->setActiveStep(State::STEP_BILLING); + $this->_getState()->setCompleteStep(State::STEP_SHIPPING); $this->_redirect('*/*/billing'); } catch (\Exception $e) { $this->messageManager->addError($e->getMessage()); @@ -396,13 +375,11 @@ class Multishipping extends \Magento\Checkout\Controller\Action return; } - if (!$this->_getState()->getCompleteStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING)) { + if (!$this->_getState()->getCompleteStep(State::STEP_SHIPPING)) { return $this->_redirect('*/*/shipping'); } - $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_BILLING - ); + $this->_getState()->setActiveStep(State::STEP_BILLING); $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); @@ -417,7 +394,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action protected function _validateBilling() { if (!$this->_getCheckout()->getQuote()->getBillingAddress()->getFirstname()) { - $this->_redirect('*/multishipping_address/selectBilling'); + $this->_redirect('*/checkout_address/selectBilling'); return false; } return true; @@ -428,12 +405,8 @@ class Multishipping extends \Magento\Checkout\Controller\Action */ public function backToBillingAction() { - $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_BILLING - ); - $this->_getState()->unsCompleteStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_OVERVIEW - ); + $this->_getState()->setActiveStep(State::STEP_BILLING); + $this->_getState()->unsCompleteStep(State::STEP_OVERVIEW); $this->_redirect('*/*/billing'); } @@ -446,7 +419,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action return; } - $this->_getState()->setActiveStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_OVERVIEW); + $this->_getState()->setActiveStep(State::STEP_OVERVIEW); try { $payment = $this->getRequest()->getPost('payment', array()); @@ -457,9 +430,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action | \Magento\Payment\Model\Method\AbstractMethod::CHECK_ZERO_TOTAL; $this->_getCheckout()->setPaymentMethod($payment); - $this->_getState()->setCompleteStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_BILLING - ); + $this->_getState()->setCompleteStep(State::STEP_BILLING); $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); @@ -506,12 +477,8 @@ class Multishipping extends \Magento\Checkout\Controller\Action $paymentInstance->setCcCid($payment['cc_cid']); } $this->_getCheckout()->createOrders(); - $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_SUCCESS - ); - $this->_getState()->setCompleteStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_OVERVIEW - ); + $this->_getState()->setActiveStep(State::STEP_SUCCESS); + $this->_getState()->setCompleteStep(State::STEP_OVERVIEW); $this->_getCheckout()->getCheckoutSession()->clearQuote(); $this->_getCheckout()->getCheckoutSession()->setDisplaySuccess(true); $this->_redirect('*/*/success'); @@ -546,7 +513,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action */ public function successAction() { - if (!$this->_getState()->getCompleteStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_OVERVIEW)) { + if (!$this->_getState()->getCompleteStep(State::STEP_OVERVIEW)) { $this->_redirect('*/*/addresses'); return; } @@ -554,7 +521,7 @@ class Multishipping extends \Magento\Checkout\Controller\Action $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); $ids = $this->_getCheckout()->getOrderIds(); - $this->_eventManager->dispatch('checkout_multishipping_controller_success_action', array('order_ids' => $ids)); + $this->_eventManager->dispatch('multishipping_checkout_controller_success_action', array('order_ids' => $ids)); $this->_view->renderLayout(); } diff --git a/app/code/Magento/Checkout/Controller/Multishipping/Address.php b/app/code/Magento/Multishipping/Controller/Checkout/Address.php similarity index 84% rename from app/code/Magento/Checkout/Controller/Multishipping/Address.php rename to app/code/Magento/Multishipping/Controller/Checkout/Address.php index 36e2cd6a1e1..a54a0847a66 100644 --- a/app/code/Magento/Checkout/Controller/Multishipping/Address.php +++ b/app/code/Magento/Multishipping/Controller/Checkout/Address.php @@ -31,28 +31,28 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Controller\Multishipping; +namespace Magento\Multishipping\Controller\Checkout; class Address extends \Magento\App\Action\Action { /** * Retrieve multishipping checkout model * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected function _getCheckout() { - return $this->_objectManager->get('Magento\Checkout\Model\Type\Multishipping'); + return $this->_objectManager->get('Magento\Multishipping\Model\Checkout\Type\Multishipping'); } /** * Retrieve checkout state model * - * @return \Magento\Checkout\Model\Type\Multishipping\State + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping\State */ protected function _getState() { - return $this->_objectManager->get('Magento\Checkout\Model\Type\Multishipping\State'); + return $this->_objectManager->get('Magento\Multishipping\Model\Checkout\Type\Multishipping\State'); } @@ -61,7 +61,9 @@ class Address extends \Magento\App\Action\Action */ public function newShippingAction() { - $this->_getState()->setActiveStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_SELECT_ADDRESSES); + $this->_getState()->setActiveStep( + \Magento\Multishipping\Model\Checkout\Type\Multishipping\State::STEP_SELECT_ADDRESSES + ); $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); if ($addressForm = $this->_view->getLayout()->getBlock('customer_address_edit')) { @@ -74,7 +76,7 @@ class Address extends \Magento\App\Action\Action } if ($this->_getCheckout()->getCustomerDefaultShippingAddress()) { - $addressForm->setBackUrl($this->_url->getUrl('*/multishipping/addresses')); + $addressForm->setBackUrl($this->_url->getUrl('*/checkout/addresses')); } else { $addressForm->setBackUrl($this->_url->getUrl('*/cart/')); } @@ -90,12 +92,14 @@ class Address extends \Magento\App\Action\Action if (count($this->_getCheckout()->getCustomer()->getAddresses()) == 1) { $this->_getCheckout()->reset(); } - $this->_redirect('*/multishipping/addresses'); + $this->_redirect('*/checkout/addresses'); } public function editShippingAction() { - $this->_getState()->setActiveStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_SHIPPING); + $this->_getState()->setActiveStep( + \Magento\Multishipping\Model\Checkout\Type\Multishipping\State::STEP_SHIPPING + ); $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); if ($addressForm = $this->_view->getLayout()->getBlock('customer_address_edit')) { @@ -117,7 +121,7 @@ class Address extends \Magento\App\Action\Action public function editShippingPostAction() { if ($addressId = $this->getRequest()->getParam('id')) { - $this->_objectManager->create('Magento\Checkout\Model\Type\Multishipping') + $this->_objectManager->create('Magento\Multishipping\Model\Checkout\Type\Multishipping') ->updateQuoteCustomerShippingAddress($addressId); } $this->_redirect('*/multishipping/shipping'); @@ -125,7 +129,7 @@ class Address extends \Magento\App\Action\Action public function selectBillingAction() { - $this->_getState()->setActiveStep(\Magento\Checkout\Model\Type\Multishipping\State::STEP_BILLING); + $this->_getState()->setActiveStep(\Magento\Multishipping\Model\Checkout\Type\Multishipping\State::STEP_BILLING); $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); @@ -168,7 +172,7 @@ class Address extends \Magento\App\Action\Action public function editBillingAction() { $this->_getState()->setActiveStep( - \Magento\Checkout\Model\Type\Multishipping\State::STEP_BILLING + \Magento\Multishipping\Model\Checkout\Type\Multishipping\State::STEP_BILLING ); $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); @@ -187,7 +191,7 @@ class Address extends \Magento\App\Action\Action public function setBillingAction() { if ($addressId = $this->getRequest()->getParam('id')) { - $this->_objectManager->create('Magento\Checkout\Model\Type\Multishipping') + $this->_objectManager->create('Magento\Multishipping\Model\Checkout\Type\Multishipping') ->setQuoteCustomerBillingAddress($addressId); } $this->_redirect('*/multishipping/billing'); @@ -196,7 +200,7 @@ class Address extends \Magento\App\Action\Action public function saveBillingAction() { if ($addressId = $this->getRequest()->getParam('id')) { - $this->_objectManager->create('Magento\Checkout\Model\Type\Multishipping') + $this->_objectManager->create('Magento\Multishipping\Model\Checkout\Type\Multishipping') ->setQuoteCustomerBillingAddress($addressId); } $this->_redirect('*/multishipping/overview'); diff --git a/app/code/Magento/Multishipping/Helper/Url.php b/app/code/Magento/Multishipping/Helper/Url.php new file mode 100644 index 00000000000..5b7e663dba2 --- /dev/null +++ b/app/code/Magento/Multishipping/Helper/Url.php @@ -0,0 +1,95 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Checkout + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * Multi Shipping urls helper + * + * @author Magento Core Team <core@magentocommerce.com> + */ +namespace Magento\Multishipping\Helper; + +class Url extends \Magento\Core\Helper\Url +{ + /** + * Retrieve shopping cart url + * + * @return string + */ + public function getCartUrl() + { + return $this->_getUrl('checkout/cart'); + } + + /** + * Retrieve checkout url + * + * @return string + */ + public function getMSCheckoutUrl() + { + return $this->_getUrl('multishipping/checkout'); + } + + /** + * Retrieve login url + * + * @return string + */ + public function getMSLoginUrl() + { + return $this->_getUrl('multishipping/checkout/login', array('_secure' => true, '_current' => true)); + } + + /** + * Retrieve address url + * + * @return string + */ + public function getMSAddressesUrl() + { + return $this->_getUrl('multishipping/checkout/addresses'); + } + + /** + * Retrieve shipping address save url + * + * @return string + */ + public function getMSShippingAddressSavedUrl() + { + return $this->_getUrl('multishipping/checkout_address/shippingSaved'); + } + + /** + * Retrieve register url + * + * @return string + */ + public function getMSRegisterUrl() + { + return $this->_getUrl('multishipping/checkout/register'); + } +} diff --git a/app/code/Magento/Checkout/Model/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php similarity index 96% rename from app/code/Magento/Checkout/Model/Type/Multishipping.php rename to app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index 2cb1c4a7182..27a560705c8 100644 --- a/app/code/Magento/Checkout/Model/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -31,7 +31,7 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Model\Type; +namespace Magento\Multishipping\Model\Checkout\Type; class Multishipping extends \Magento\Checkout\Model\Type\AbstractType { @@ -114,7 +114,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * Initialize multishipping checkout. * Split virtual/not virtual items between default billing/shipping addresses * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected function _init() { @@ -218,7 +218,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * * @param int $addressId * @param int $itemId - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function removeAddressItem($addressId, $itemId) { @@ -269,7 +269,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * ) * * @param array $info - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping * @throws \Magento\Core\Exception */ public function setShippingItemsInformation($info) @@ -352,7 +352,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * * @param int $quoteItemId * @param array $data array('qty'=>$qty, 'address'=>$customerAddressId) - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected function _addShippingItem($quoteItemId, $data) { @@ -397,7 +397,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * Reimport customer address info to quote shipping address * * @param int $addressId customer address id - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function updateQuoteCustomerShippingAddress($addressId) { @@ -416,7 +416,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * Reimport customer billing address to quote * * @param int $addressId customer address id - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function setQuoteCustomerBillingAddress($addressId) { @@ -434,7 +434,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * Assign shipping methods to addresses * * @param array $methods - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping * @throws \Magento\Core\Exception */ public function setShippingMethods($methods) @@ -455,7 +455,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * Set payment method info to quote payment * * @param array $payment - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping * @throws \Magento\Core\Exception */ public function setPaymentMethod($payment) @@ -527,7 +527,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType /** * Validate quote data * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping * @throws \Magento\Core\Exception */ protected function _validate() @@ -565,7 +565,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType /** * Create orders per each quote address * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping * @throws \Exception */ public function createOrders() @@ -618,7 +618,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType /** * Collect quote totals and save quote object * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function save() { @@ -630,7 +630,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType /** * Specify BEGIN state in checkout session whot allow reinit multishipping checkout * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function reset() { diff --git a/app/code/Magento/Checkout/Model/Type/Multishipping/State.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/State.php similarity index 92% rename from app/code/Magento/Checkout/Model/Type/Multishipping/State.php rename to app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/State.php index f771662450c..0f4888bd0e7 100644 --- a/app/code/Magento/Checkout/Model/Type/Multishipping/State.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/State.php @@ -31,7 +31,7 @@ * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Checkout\Model\Type\Multishipping; +namespace Magento\Multishipping\Model\Checkout\Type\Multishipping; class State extends \Magento\Object { @@ -51,7 +51,7 @@ class State extends \Magento\Object /** * Checkout model * - * @var \Magento\Checkout\Model\Type\Multishipping + * @var \Magento\Multishipping\Model\Checkout\Type\Multishipping */ protected $_multishipping; @@ -66,7 +66,7 @@ class State extends \Magento\Object */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Checkout\Model\Type\Multishipping $multishipping + \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping ) { $this->_checkoutSession = $checkoutSession; $this->_multishipping = $multishipping; @@ -98,7 +98,7 @@ class State extends \Magento\Object /** * Retrieve checkout model * - * @return \Magento\Checkout\Model\Type\Multishipping + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping */ public function getCheckout() { @@ -152,7 +152,7 @@ class State extends \Magento\Object * Mark step as completed * * @param string $step - * @return \Magento\Checkout\Model\Type\Multishipping\State + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping\State */ public function setCompleteStep($step) { @@ -180,7 +180,7 @@ class State extends \Magento\Object * Unset complete status from step * * @param string $step - * @return \Magento\Checkout\Model\Type\Multishipping\State + * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping\State */ public function unsCompleteStep($step) { diff --git a/app/code/Magento/Paygate/etc/adminhtml/di.xml b/app/code/Magento/Multishipping/etc/frontend/di.xml similarity index 81% rename from app/code/Magento/Paygate/etc/adminhtml/di.xml rename to app/code/Magento/Multishipping/etc/frontend/di.xml index 1bb666a12b6..b8ee929ff00 100644 --- a/app/code/Magento/Paygate/etc/adminhtml/di.xml +++ b/app/code/Magento/Multishipping/etc/frontend/di.xml @@ -24,9 +24,11 @@ */ --> <config> - <type name="Magento\Paygate\Model\Authorizenet"> - <param name="session"> - <instance type="Magento\Backend\Model\Session\Quote" /> + <type name="Magento\Core\Model\Url\SecurityInfo"> + <param name="secureUrlList"> + <value> + <multishipping_checkout>/multishipping/checkout</multishipping_checkout> + </value> </param> </type> </config> diff --git a/app/code/Magento/Multishipping/etc/frontend/page_types.xml b/app/code/Magento/Multishipping/etc/frontend/page_types.xml new file mode 100644 index 00000000000..77eaed71dc4 --- /dev/null +++ b/app/code/Magento/Multishipping/etc/frontend/page_types.xml @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<page_types> + <type id="checkout_cart_multishipping" label="Catalog Quick Search Form Suggestions"/> + <type id="checkout_cart_multishipping_address_editaddress" label="Multishipping Checkout One Address Edit Form"/> + <type id="checkout_cart_multishipping_address_editbilling" label="Multishipping Checkout Billing Address Edit Form"/> + <type id="checkout_cart_multishipping_address_editshipping" label="Multishipping Checkout Shipping Address Edit Form"/> + <type id="checkout_cart_multishipping_address_newbilling" label="Multishipping Checkout Billing Address Creation"/> + <type id="checkout_cart_multishipping_address_newshipping" label="Multishipping Checkout Shipping Address Creation"/> + <type id="checkout_cart_multishipping_address_selectbilling" label="Multishipping Checkout Billing Address Selection"/> + <type id="checkout_cart_multishipping_addresses" label="Multishipping Checkout Address (Any) Form"/> + <type id="checkout_cart_multishipping_billing" label="Multishipping Checkout Billing Information Step"/> + <type id="checkout_cart_multishipping_customer_address" label="Multishipping Checkout Customer Address Edit Form"/> + <type id="checkout_cart_multishipping_login" label="Multishipping Checkout Login User Form"/> + <type id="checkout_cart_multishipping_overview" label="Multishipping Checkout Overview"/> + <type id="checkout_cart_multishipping_register" label="Multishipping Checkout Register User Form"/> + <type id="checkout_cart_multishipping_shipping" label="Multishipping Checkout Shipping Information Step"/> + <type id="checkout_cart_multishipping_success" label="Multishipping Checkout Success"/> +</page_types> diff --git a/app/code/Magento/Paygate/etc/frontend/routes.xml b/app/code/Magento/Multishipping/etc/frontend/routes.xml similarity index 89% rename from app/code/Magento/Paygate/etc/frontend/routes.xml rename to app/code/Magento/Multishipping/etc/frontend/routes.xml index 529aced7490..66c9077ab97 100644 --- a/app/code/Magento/Paygate/etc/frontend/routes.xml +++ b/app/code/Magento/Multishipping/etc/frontend/routes.xml @@ -25,8 +25,8 @@ --> <config> <router id="standard"> - <route id="paygate" frontName="paygate"> - <module name="Magento_Paygate" /> + <route id="multishipping" frontName="multishipping"> + <module name="Magento_Multishipping"/> </route> </router> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/Paygate/etc/module.xml b/app/code/Magento/Multishipping/etc/module.xml old mode 100755 new mode 100644 similarity index 80% rename from app/code/Magento/Paygate/etc/module.xml rename to app/code/Magento/Multishipping/etc/module.xml index 7cee8faf7a5..be22fcbcb2d --- a/app/code/Magento/Paygate/etc/module.xml +++ b/app/code/Magento/Multishipping/etc/module.xml @@ -24,17 +24,19 @@ */ --> <config> - <module name="Magento_Paygate" version="1.6.0.0" active="true"> + <module name="Magento_Multishipping" version="2.0.0.0" active="true"> <sequence> - <module name="Magento_Payment"/> + <module name="Magento_Core"/> + <module name="Magento_Catalog"/> </sequence> <depends> - <module name="Magento_Payment"/> <module name="Magento_Core"/> <module name="Magento_Checkout"/> - <module name="Magento_Backend"/> <module name="Magento_Sales"/> - <module name="Magento_Centinel"/> + <module name="Magento_Payment"/> + <module name="Magento_Tax"/> + <module name="Magento_Customer"/> + <module name="Magento_Weee"/> </depends> </module> </config> diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/address/select.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml similarity index 100% rename from app/code/Magento/Checkout/view/frontend/multishipping/address/select.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/address/select.phtml diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/addresses.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/addresses.phtml similarity index 96% rename from app/code/Magento/Checkout/view/frontend/multishipping/addresses.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/addresses.phtml index 202d2a5fd12..eb1d010e731 100644 --- a/app/code/Magento/Checkout/view/frontend/multishipping/addresses.phtml +++ b/app/code/Magento/Multishipping/view/frontend/checkout/addresses.phtml @@ -26,7 +26,7 @@ /** * Ship to multiple address template * - * @var $this \Magento\Checkout\Block\Multishipping\Addresses + * @var $this \Magento\Multishipping\Block\Checkout\Addresses */ ?> <form id="checkout_multishipping_form" action="<?php echo $this->getPostActionUrl() ?>" method="post" class="multicheckout address form"> @@ -87,7 +87,7 @@ "<?php echo $this->getViewFileUrl('jquery/jquery.metadata.js') ?>", "<?php echo $this->getViewFileUrl('mage/validation.js')?>", "<?php echo $this->getViewFileUrl('mage/validation/validation.js') ?>", - "<?php echo $this->getViewFileUrl('Magento_Checkout::js/multi-shipping.js') ?>", + "<?php echo $this->getViewFileUrl('Magento_Multishipping::js/multi-shipping.js') ?>", function () { jQuery('#checkout_multishipping_form').multiShipping().validation(); } diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/billing.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/billing.phtml similarity index 98% rename from app/code/Magento/Checkout/view/frontend/multishipping/billing.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/billing.phtml index 8cd62bb5fe4..a84c1ceade9 100644 --- a/app/code/Magento/Checkout/view/frontend/multishipping/billing.phtml +++ b/app/code/Magento/Multishipping/view/frontend/checkout/billing.phtml @@ -26,7 +26,7 @@ /** * Multishipping checkout billing information * - * @var $this \Magento\Checkout\Block\Multishipping\Billing + * @var $this \Magento\Multishipping\Block\Checkout\Billing */ ?> <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="multishipping-billing-form" class="form multicheckout billing"> diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/billing/items.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/billing/items.phtml similarity index 100% rename from app/code/Magento/Checkout/view/frontend/multishipping/billing/items.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/billing/items.phtml diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/item/default.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/item/default.phtml similarity index 100% rename from app/code/Magento/Checkout/view/frontend/multishipping/item/default.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/item/default.phtml diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/link.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/link.phtml similarity index 100% rename from app/code/Magento/Checkout/view/frontend/multishipping/link.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/link.phtml diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/overview.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/overview.phtml similarity index 99% rename from app/code/Magento/Checkout/view/frontend/multishipping/overview.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/overview.phtml index 3f85335afdd..bf9a1aec575 100644 --- a/app/code/Magento/Checkout/view/frontend/multishipping/overview.phtml +++ b/app/code/Magento/Multishipping/view/frontend/checkout/overview.phtml @@ -23,7 +23,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php /** @var $this \Magento\Checkout\Block\Multishipping\Overview */ ?> +<?php /** @var $this \Magento\Multishipping\Block\Checkout\Overview */ ?> <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="review-order-form" class="form multicheckout overview"> <div class="block billing"> <div class="title"><strong><?php echo __('Billing Information') ?></strong></div> diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/overview/item.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/overview/item.phtml similarity index 100% rename from app/code/Magento/Checkout/view/frontend/multishipping/overview/item.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/overview/item.phtml diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/shipping.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/shipping.phtml similarity index 95% rename from app/code/Magento/Checkout/view/frontend/multishipping/shipping.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/shipping.phtml index f0ff80d5e6e..41684a6dc26 100644 --- a/app/code/Magento/Checkout/view/frontend/multishipping/shipping.phtml +++ b/app/code/Magento/Multishipping/view/frontend/checkout/shipping.phtml @@ -26,7 +26,7 @@ /** * Multishipping checkout shipping template * - * @var $this \Magento\Checkout\Block\Multishipping\Shipping + * @var $this \Magento\Multishipping\Block\Checkout\Shipping */ ?> <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="shipping_method_form" class="form multicheckout shipping"> @@ -82,7 +82,6 @@ <?php endif; ?> </div> <div class="box items"> - <?php echo $this->helper('Magento\GiftMessage\Helper\Message')->getInline('multishipping_adress_checkbox', $_address); ?> <strong class="subtitle"> <span><?php echo __('Items') ?></span> <a href="<?php echo $this->getItemsEditUrl($_address) ?>" class="action edit"><span><?php echo __('Edit Items') ?></span></a> @@ -103,7 +102,7 @@ <?php endforeach; ?> </tbody> </table> - <?php echo $this->helper('Magento\GiftMessage\Helper\Message')->getInline('multishipping_address', $_address); ?> + <?php echo $this->getItemsBoxTextAfter($_address); ?> </div> </div> </div> diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/state.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/state.phtml similarity index 96% rename from app/code/Magento/Checkout/view/frontend/multishipping/state.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/state.phtml index 14dcad6c94c..067e0d8a7b6 100644 --- a/app/code/Magento/Checkout/view/frontend/multishipping/state.phtml +++ b/app/code/Magento/Multishipping/view/frontend/checkout/state.phtml @@ -28,7 +28,7 @@ /** * Mustishipping state * - * @see \Magento\Checkout\Block\Multishipping\State + * @see \Magento\Multishipping\Block\Checkout\State */ ?> <ol class="block multicheckout progress items" id="checkout-progress-state"> diff --git a/app/code/Magento/Checkout/view/frontend/multishipping/success.phtml b/app/code/Magento/Multishipping/view/frontend/checkout/success.phtml similarity index 100% rename from app/code/Magento/Checkout/view/frontend/multishipping/success.phtml rename to app/code/Magento/Multishipping/view/frontend/checkout/success.phtml diff --git a/app/code/Magento/Checkout/view/frontend/js/multi-shipping.js b/app/code/Magento/Multishipping/view/frontend/js/multi-shipping.js similarity index 100% rename from app/code/Magento/Checkout/view/frontend/js/multi-shipping.js rename to app/code/Magento/Multishipping/view/frontend/js/multi-shipping.js diff --git a/app/code/Magento/PageCache/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Multishipping/view/frontend/layout/checkout_cart_index.xml similarity index 84% rename from app/code/Magento/PageCache/view/frontend/layout/catalog_product_view.xml rename to app/code/Magento/Multishipping/view/frontend/layout/checkout_cart_index.xml index c4d9742b97b..7bad4250927 100644 --- a/app/code/Magento/PageCache/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/checkout_cart_index.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceContainer name="page.bottom"> - <block class="Magento\View\Element\Template" name="external.pagecache.cookie" template="Magento_PageCache::cookie.phtml"/> + <referenceContainer name="checkout.cart.methods"> + <block class="Magento\Multishipping\Block\Checkout\Link" name="checkout.cart.methods.multishipping" template="checkout/link.phtml"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout.xml similarity index 90% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout.xml index d8baa137e41..6a07a5c304f 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout.xml @@ -26,6 +26,6 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Multishipping Checkout" design_abstraction="custom"> <update handle="page_two_columns_left"/> <referenceContainer name="left"> - <block class="Magento\Checkout\Block\Multishipping\State" name="checkout_state" template="multishipping/state.phtml"/> + <block class="Magento\Multishipping\Block\Checkout\State" name="checkout_state" template="checkout/state.phtml"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_editaddress.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_editaddress.xml similarity index 91% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_editaddress.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_editaddress.xml index 3387898cbb9..e97d42cf895 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_editaddress.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_editaddress.xml @@ -24,8 +24,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> - <update handle="checkout_multishipping_customer_address"/> + <update handle="multishipping_checkout"/> + <update handle="multishipping_checkout_customer_address"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="label" xsi:type="string">Edit Address</argument> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_editbilling.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_editbilling.xml similarity index 91% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_editbilling.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_editbilling.xml index 69101b24651..13e5e34cc79 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_editbilling.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_editbilling.xml @@ -24,8 +24,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> - <update handle="checkout_multishipping_customer_address"/> + <update handle="multishipping_checkout"/> + <update handle="multishipping_checkout_customer_address"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="label" xsi:type="string">Change Billing Address</argument> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_editshipping.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_editshipping.xml similarity index 91% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_editshipping.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_editshipping.xml index 2be647bbebc..4fb6e592480 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_editshipping.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_editshipping.xml @@ -24,8 +24,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> - <update handle="checkout_multishipping_customer_address"/> + <update handle="multishipping_checkout"/> + <update handle="multishipping_checkout_customer_address"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="label" xsi:type="string">Edit Shipping Address</argument> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_newbilling.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_newbilling.xml similarity index 91% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_newbilling.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_newbilling.xml index efc3993ba56..6de50272418 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_newbilling.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_newbilling.xml @@ -24,8 +24,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> - <update handle="checkout_multishipping_customer_address"/> + <update handle="multishipping_checkout"/> + <update handle="multishipping_checkout_customer_address"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="label" xsi:type="string">Create Billing Address</argument> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_newshipping.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_newshipping.xml similarity index 91% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_newshipping.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_newshipping.xml index ccb46c73aa7..6e4075e3d0d 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_newshipping.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_newshipping.xml @@ -24,8 +24,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> - <update handle="checkout_multishipping_customer_address"/> + <update handle="multishipping_checkout"/> + <update handle="multishipping_checkout_customer_address"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="label" xsi:type="string">Create Shipping Address</argument> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_select.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_select.xml similarity index 84% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_select.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_select.xml index c5fe4930435..5ba9cf9215e 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_select.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_select.xml @@ -24,8 +24,8 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Multishipping Checkout Shipping Address Selection" design_abstraction="custom"> - <update handle="checkout_multishipping"/> + <update handle="multishipping_checkout"/> <referenceContainer name="content"> - <block class="Magento\Checkout\Block\Multishipping\Address\Select" name="checkout_address_select" template="multishipping/address/select.phtml" cacheable="false"/> + <block class="Magento\Multishipping\Block\Checkout\Address\Select" name="checkout_address_select" template="checkout/address/select.phtml" cacheable="false"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_selectbilling.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_selectbilling.xml similarity index 85% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_selectbilling.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_selectbilling.xml index c5aa54a45f9..343aa739a58 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_address_selectbilling.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_address_selectbilling.xml @@ -24,13 +24,13 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> + <update handle="multishipping_checkout"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument name="label" translate="true" xsi:type="string">Change Billing Address</argument> </action> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Checkout\Block\Multishipping\Address\Select" name="checkout_address_select" template="multishipping/address/select.phtml" cacheable="false"/> + <block class="Magento\Multishipping\Block\Checkout\Address\Select" name="checkout_address_select" template="checkout/address/select.phtml" cacheable="false"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_addresses.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_addresses.xml similarity index 77% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_addresses.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_addresses.xml index 6df01b9e51b..1169fa4cb3a 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_addresses.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_addresses.xml @@ -24,17 +24,17 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> + <update handle="multishipping_checkout"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="label" xsi:type="string">Ship to Multiple Addresses</argument> </action> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Checkout\Block\Multishipping\Addresses" name="checkout_addresses" template="multishipping/addresses.phtml" cacheable="false"> - <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="multishipping/item/default.phtml" cacheable="false"/> + <block class="Magento\Multishipping\Block\Checkout\Addresses" name="checkout_addresses" template="checkout/addresses.phtml" cacheable="false"> + <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> </block> </referenceContainer> <block class="Magento\View\Element\Template" name="additional.product.info" template="Magento_Core::template.phtml"/> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_billing.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_billing.xml similarity index 90% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_billing.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_billing.xml index 78fa0930ea6..99c75c94652 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_billing.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_billing.xml @@ -24,14 +24,14 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> + <update handle="multishipping_checkout"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="label" xsi:type="string">Billing Information</argument> </action> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Checkout\Block\Multishipping\Billing" name="checkout_billing" template="multishipping/billing.phtml" cacheable="false"> + <block class="Magento\Multishipping\Block\Checkout\Billing" name="checkout_billing" template="checkout/billing.phtml" cacheable="false"> <action method="setMethodFormTemplate"> <argument name="method" xsi:type="string">purchaseorder</argument> <argument name="template" xsi:type="string">Magento_Payment::form/purchaseorder.phtml</argument> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_customer_address.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_customer_address.xml similarity index 100% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_customer_address.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_customer_address.xml diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_login.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_login.xml similarity index 100% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_login.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_login.xml diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_overview.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_overview.xml similarity index 75% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_overview.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_overview.xml index 1ed00cd9ce2..f52b3d6220b 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_overview.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_overview.xml @@ -24,20 +24,20 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> + <update handle="multishipping_checkout"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="label" xsi:type="string">Review Order</argument> </action> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Checkout\Block\Multishipping\Overview" name="checkout_overview" template="multishipping/overview.phtml" cacheable="false"> - <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="row-grouped" template="multishipping/overview/item.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="row-configurable" template="multishipping/overview/item.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Multishipping\Payment\Info" name="payment_info"> + <block class="Magento\Multishipping\Block\Checkout\Overview" name="checkout_overview" template="checkout/overview.phtml" cacheable="false"> + <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="row-grouped" template="Magento_Multishipping::checkout/overview/item.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="row-configurable" template="Magento_Multishipping::checkout/overview/item.phtml" cacheable="false"/> + <block class="Magento\Multishipping\Block\Checkout\Payment\Info" name="payment_info"> <action method="setInfoTemplate"> <argument name="method" xsi:type="string"/> <argument name="template" xsi:type="string"/> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_register.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_register.xml similarity index 100% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_register.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_register.xml diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_shipping.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_shipping.xml similarity index 66% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_shipping.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_shipping.xml index e06feab2fd5..ab98a3006c9 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_shipping.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_shipping.xml @@ -24,21 +24,21 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> + <update handle="multishipping_checkout"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="title" xsi:type="string">Shipping Information</argument> </action> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Checkout\Block\Multishipping\Shipping" name="checkout_shipping" template="multishipping/shipping.phtml" cacheable="false"> - <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Multishipping\Billing\Items" name="checkout_billing_items" template="multishipping/billing/items.phtml" cacheable="false"> - <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="multishipping/item/default.phtml" cacheable="false"/> - <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="multishipping/item/default.phtml" cacheable="false"/> + <block class="Magento\Multishipping\Block\Checkout\Shipping" name="checkout_shipping" template="checkout/shipping.phtml" cacheable="false"> + <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Multishipping\Block\Checkout\Billing\Items" name="checkout_billing_items" template="Magento_Multishipping::checkout/billing/items.phtml" cacheable="false"> + <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Grouped" as="grouped" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> + <block class="Magento\Checkout\Block\Cart\Item\Renderer\Configurable" as="configurable" template="Magento_Multishipping::checkout/item/default.phtml" cacheable="false"/> </block> </block> </referenceContainer> diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_success.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_success.xml similarity index 87% rename from app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_success.xml rename to app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_success.xml index b6d955c6428..3c977719cc1 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_multishipping_success.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_success.xml @@ -24,13 +24,13 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="checkout_multishipping"/> + <update handle="multishipping_checkout"/> <referenceBlock name="page.main.title"> <action method="setPageTitle"> <argument translate="true" name="title" xsi:type="string">Your order has been received.</argument> </action> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Checkout\Block\Multishipping\Success" name="checkout_success" template="multishipping/success.phtml" cacheable="false"/> + <block class="Magento\Multishipping\Block\Checkout\Success" name="checkout_success" template="checkout/success.phtml" cacheable="false"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Multishipping/view/frontend/multishipping/item/default.phtml b/app/code/Magento/Multishipping/view/frontend/multishipping/item/default.phtml new file mode 100644 index 00000000000..7708607582b --- /dev/null +++ b/app/code/Magento/Multishipping/view/frontend/multishipping/item/default.phtml @@ -0,0 +1,47 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category design + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +?> +<div class="product details"> + <strong class="product name"><a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a></strong> + <?php if ($_options = $this->getOptionList()): ?> + <dl class="item options"> + <?php foreach ($_options as $_option) : ?> + <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?> + <dt><?php echo $this->escapeHtml($_option['label']) ?></dt> + <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated" data-mage-init="{truncateOptions:[]}"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?> + <?php if (isset($_formatedOptionValue['full_view'])): ?> + <dl class="item options"> + <dt><?php echo $this->escapeHtml($_option['label']) ?></dt> + <dd><?php echo $_formatedOptionValue['full_view'] ?></dd> + </dl> + <?php endif; ?> + </dd> + <?php endforeach; ?> + </dl> + <?php endif; ?> + <?php if ($addtInfoBlock = $this->getProductAdditionalInformationBlock()): ?> + <?php echo $addtInfoBlock->setItem($this->getItem())->toHtml() ?> + <?php endif; ?> +</div> diff --git a/app/code/Magento/Newsletter/Block/Subscribe.php b/app/code/Magento/Newsletter/Block/Subscribe.php index 6f365290e03..4451b423089 100644 --- a/app/code/Magento/Newsletter/Block/Subscribe.php +++ b/app/code/Magento/Newsletter/Block/Subscribe.php @@ -55,6 +55,7 @@ class Subscribe extends \Magento\View\Element\Template ) { parent::__construct($context, $data); $this->_newsletterSession = $newsletterSession; + $this->_isScopePrivate = true; } public function getSuccessMessage() diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber.php index 1735bdb1359..3817fe028d5 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber.php @@ -82,7 +82,11 @@ class Subscriber extends \Magento\Backend\App\Action $fileName = 'subscribers.csv'; $content = $this->_view->getLayout()->getChildBlock('adminhtml.newslettrer.subscriber.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $content->getCsvFile($fileName), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create( + $fileName, + $content->getCsvFile($fileName), + \Magento\App\Filesystem::VAR_DIR + ); } /** @@ -93,7 +97,11 @@ class Subscriber extends \Magento\Backend\App\Action $this->_view->loadLayout(); $fileName = 'subscribers.xml'; $content = $this->_view->getLayout()->getChildBlock('adminhtml.newslettrer.subscriber.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $content->getExcelFile($fileName), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create( + $fileName, + $content->getExcelFile($fileName), + \Magento\App\Filesystem::VAR_DIR + ); } public function massUnsubscribeAction() diff --git a/app/code/Magento/Newsletter/etc/module.xml b/app/code/Magento/Newsletter/etc/module.xml index f4a73ca22da..ede53cc6925 100755 --- a/app/code/Magento/Newsletter/etc/module.xml +++ b/app/code/Magento/Newsletter/etc/module.xml @@ -36,6 +36,9 @@ <module name="Magento_Customer"/> <module name="Magento_Widget"/> <module name="Magento_Backend"/> + <module name="Magento_Cms"/> + <module name="Magento_Email"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Ogone/Block/Placeform.php b/app/code/Magento/Ogone/Block/Placeform.php index e8fb2b74b38..165e06a5bc0 100644 --- a/app/code/Magento/Ogone/Block/Placeform.php +++ b/app/code/Magento/Ogone/Block/Placeform.php @@ -61,6 +61,7 @@ class Placeform extends \Magento\View\Element\Template $this->_ogoneApi = $ogoneApi; $this->_salesOrderFactory = $salesOrderFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/PageCache/Controller/Adminhtml/PageCache.php b/app/code/Magento/PageCache/Controller/Adminhtml/PageCache.php deleted file mode 100644 index 4cc040404ae..00000000000 --- a/app/code/Magento/PageCache/Controller/Adminhtml/PageCache.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PageCache - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\PageCache\Controller\Adminhtml; - -/** - * Page cache admin controller - */ -class PageCache extends \Magento\Backend\App\Action -{ - /** - * Clean external cache action - * - * @return void - */ - public function cleanAction() - { - try { - $pageCacheData = $this->_objectManager->get('Magento\PageCache\Helper\Data'); - if ($pageCacheData->isEnabled()) { - $pageCacheData->getCacheControlInstance()->clean(); - $this->messageManager->addSuccess( - __('The external full page cache has been cleaned.') - ); - } - } catch (\Magento\Core\Exception $e) { - $this->messageManager->addError($e->getMessage()); - } catch (\Exception $e) { - $this->messageManager->addException( - $e, - __('Something went wrong while clearing the external full page cache.') - ); - } - $this->_redirect('adminhtml/cache/index'); - } - - /** - * Check current user permission on resource and privilege - * - * @return bool - */ - protected function _isAllowed() - { - return $this->_authorization->isAllowed('Magento_PageCache::page_cache'); - } -} diff --git a/app/code/Magento/PageCache/Helper/Data.php b/app/code/Magento/PageCache/Helper/Data.php index 7ea70ddd059..777d68e72b5 100644 --- a/app/code/Magento/PageCache/Helper/Data.php +++ b/app/code/Magento/PageCache/Helper/Data.php @@ -35,140 +35,5 @@ namespace Magento\PageCache\Helper; class Data extends \Magento\App\Helper\AbstractHelper { - /** - * Paths to external cache config options - */ - const XML_PATH_EXTERNAL_CACHE_ENABLED = 'system/external_page_cache/enabled'; - const XML_PATH_EXTERNAL_CACHE_LIFETIME = 'system/external_page_cache/cookie_lifetime'; - /** - * Cookie name for disabling external caching - */ - const NO_CACHE_COOKIE = 'external_no_cache'; - - /** - * Cookie name for locking the NO_CACHE_COOKIE for modification - */ - const NO_CACHE_LOCK_COOKIE = 'external_no_cache_cookie_locked'; - - /** - * @var bool - */ - protected $_isNoCacheCookieLocked = false; - - /** - * Core store config - * - * @var \Magento\Core\Model\Store\Config - */ - protected $_coreStoreConfig; - - /** - * @param \Magento\App\Helper\Context $context - * @param \Magento\PageCache\Model\CacheControlFactory $ccFactory - * @param \Magento\Stdlib\Cookie $cookie - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - */ - function __construct( - \Magento\App\Helper\Context $context, - \Magento\PageCache\Model\CacheControlFactory $ccFactory, - \Magento\Stdlib\Cookie $cookie, - \Magento\Core\Model\Store\Config $coreStoreConfig - ) { - parent::__construct($context); - $this->_coreStoreConfig = $coreStoreConfig; - $this->_isNoCacheCookieLocked = (bool)$cookie->get(self::NO_CACHE_LOCK_COOKIE); - $this->_cookie = $cookie; - $this->_ccFactory = $ccFactory; - } - - /** - * Check whether external cache is enabled - * - * @return bool - */ - public function isEnabled() - { - return (bool)$this->_coreStoreConfig->getConfig(self::XML_PATH_EXTERNAL_CACHE_ENABLED); - } - - /** - * Initialize proper external cache control model - * - * @throws \Magento\Core\Exception - * @return \Magento\PageCache\Model\Control\ControlInterface - */ - public function getCacheControlInstance() - { - return $this->_ccFactory->getCacheControlInstance(); - } - - /** - * Disable caching on external storage side by setting special cookie, if the cookie has not been locked - * - * @param int|null $lifetime - * @return \Magento\PageCache\Helper\Data - */ - public function setNoCacheCookie($lifetime = null) - { - if ($this->_isNoCacheCookieLocked) { - return $this; - } - $lifetime = $lifetime !== null - ? $lifetime - : $this->_coreStoreConfig->getConfig(self::XML_PATH_EXTERNAL_CACHE_LIFETIME); - if ($this->_cookie->get(self::NO_CACHE_COOKIE)) { - $this->_cookie->renew(self::NO_CACHE_COOKIE, $lifetime); - } else { - $this->_cookie->set(self::NO_CACHE_COOKIE, '1', $lifetime); - } - return $this; - } - - /** - * Remove the 'no cache' cookie, if it has not been locked - * - * @return \Magento\PageCache\Helper\Data - */ - public function removeNoCacheCookie() - { - if (!$this->_isNoCacheCookieLocked) { - $this->_cookie->set(self::NO_CACHE_COOKIE, null); - } - return $this; - } - - /** - * Disable modification of the 'no cache' cookie - * - * @return \Magento\PageCache\Helper\Data - */ - public function lockNoCacheCookie() - { - $this->_cookie->set(self::NO_CACHE_LOCK_COOKIE, '1', 0); - $this->_isNoCacheCookieLocked = true; - return $this; - } - - /** - * Enable modification of the 'no cache' cookie - * - * @return \Magento\PageCache\Helper\Data - */ - public function unlockNoCacheCookie() - { - $this->_cookie->set(self::NO_CACHE_LOCK_COOKIE, null); - $this->_isNoCacheCookieLocked = false; - return $this; - } - - /** - * Returns a lifetime of cookie for external cache - * - * @return string Time in seconds - */ - public function getNoCacheCookieLifetime() - { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_EXTERNAL_CACHE_LIFETIME); - } } diff --git a/app/code/Magento/PageCache/Model/App/FrontController/HeaderPlugin.php b/app/code/Magento/PageCache/Model/App/FrontController/HeaderPlugin.php new file mode 100644 index 00000000000..70cf007729b --- /dev/null +++ b/app/code/Magento/PageCache/Model/App/FrontController/HeaderPlugin.php @@ -0,0 +1,83 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\PageCache\Model\App\FrontController; + +/** + * Class HeadPlugin + */ +class HeaderPlugin +{ + /** + * @var \Magento\Core\Model\Layout + */ + protected $layout; + + /** + * @var \Magento\Core\Model\ConfigInterface + */ + protected $config; + + /** + * Constructor + * + * @param \Magento\Core\Model\Layout $layout + * @param \Magento\Core\Model\ConfigInterface $config + */ + public function __construct( + \Magento\Core\Model\Layout $layout, + \Magento\Core\Model\ConfigInterface $config + ){ + $this->layout = $layout; + $this->config = $config; + } + + /** + * Modify response after dispatch + * + * @param \Magento\App\Response\Http $response + * @return \Magento\App\Response\Http + */ + public function afterDispatch(\Magento\App\Response\Http $response) + { + $maxAge = $this->config->getValue('system/headers/max-age'); + if ($this->layout->isCacheable()) { + $response->setHeader('pragma', 'cache', true); + if($this->layout->isPrivate()) { + $response->setHeader('cache-control', 'private, max-age=' . $maxAge, true); + $response->setHeader('expires', + gmdate('D, d M Y H:i:s T', strtotime('+' . $maxAge . ' seconds')), true); + } else { + $response->setHeader('cache-control', 'public, max-age=' . $maxAge, true); + $response->setHeader('expires', + gmdate('D, d M Y H:i:s T', strtotime('+' . $maxAge . ' seconds')), true); + } + } else { + $response->setHeader('pragma', 'no-cache', true); + $response->setHeader('cache-control', 'no-store, no-cache, must-revalidate, max-age=0', true); + $response->setHeader('expires', + gmdate('D, d M Y H:i:s T', strtotime('-' . $maxAge . ' seconds')), true); + } + return $response; + } +} diff --git a/app/code/Magento/PageCache/Model/CacheControlFactory.php b/app/code/Magento/PageCache/Model/CacheControlFactory.php deleted file mode 100644 index e61b43d9052..00000000000 --- a/app/code/Magento/PageCache/Model/CacheControlFactory.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PageCache - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Factory class for cache control interface - */ -namespace Magento\PageCache\Model; - -class CacheControlFactory -{ - /** - * Paths to external cache config option - */ - const XML_PATH_EXTERNAL_CACHE_CONTROL = 'system/external_page_cache/control'; - - /** - * Object manager - * - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Core store config - * - * @var \Magento\Core\Model\Store\Config - */ - protected $_storeConfig; - - /** - * @var array - */ - protected $_cacheControls; - - /** - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\Store\Config $storeConfig - * @param array $cacheControls - */ - public function __construct( - \Magento\ObjectManager $objectManager, - \Magento\Core\Model\Store\Config $storeConfig, - array $cacheControls = array() - ) { - $this->_objectManager = $objectManager; - $this->_storeConfig = $storeConfig; - $this->_cacheControls = $cacheControls; - } - - /** - * Return all available external cache controls - * - * @return array - */ - public function getCacheControls() - { - return $this->_cacheControls; - } - - /** - * Initialize proper external cache control model - * - * @throws \Magento\Core\Exception - * @return \Magento\PageCache\Model\Control\ControlInterface - */ - public function getCacheControlInstance() - { - $usedControl = $this->_storeConfig->getConfig(self::XML_PATH_EXTERNAL_CACHE_CONTROL); - if ($usedControl) { - foreach ($this->getCacheControls() as $control => $info) { - if ($control == $usedControl && !empty($info['instance'])) { - return $this->_objectManager->get($info['instance']); - } - } - } - throw new \Magento\Core\Exception(__('Failed to load external cache control')); - } -} diff --git a/app/code/Magento/PageCache/Model/Observer.php b/app/code/Magento/PageCache/Model/Observer.php deleted file mode 100644 index 92e7c7ba2e7..00000000000 --- a/app/code/Magento/PageCache/Model/Observer.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PageCache - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Page cache observer model - * - * @category Magento - * @package Magento_PageCache - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\PageCache\Model; - -class Observer -{ - const XML_NODE_ALLOWED_CACHE = 'frontend/cache/allowed_requests'; - - /** - * Page cache data - * - * @var \Magento\PageCache\Helper\Data - */ - protected $_pageCacheData = null; - - /** - * @var array - */ - protected $_allowedCache; - - /** - * @param \Magento\PageCache\Helper\Data $pageCacheData - * @param array $allowedCache - */ - public function __construct(\Magento\PageCache\Helper\Data $pageCacheData, array $allowedCache = array()) - { - $this->_pageCacheData = $pageCacheData; - $this->_allowedCache = $allowedCache; - } - - /** - * Check if full page cache is enabled - * - * @return bool - */ - public function isCacheEnabled() - { - return $this->_pageCacheData->isEnabled(); - } - - /** - * Check when cache should be disabled - * - * @param \Magento\Event\Observer $observer - * @return \Magento\PageCache\Model\Observer - */ - public function processPreDispatch(\Magento\Event\Observer $observer) - { - if (!$this->isCacheEnabled()) { - return $this; - } - $action = $observer->getEvent()->getControllerAction(); - $request = $action->getRequest(); - $needCaching = true; - - if ($request->isPost()) { - $needCaching = false; - } - - if (empty($this->_allowedCache)) { - $needCaching = false; - } - - $module = $request->getModuleName(); - $controller = $request->getControllerName(); - $action = $request->getActionName(); - - - if (!isset($this->_allowedCache[$module])) { - $needCaching = false; - } - - if (isset($this->_allowedCache[$module]['controller']) - && $this->_allowedCache[$module]['controller'] != $controller - ) { - $needCaching = false; - } - - if (isset($this->_allowedCache[$module]['action']) && $this->_allowedCache[$module]['action'] != $action) { - $needCaching = false; - } - - if (!$needCaching) { - $this->_pageCacheData->setNoCacheCookie(); - } - - return $this; - } - - /** - * Temporary disabling full page caching by setting bo-cache cookie - * - * @param \Magento\Event\Observer $observer - * @return \Magento\PageCache\Model\Observer - */ - public function setNoCacheCookie(\Magento\Event\Observer $observer) - { - if (!$this->isCacheEnabled()) { - return $this; - } - $this->_pageCacheData->setNoCacheCookie(0)->lockNoCacheCookie(); - return $this; - } - - /** - * Activating full page cache aby deleting no-cache cookie - * - * @param \Magento\Event\Observer $observer - * @return \Magento\PageCache\Model\Observer - */ - public function deleteNoCacheCookie(\Magento\Event\Observer $observer) - { - if (!$this->isCacheEnabled()) { - return $this; - } - $this->_pageCacheData->unlockNoCacheCookie()->removeNoCacheCookie(); - return $this; - } -} diff --git a/app/code/Magento/PageCache/Model/System/Config/Source/Controls.php b/app/code/Magento/PageCache/Model/System/Config/Source/Controls.php deleted file mode 100644 index e39887d5c52..00000000000 --- a/app/code/Magento/PageCache/Model/System/Config/Source/Controls.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PageCache - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Page cache system config source model - * - * @category Magento - * @package Magento_PageCache - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\PageCache\Model\System\Config\Source; - -class Controls implements \Magento\Core\Model\Option\ArrayInterface -{ - /** - * Page cache data - * - * @var \Magento\PageCache\Model\CacheControlFactory - */ - protected $_pageCacheData = null; - - /** - * @param \Magento\PageCache\Model\CacheControlFactory $pageCacheData - */ - public function __construct( - \Magento\PageCache\Model\CacheControlFactory $pageCacheData - ) { - $this->_pageCacheData = $pageCacheData; - } - - /** - * Return array of external cache controls for using as options - * - * @return array - */ - public function toOptionArray() - { - $options = array(); - foreach ($this->_pageCacheData->getCacheControls() as $code => $type) { - $options[] = array( - 'value' => $code, - 'label' => $type['label'] - ); - } - return $options; - } -} diff --git a/app/code/Magento/PageCache/etc/adminhtml/acl.xml b/app/code/Magento/PageCache/etc/adminhtml/acl.xml deleted file mode 100644 index 94b992cae43..00000000000 --- a/app/code/Magento/PageCache/etc/adminhtml/acl.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PageCache - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <acl> - <resources> - <resource id="Magento_Adminhtml::admin"> - <resource id="Magento_PageCache::page_cache" title="External Page Cache" sortOrder="0" /> - </resource> - </resources> - </acl> -</config> diff --git a/app/code/Magento/PageCache/etc/adminhtml/system.xml b/app/code/Magento/PageCache/etc/adminhtml/system.xml deleted file mode 100644 index 2aa47e165d1..00000000000 --- a/app/code/Magento/PageCache/etc/adminhtml/system.xml +++ /dev/null @@ -1,54 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PageCache - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <system> - <section id="system"> - <group id="external_page_cache" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="500"> - <label>External Full Page Cache Settings</label> - <field id="enabled" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Enable External Cache</label> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - </field> - <field id="cookie_lifetime" translate="label comment" type="text" sortOrder="5" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Cookie Lifetime (seconds)</label> - <depends> - <field id="enabled">1</field> - </depends> - <comment>If you leave this empty, we'll use the default value.</comment> - </field> - <field id="control" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>External Cache Control</label> - <source_model>Magento\PageCache\Model\System\Config\Source\Controls</source_model> - <depends> - <field id="enabled">1</field> - </depends> - </field> - </group> - </section> - </system> -</config> diff --git a/app/code/Magento/PageCache/etc/config.xml b/app/code/Magento/PageCache/etc/config.xml index cc2325ffa1c..7f604fac8dc 100644 --- a/app/code/Magento/PageCache/etc/config.xml +++ b/app/code/Magento/PageCache/etc/config.xml @@ -28,11 +28,9 @@ <config> <default> <system> - <external_page_cache> - <enabled>0</enabled> - <control>zend_page_cache</control> - <cookie_lifetime>3600</cookie_lifetime> - </external_page_cache> + <headers> + <max-age>28800</max-age> + </headers> </system> </default> </config> diff --git a/app/code/Magento/PageCache/etc/di.xml b/app/code/Magento/PageCache/etc/di.xml index 9a6348f2a14..8a37a88079f 100644 --- a/app/code/Magento/PageCache/etc/di.xml +++ b/app/code/Magento/PageCache/etc/di.xml @@ -24,14 +24,8 @@ */ --> <config> - <type name="Magento\PageCache\Model\CacheControlFactory"> - <param name="cacheControls"> - <value> - <zendPageCache> - <instance>Magento\PageCache\Model\Control\Zend</instance> - <label>Zend Full Page Cache</label> - </zendPageCache> - </value> - </param> + <type name="Magento\App\FrontControllerInterface"> + <plugin name="front-controller-head" + type="Magento\PageCache\Model\App\FrontController\HeaderPlugin" disabled="true"/> </type> -</config> \ No newline at end of file +</config> diff --git a/app/code/Magento/PageCache/etc/module.xml b/app/code/Magento/PageCache/etc/module.xml index 3d982d29ce4..7b213139f7f 100755 --- a/app/code/Magento/PageCache/etc/module.xml +++ b/app/code/Magento/PageCache/etc/module.xml @@ -24,13 +24,12 @@ */ --> <config> - <module name="Magento_PageCache" version="1.6.0.0" active="true"> + <module name="Magento_PageCache" version="1.6.0.0" active="false"> <sequence> <module name="Magento_Core"/> </sequence> <depends> <module name="Magento_Core"/> - <module name="Magento_Backend"/> </depends> </module> </config> diff --git a/app/code/Magento/PageCache/view/adminhtml/cache/additional.phtml b/app/code/Magento/PageCache/view/adminhtml/cache/additional.phtml deleted file mode 100644 index ab47d88fecc..00000000000 --- a/app/code/Magento/PageCache/view/adminhtml/cache/additional.phtml +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @package default_default - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> - -<?php if ($this->canShowButton()): ?> -<table class="form-list"> - <tr> - <td class="scope-label"> - <button onclick="setLocation('<?php echo $this->getCleanExternalCacheUrl()?>')" type="button" class="scalable"><span><?php echo __('Flush External Page Cache') ?></span></button> - </td> - <td class="scope-label"> - <?php echo __('External full page cache.')?> - </td> - </tr> -</table> -<?php endif;?> diff --git a/app/code/Magento/PageCache/view/frontend/cookie.phtml b/app/code/Magento/PageCache/view/frontend/cookie.phtml deleted file mode 100644 index a3099644ba4..00000000000 --- a/app/code/Magento/PageCache/view/frontend/cookie.phtml +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @package base_default - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> - -<script type="text/javascript"> - //<![CDATA[ - (function($) { - head.js("<?php echo $this->getViewFileUrl('mage/cookies.js')?>", function() { - $.mage.cookies.set( - '<?php echo \Magento\PageCache\Helper\Data::NO_CACHE_COOKIE ?>', - 1, - {lifetime: <?php echo $this->helper('Magento\PageCache\Helper\Data')->getNoCacheCookieLifetime() ?>} - ) - }); - })(jQuery); - //]]> -</script> diff --git a/app/code/Magento/Paygate/Helper/Data.php b/app/code/Magento/Paygate/Helper/Data.php deleted file mode 100644 index e5ffbd11d1b..00000000000 --- a/app/code/Magento/Paygate/Helper/Data.php +++ /dev/null @@ -1,149 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Paygate - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Paygate data helper - */ -namespace Magento\Paygate\Helper; - -class Data extends \Magento\App\Helper\AbstractHelper -{ - /** - * Converts a lot of messages to message - * - * @param array $messages - * @return string - */ - public function convertMessagesToMessage($messages) - { - return implode(' | ', $messages); - } - - /** - * Return message for gateway transaction request - * - * @param \Magento\Payment\Model\Info $payment - * @param string $requestType - * @param string $lastTransactionId - * @param \Magento\Object $card - * @param float $amount - * @param string $exception - * @return bool|string - */ - public function getTransactionMessage($payment, $requestType, $lastTransactionId, $card, $amount = false, - $exception = false - ) { - return $this->getExtendedTransactionMessage( - $payment, $requestType, $lastTransactionId, $card, $amount, $exception - ); - } - - /** - * Return message for gateway transaction request - * - * @param \Magento\Payment\Model\Info $payment - * @param string $requestType - * @param string $lastTransactionId - * @param \Magento\Object $card - * @param float $amount - * @param string $exception - * @param string $additionalMessage Custom message, which will be added to the end of generated message - * @return bool|string - */ - public function getExtendedTransactionMessage($payment, $requestType, $lastTransactionId, $card, $amount = false, - $exception = false, $additionalMessage = false - ) { - $operation = $this->_getOperation($requestType); - - if (!$operation) { - return false; - } - - if ($amount) { - $amount = __('amount %1', $this->_formatPrice($payment, $amount)); - } - - if ($exception) { - $result = __('failed'); - } else { - $result = __('successful'); - } - - $card = __('Credit Card: xxxx-%1', $card->getCcLast4()); - - $pattern = '%s %s %s - %s.'; - $texts = array($card, $amount, $operation, $result); - - if (!is_null($lastTransactionId)) { - $pattern .= ' %s.'; - $texts[] = __('Authorize.Net Transaction ID %1', $lastTransactionId); - } - - if ($additionalMessage) { - $pattern .= ' %s.'; - $texts[] = $additionalMessage; - } - $pattern .= ' %s'; - $texts[] = $exception; - - return call_user_func_array('__', array_merge(array($pattern), $texts)); - } - - /** - * Return operation name for request type - * - * @param string $requestType - * @return bool|string - */ - protected function _getOperation($requestType) - { - switch ($requestType) { - case \Magento\Paygate\Model\Authorizenet::REQUEST_TYPE_AUTH_ONLY: - return __('authorize'); - case \Magento\Paygate\Model\Authorizenet::REQUEST_TYPE_AUTH_CAPTURE: - return __('authorize and capture'); - case \Magento\Paygate\Model\Authorizenet::REQUEST_TYPE_PRIOR_AUTH_CAPTURE: - return __('capture'); - case \Magento\Paygate\Model\Authorizenet::REQUEST_TYPE_CREDIT: - return __('refund'); - case \Magento\Paygate\Model\Authorizenet::REQUEST_TYPE_VOID: - return __('void'); - default: - return false; - } - } - - /** - * Format price with currency sign - * @param \Magento\Payment\Model\Info $payment - * @param float $amount - * @return string - */ - protected function _formatPrice($payment, $amount) - { - return $payment->getOrder()->getBaseCurrency()->formatTxt($amount); - } -} diff --git a/app/code/Magento/Paygate/etc/adminhtml/system.xml b/app/code/Magento/Paygate/etc/adminhtml/system.xml deleted file mode 100644 index 1ca30c8093f..00000000000 --- a/app/code/Magento/Paygate/etc/adminhtml/system.xml +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Paygate - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <system> - <section id="payment"> - <group id="authorizenet" translate="label" type="text" sortOrder="34" showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Authorize.net</label> - <comment> - <![CDATA[<a href="http://celinks.magento.com/authorize_netRegistration" target="_blank">Click here to sign up for an Authorize.net account</a>]]> - </comment> - <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Enabled</label> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - </field> - <field id="cctypes" translate="label" type="multiselect" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Credit Card Types</label> - <source_model>Magento\Paygate\Model\Authorizenet\Source\Cctype</source_model> - </field> - <field id="useccv" translate="label" type="select" sortOrder="16" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Credit Card Verification</label> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - </field> - <field id="email_customer" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Email Customer</label> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - </field> - <field id="login" translate="label" type="obscure" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>API Login ID</label> - <backend_model>Magento\Backend\Model\Config\Backend\Encrypted</backend_model> - </field> - <field id="merchant_email" translate="label" type="text" sortOrder="11" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Merchant's Email</label> - <validate>validate-email</validate> - </field> - <field id="order_status" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>New Order Status</label> - <source_model>Magento\Sales\Model\Config\Source\Order\Status\Processing</source_model> - </field> - <field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Sort Order</label> - </field> - <field id="test" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Test Mode</label> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - </field> - <field id="debug" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Debug</label> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - </field> - <field id="title" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Title</label> - </field> - <field id="trans_key" translate="label" type="obscure" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Transaction Key</label> - <backend_model>Magento\Backend\Model\Config\Backend\Encrypted</backend_model> - </field> - <field id="payment_action" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Payment Action</label> - <source_model>Magento\Paygate\Model\Authorizenet\Source\PaymentAction</source_model> - </field> - <field id="cgi_url" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Gateway URL</label> - </field> - <field id="currency" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Accepted Currency</label> - <source_model>Magento\Backend\Model\Config\Source\Currency</source_model> - </field> - <field id="allowspecific" translate="label" type="allowspecific" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Payment from Applicable Countries</label> - <source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model> - </field> - <field id="specificcountry" translate="label" type="multiselect" sortOrder="51" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Payment from Specific Countries</label> - <source_model>Magento\Directory\Model\Config\Source\Country</source_model> - </field> - <field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Minimum Order Total</label> - </field> - <field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Maximum Order Total</label> - </field> - <field id="allow_partial_authorization" translate="label" type="select" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="0"> - <label>Allow Partial Authorization</label> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - </field> - <field id="heading_3dsecure" translate="label" sortOrder="120" showInDefault="1" showInWebsite="1"> - <label>3D Secure</label> - <frontend_model>Magento\Backend\Block\System\Config\Form\Field\Heading</frontend_model> - </field> - <field id="centinel" translate="label" type="select" sortOrder="125" showInDefault="1" showInWebsite="1"> - <label>3D Secure Card Validation</label> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - </field> - <field id="centinel_is_mode_strict" translate="label comment" type="select" sortOrder="130" showInDefault="1" showInWebsite="1"> - <label>Severe 3D Secure Card Validation</label> - <comment>Severe Validation Removes Chargeback Liability on Merchant</comment> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - <depends> - <field id="centinel">1</field> - </depends> - </field> - <field id="centinel_api_url" translate="label comment" type="text" sortOrder="135" showInDefault="1" showInWebsite="1"> - <label>Centinel API URL</label> - <comment>If you leave this empty, we'll use a default value. The custom URL may be provided by CardinalCommerce agreement.</comment> - <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> - <depends> - <field id="centinel">1</field> - </depends> - </field> - <field id="model"></field> - </group> - </section> - </system> -</config> diff --git a/app/code/Magento/Paygate/etc/config.xml b/app/code/Magento/Paygate/etc/config.xml deleted file mode 100644 index 7333fe8fc00..00000000000 --- a/app/code/Magento/Paygate/etc/config.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Paygate - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <default> - <payment> - <authorizenet> - <active>0</active> - <cctypes>AE,VI,MC,DI</cctypes> - <cgi_url>https://secure.authorize.net/gateway/transact.dll</cgi_url> - <debug>0</debug> - <email_customer>0</email_customer> - <login backend_model="Magento\Backend\Model\Config\Backend\Encrypted" /> - <merchant_email /> - <model>Magento\Paygate\Model\Authorizenet</model> - <order_status>processing</order_status> - <payment_action>authorize</payment_action> - <test>1</test> - <title>Credit Card (Authorize.net)</title> - <trans_key backend_model="Magento\Backend\Model\Config\Backend\Encrypted" /> - <allowspecific>0</allowspecific> - <currency>USD</currency> - <partial_authorization_checksum_checking>1</partial_authorization_checksum_checking> - </authorizenet> - </payment> - </default> -</config> diff --git a/app/code/Magento/Paygate/i18n/de_DE.csv b/app/code/Magento/Paygate/i18n/de_DE.csv deleted file mode 100644 index e82f34921b6..00000000000 --- a/app/code/Magento/Paygate/i18n/de_DE.csv +++ /dev/null @@ -1,65 +0,0 @@ -"3D Secure","3D Secure" -"3D Secure Card Validation","3D Secure-Kartenbestätigung" -"API Login ID","API Login-ID" -"Accepted Currency","Akzeptierte Währung" -"Allow Partial Authorization","Teilweise Autorisierung erlauben" -"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Sind Sie sicher, dass Sie die Zahlung abbrechen möchten? Klicken Sie auf OK, um Ihre Zahlung abzubrechen und den Betrag wieder frei verfügbar zu machen. Klicken Sie auf Abbrechen, um eine andere Kreditkarte anzugeben und mit der Zahlung fortzufahren." -"Authorize Only","Nur genehmigen" -"Authorize and Capture","Genehmigen und erfassen" -"Authorize.Net Transaction ID %s","Authorize.Net Transaktions-ID %s" -"Authorize.net","Genehmigen.net" -"Cancel","Abbrechen" -"Centinel API URL","Centinel API-URL" -"Credit Card Types","Arten von Kreditkarten" -"Credit Card Verification","Überprüfung der Kreditkarte" -"Credit Card: xxxx-%s","Kreditkarte: xxxx-%s" -"Debug","Debug" -"Email Customer","Kunden E-Mail" -"Enabled","Aktiviert" -"Error in payment gateway.","Fehler beim Payment Gateway." -"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Gateway-Aktionen wurden gesperrt, weil der Gateway eine oder mehrere Transaktionen nicht verarbeiten konnte. Bitte loggen Sie sich in Ihren Authorize.Net-Account ein, um dieses Problem manuell zu beheben." -"Gateway error: %s","Fehler des Gateway: %s" -"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Es wird ein Standardwert verwendet, falls das Feld freigelassen wird. Eine benutzerdefinierte URL darf nach der CardinalCommerce-Vereinbarung angegeben werden." -"Invalid amount for authorization.","Ungültiger Betrag um genehmigt zu werden." -"Invalid amount for capture.","Ungültiger Betrag für die Erfassung." -"Invalid amount for partial authorization.","Ungültiger Betrag für die teilweise Autorisierung." -"Invalid amount for refund.","Ungültiger Betrag für eine Rückerstattung." -"Invalid split tenderId ID.","Ungültige gespaltene Angebotsidentität" -"Maximum Order Total","Höchstsumme der Bestellung" -"Merchant's Email","E-Mail des Händlers" -"Minimum Order Total","Mindestsumme der Bestellung" -"New Order Status","Stand der neuen Bestellung" -"Payment Action","Zahlungsvorgang" -"Payment authorization error.","Fehler bei der Zahlungsermächtigung." -"Payment canceling error.","Fehler bei Zahlungsabbruch." -"Payment capturing error.","Fehler bei Zahlungserfassung." -"Payment from Applicable Countries","Bezahlung aus den entsprechenden Ländern" -"Payment from Specific Countries","Bezahlung aus bestimmten Ländern" -"Payment partial authorization error.","Fehler bei teilweiser Autorisierung." -"Payment refunding error.","Fehler bei der Rückerstattung." -"Payment updating error.","Fehler beim Zahlungsupdate." -"Payment voiding error.","Fehler beim Stornieren der Zahlung." -"Processed Amount","Bearbeiteter Betrag" -"Remaining Balance","Verbleibender Betrag" -"Severe 3D Secure Card Validation","Strenge Absicherung der 3D geschützten Karte" -"Severe Validation Removes Chargeback Liability on Merchant","Die bestehende strenge Absicherung entzieht den Verkäufer der Verbindlichkeit Ausgleichsbuchungen nachkommen zu müssen" -"Shopping cart contents and/or address has been changed.","Artikel im Einkaufswagen und/oder die Adresse wurden geändert." -"Sort Order","Sortierreihenfolge" -"Test Mode","Testmodus" -"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","Der Betrag auf Ihrer Kreditkarte reicht nicht aus, um den Kauf durchzuführen. Auf den verfügbaren Betrag kann nicht zugegriffen werden. Um den Kauf durchzuführen, klicken Sie bitte auf OK und geben Sie eine weitere Kreditkartennummer an. Um den Kauf abzubrechen und auf den Betrag wieder zugreifen zu können, klicken Sie bitte auf Abbrechen." -"There was an error canceling transactions. Please contact us or try again later.","Es ist ein Fehler beim Abbruch der Transaktion aufgetreten. Bitte kontaktieren Sie uns oder probieren Sie es später noch einmal." -"Title","Titel" -"Transaction Key","Transaction key" -"You have reached the maximum number of credit card allowed to be used for the payment.","Sie haben die maximale Anzahl an Kreditkarten erreicht, die Sie für die Bezahlung verwenden dürfen." -"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Sie haben die maximale Anzahl an Kreditkarten erreicht, die Sie für eine Bezahlung verwenden dürfen. Die verfügbaren Beträge auf allen verwendeten Karten reichten nicht aus, um die Bezahlung abschließen zu können. Der Zahlungsprozess wurde abgebrochen und die Beträge sind wieder frei verfügbar." -"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Ihre Kredtikarte wurde abgelehnt. Klicken Sie OK, um eine andere Kreditkarte anzugeben, damit Sie den Zahlungsvorgang abschließen können. Klicken Sie auf Abbrechen, um den verwendeten Betrag wieder verfügbar zu machen und eine andere Zahlungsmethode auszuwählen." -"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Ihre Bestellung wurde nicht aufgegeben, weil Artikel in Ihrem Einkaufswagen und/oder die Adresse geändert wurden. Bereits autorisierte, ausstehende Beträge von Ihrer vorherigen Zahlung sind wieder frei verfügbar. Bitte führen Sie den Zahlungsvorgang noch einmal durch, um Ihre neu hinzugekommenen Artikel zu erfassen." -"Your payment has been cancelled. All authorized amounts have been released.","Ihre Zahlung wurde abgebrochen. Alle autorisierten Beträge sind wieder frei verfügbar." -"amount %s","Betrag %s" -"authorize","Autorisieren" -"authorize and capture","Autorisieren und Erfassen" -"capture","Erfassen" -"failed","fehlgeschlagen" -"refund","Rückerstattung" -"successful","erfolgreich" -"void","ungültig" diff --git a/app/code/Magento/Paygate/i18n/en_US.csv b/app/code/Magento/Paygate/i18n/en_US.csv deleted file mode 100644 index 841297c09be..00000000000 --- a/app/code/Magento/Paygate/i18n/en_US.csv +++ /dev/null @@ -1,65 +0,0 @@ -"3D Secure","3D Secure" -"3D Secure Card Validation","3D Secure Card Validation" -"API Login ID","API Login ID" -"Accepted Currency","Accepted Currency" -"Allow Partial Authorization","Allow Partial Authorization" -"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment." -"Authorize Only","Authorize Only" -"Authorize and Capture","Authorize and Capture" -"Authorize.Net Transaction ID %s","Authorize.Net Transaction ID %s" -"Authorize.net","Authorize.net" -"Cancel","Cancel" -"Centinel API URL","Centinel API URL" -"Credit Card Types","Credit Card Types" -"Credit Card Verification","Credit Card Verification" -"Credit Card: xxxx-%s","Credit Card: xxxx-%s" -"Debug","Debug" -"Email Customer","Email Customer" -"Enabled","Enabled" -"Error in payment gateway.","Error in payment gateway." -"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s)." -"Gateway error: %s","Gateway error: %s" -"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement." -"Invalid amount for authorization.","Invalid amount for authorization." -"Invalid amount for capture.","Invalid amount for capture." -"Invalid amount for partial authorization.","Invalid amount for partial authorization." -"Invalid amount for refund.","Invalid amount for refund." -"Invalid split tenderId ID.","Invalid split tenderId ID." -"Maximum Order Total","Maximum Order Total" -"Merchant's Email","Merchant's Email" -"Minimum Order Total","Minimum Order Total" -"New Order Status","New Order Status" -"Payment Action","Payment Action" -"Payment authorization error.","Payment authorization error." -"Payment canceling error.","Payment canceling error." -"Payment capturing error.","Payment capturing error." -"Payment from Applicable Countries","Payment from Applicable Countries" -"Payment from Specific Countries","Payment from Specific Countries" -"Payment partial authorization error.","Payment partial authorization error." -"Payment refunding error.","Payment refunding error." -"Payment updating error.","Payment updating error." -"Payment voiding error.","Payment voiding error." -"Processed Amount","Processed Amount" -"Remaining Balance","Remaining Balance" -"Severe 3D Secure Card Validation","Severe 3D Secure Card Validation" -"Severe Validation Removes Chargeback Liability on Merchant","Severe Validation Removes Chargeback Liability on Merchant" -"Shopping cart contents and/or address has been changed.","Shopping cart contents and/or address has been changed." -"Sort Order","Sort Order" -"Test Mode","Test Mode" -"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel." -"There was an error canceling transactions. Please contact us or try again later.","There was an error canceling transactions. Please contact us or try again later." -"Title","Title" -"Transaction Key","Transaction Key" -"You have reached the maximum number of credit card allowed to be used for the payment.","You have reached the maximum number of credit card allowed to be used for the payment." -"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released." -"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method." -"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents." -"Your payment has been cancelled. All authorized amounts have been released.","Your payment has been cancelled. All authorized amounts have been released." -"amount %s","amount %s" -"authorize","authorize" -"authorize and capture","authorize and capture" -"capture","capture" -"failed","failed" -"refund","refund" -"successful","successful" -"void","void" diff --git a/app/code/Magento/Paygate/i18n/es_ES.csv b/app/code/Magento/Paygate/i18n/es_ES.csv deleted file mode 100644 index fbd610a2ede..00000000000 --- a/app/code/Magento/Paygate/i18n/es_ES.csv +++ /dev/null @@ -1,65 +0,0 @@ -"3D Secure","3D Secure" -"3D Secure Card Validation","Validación de Tarjeta 3D Secure" -"API Login ID","ID de inicio de sesión en API" -"Accepted Currency","Moneda aceptada" -"Allow Partial Authorization","Permitir Autorización Parcial" -"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","¿Está seguro de que desea cancelar su pago? Pinche en Aceptar para cancelar el pago y liberar la cantidad retenida. Pinche en ""Cancelar"" para introducir otra tarjeta de crédito y continuar con su pago." -"Authorize Only","Sólo autorizar" -"Authorize and Capture","Autorizar y capturar" -"Authorize.Net Transaction ID %s","Identificación de la Transacción %s Authorize.Net" -"Authorize.net","Authorize.net" -"Cancel","Cancelar" -"Centinel API URL","Centinel API URL" -"Credit Card Types","Tipos de tarjeta de crédito" -"Credit Card Verification","Verificación de tarjeta de crédito" -"Credit Card: xxxx-%s","Tarjeta de Crédito: xxxx-%s" -"Debug","Depurar" -"Email Customer","Enviar mensaje de correo electrónico al cliente" -"Enabled","Habilitado" -"Error in payment gateway.","Error en el proceso de pago." -"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Las acciones de Gateway se han bloqueadas ya que gateway no puede completar una o varias transacciones. Por favor, inicie sesión manualmente en su cuenta Authorize.Net para resolver el/los problema/s." -"Gateway error: %s","Error de proceso: %s" -"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Al dejarlo en blanco, se utilizará un valor por defecto. Se puede proporcionar un URL personalizado por el acuerdo CardinalCommerce." -"Invalid amount for authorization.","Monto no válido para la autorización." -"Invalid amount for capture.","Cantidad para retención no válida." -"Invalid amount for partial authorization.","Cantidad de autorización parcial no válida." -"Invalid amount for refund.","Cantidad de reembolso no válida." -"Invalid split tenderId ID.","La identificación tenderId no se puede separar." -"Maximum Order Total","Total máximo de pedido" -"Merchant's Email","Correo electrónico del vendedor" -"Minimum Order Total","Total mÃnimo de pedido" -"New Order Status","Nuevo estado de pedido" -"Payment Action","Acción de pago" -"Payment authorization error.","Error de autorización de pago." -"Payment canceling error.","Error en el pago de cancelación." -"Payment capturing error.","Error en el pago de retención." -"Payment from Applicable Countries","Pago desde paÃses aceptados" -"Payment from Specific Countries","Pago desde paÃses especÃficos" -"Payment partial authorization error.","Error en el pago parcial de la autorización." -"Payment refunding error.","Error en el pago de reembolso." -"Payment updating error.","Error de actualización del pago." -"Payment voiding error.","Error en la anulación del pago." -"Processed Amount","Cantidad Procesada" -"Remaining Balance","Saldo Restante" -"Severe 3D Secure Card Validation","Validación de Tarjeta Severe 3D Secure" -"Severe Validation Removes Chargeback Liability on Merchant","La Validación Severe Suprime la Responsabilidad de Cancelación de Cargo del Comerciante" -"Shopping cart contents and/or address has been changed.","El contenido de la cesta de compra y/o la dirección han cambiado." -"Sort Order","Ordenar Pedido" -"Test Mode","Modo de prueba" -"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","No tiene suficiente dinero en su tarjeta de crédito para completar la compra. El dinero disponible ha sido retenido. Para completar la compra, pulse OK y especifique un número de tarjeta de crédito adicional. Para cancelar la compra y liberar el dinero retenido, pulse Cancelar." -"There was an error canceling transactions. Please contact us or try again later.","Ha habido un error en la cancelación de las transacciones. Por favor, póngase en contacto con nosotros o inténtelo más tarde de nuevo." -"Title","TÃtulo" -"Transaction Key","Clave de transacción" -"You have reached the maximum number of credit card allowed to be used for the payment.","Ha alcanzado el máximo permitido por su tarjeta de crédito para efectuar el pago." -"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Ha alcanzado el número máximo de tarjetas de crédito que se pueden usar para un solo pago. El dinero disponible en todas las tarjetas usadas era insuficiente para completar el pago. El pago se ha cancelado y el dinero retenido se ha liberado." -"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Su tarjeta de crédito se ha rechazado. Pulse OK para especificar otra tarjeta de crédito para completar la compra. Pulse Cancelar para liberar el dinero retenido y seleccionar otra forma de pago." -"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Su orden no ha sido cursada, porque el contenido de la cesta de la compra y/o la dirección se han cambiado. El dinero autorizado en su pago previo, como adelanto, ahora lo tiene disponible. Por favor, revise el proceso de pago para su pedido reciente." -"Your payment has been cancelled. All authorized amounts have been released.","Su pago se ha cancelado. Dispone de todo el dinero que habÃa avanzado." -"amount %s","dinero %s" -"authorize","autorizar" -"authorize and capture","autorizar y capturar" -"capture","capturar" -"failed","error" -"refund","reembolso" -"successful","exitoso" -"void","vacÃo" diff --git a/app/code/Magento/Paygate/i18n/fr_FR.csv b/app/code/Magento/Paygate/i18n/fr_FR.csv deleted file mode 100644 index 7c0c074d3ad..00000000000 --- a/app/code/Magento/Paygate/i18n/fr_FR.csv +++ /dev/null @@ -1,65 +0,0 @@ -"3D Secure","Sécurité 3D" -"3D Secure Card Validation","Validation de carte sécurité 3D" -"API Login ID","Identifiant de l'API" -"Accepted Currency","Monnaie acceptée" -"Allow Partial Authorization","Permettre autorisation partielle" -"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Etes-vous sûr de vouloir annuler votre paiement ? Cliquez sur OK pour annuler le paiement et débloquer le montant en attente. Cliquez sur Quitter pour entrer une autre carte bancaire et continuer le paiemetn." -"Authorize Only","Autoriser uniquement" -"Authorize and Capture","Autoriser et enregistrer" -"Authorize.Net Transaction ID %s","Identifiant de transaction %s Authorize.Net" -"Authorize.net","Authorize.net" -"Cancel","Annuler" -"Centinel API URL","URP API Centinel" -"Credit Card Types","Types de cartes de crédit" -"Credit Card Verification","Vérification de la carte de crédit" -"Credit Card: xxxx-%s","Carte de crédit : xxxx-%s" -"Debug","Déboguer" -"Email Customer","Envoyer un email au client" -"Enabled","Activé" -"Error in payment gateway.","Erreur dans le transfert du paiement." -"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Les actions de passerelle sont verouillées car la passerelle ne peut pas compléter une ou plusieurs transactions. Veuillez vous connecter à Authorize.net pour résoudre manuellement le problème." -"Gateway error: %s","Erreur de la passerelle : %s" -"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Si vide, une valeur par défaut sera utilisée. Une URL personnalisée peut être fournie par CardinalCommerce." -"Invalid amount for authorization.","Montant invalide pour autorisation." -"Invalid amount for capture.","Montant invalide" -"Invalid amount for partial authorization.","Montant invalide pour l'autorisation partielle" -"Invalid amount for refund.","Montant invalide pour un remboursement" -"Invalid split tenderId ID.","Identifiant invalide" -"Maximum Order Total","Montant total maximum" -"Merchant's Email","Email du marchand" -"Minimum Order Total","Montant total minimum" -"New Order Status","Nouveau statut de la commande" -"Payment Action","Paiement" -"Payment authorization error.","Erreur d'autorisation du paiement." -"Payment canceling error.","Erreur dans l'annulation du paiement." -"Payment capturing error.","Erreur lors de la saisie du paiement" -"Payment from Applicable Countries","Paiement depuis les pays disponibles." -"Payment from Specific Countries","Paiement depuis les pays spécifiques" -"Payment partial authorization error.","Erreur de l'autorisation partielle du paiement" -"Payment refunding error.","Erreur de remboursement du paiement" -"Payment updating error.","Erreur lors de la mise à jour du paiement." -"Payment voiding error.","Erreur annulant le paiement" -"Processed Amount","Montant réalisé" -"Remaining Balance","Balance restante" -"Severe 3D Secure Card Validation","Validation de carte sécurité 3D sévère" -"Severe Validation Removes Chargeback Liability on Merchant","Validation sévère supprime le risque de remboursement pour le vendeur" -"Shopping cart contents and/or address has been changed.","Le contenu du panier et/ou l'adresse ont été changés." -"Sort Order","Trier les widgets" -"Test Mode","Mode test." -"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","Le montant disponible sur votre carte de crédit est insuffisant pour pouvoir finaliser votre commande. Le montant disponible a été mis en attente. Pour finaliser votre commande, cliquez sur OK et indiquez le numéro d'une autre carte de crédit. Pour annuler la commande et débloquer le montant mis en attente, cliquez sur Annuler." -"There was an error canceling transactions. Please contact us or try again later.","Une erreur s'est produite lors de l'annulation de transactions. Veuillez nous contacter ou réessayer ultérieurement." -"Title","Titre" -"Transaction Key","Clé de la transaction" -"You have reached the maximum number of credit card allowed to be used for the payment.","Vous avez atteint le nombre maximum autorisé de cartes de crédit à utiliser pour le paiement." -"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Vous avez atteint le nombre maximum autorisé de cartes de crédits à utiliser pour un paiement. Les montants disponibles sur l'ensemble des cartes de crédit étaient insuffisants pour finaliser le paiement. Le paiement a été annulé et les montants mis en attente débloqués." -"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Votre carte de crédit a été refusée. Cliquez sur OK pour indiquer une autre carte de crédit pour finaliser votre paiement. Cliquez sur Annuler pour débloquer le montant mis attente et sélectionner un autre moyen de paiement." -"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Votre commande n'a pas été enregistrée car les contenus du panier et/ou de l'adresse ont été modifiés. Les montants autorisés en attente de votre paiement précédent sont désormais débloqués. Veuillez procéder au paiement pour les contenus de votre dernier panier." -"Your payment has been cancelled. All authorized amounts have been released.","Votre paiement a été annulé. Tous les montants autorisés ont été débloqués." -"amount %s","Montant %s" -"authorize","autoriser" -"authorize and capture","autoriser et saisir" -"capture","saisir" -"failed","échoué" -"refund","remboursement" -"successful","réussi" -"void","vide" diff --git a/app/code/Magento/Paygate/i18n/nl_NL.csv b/app/code/Magento/Paygate/i18n/nl_NL.csv deleted file mode 100644 index d31ec24003b..00000000000 --- a/app/code/Magento/Paygate/i18n/nl_NL.csv +++ /dev/null @@ -1,65 +0,0 @@ -"3D Secure","3D Secure" -"3D Secure Card Validation","3D Secure Card Validation" -"API Login ID","API Login ID" -"Accepted Currency","Geaccepteerde munteenheid" -"Allow Partial Authorization","Gedeeltelijke autorisatie toestaan" -"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Weet u zeker dat u uw betaling wilt annuleren? Klik op OK om uw betaling te annuleren en het geld vrij te geven. Klik op Cancel om een andere kredietkaart te gebruiken en verder te gaan met uw betaling." -"Authorize Only","Alleen authoriseren" -"Authorize and Capture","Authoriseren en opnemen" -"Authorize.Net Transaction ID %s","Authorize.Net Transactie ID %s" -"Authorize.net","Authorize.net" -"Cancel","Annuleren" -"Centinel API URL","Centinel API URL" -"Credit Card Types","Types credit card" -"Credit Card Verification","Credit Card Verificatie" -"Credit Card: xxxx-%s","Kredietkaart: xxxx-%s" -"Debug","Debug" -"Email Customer","E-mail Klant" -"Enabled","Aan" -"Error in payment gateway.","Fout in betaling gateway." -"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Gateway acties zijn vergrendeld omdat de gateway een of meerdere transacties niet kan voltooien. Log alstublieft in op uw Authorize.Net account om zelf het problem/de problemen op te lossen." -"Gateway error: %s","Gateway fout: %s" -"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Indien leeg, een standaard waarde kan worden gebruikt. Een aangepaste URL kan worden geleverd volgens de CardinalCommerce overeenkomst" -"Invalid amount for authorization.","Ongeldig bedrag voor autorisatie." -"Invalid amount for capture.","Ongeldige aantal voor vangst." -"Invalid amount for partial authorization.","Ongeldig aantal voor gedeeltelijke autorisatie." -"Invalid amount for refund.","Ongeldige aantal voor teruggave." -"Invalid split tenderId ID.","Ongeldige split tenderld ID." -"Maximum Order Total","Maximale Bestelling" -"Merchant's Email","Verkopers e-mail" -"Minimum Order Total","Minimale Bestelling" -"New Order Status","Nieuwe Status van de Bestelling" -"Payment Action","Betaling" -"Payment authorization error.","Fout bij autorisatie betaling." -"Payment canceling error.","Probleem met het annuleren van de betaling." -"Payment capturing error.","Fout in het ophalen van de betaling." -"Payment from Applicable Countries","Betaling van Geëigende Landen" -"Payment from Specific Countries","Betaling van Specifieke Landen" -"Payment partial authorization error.","Fout in de gedeeltelijke autorisatie van de betaling." -"Payment refunding error.","Fout in het terugbetalen van de betaling." -"Payment updating error.","Fout bij het bijwerken van de betaling." -"Payment voiding error.","Fout in het vernietigen van de betaling." -"Processed Amount","Verwerkte hoeveelheid" -"Remaining Balance","Resterend balans" -"Severe 3D Secure Card Validation","Strenge 3D Secure Card Validation" -"Severe Validation Removes Chargeback Liability on Merchant","Strenge validatie verwijdert terugboekingsaansprakelijkheid voor de handelaar" -"Shopping cart contents and/or address has been changed.","Winkel wagen inhoud en/of adres is gewijzigd." -"Sort Order","Sorteer Bestelling" -"Test Mode","Test modus" -"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","U heeft onvoldoende tegoed op uw creditcard om de aankoop te voltooien. Het bedrag is vastgezet. Om de aankoop te voltooien, klik op OK en geef een extra creditcardnummer op. Om de aankoop te annuleren en het geld terug te zetten, klik op Cancel." -"There was an error canceling transactions. Please contact us or try again later.","Er heeft zich een fout voorgedaan tijdens het annuleren van de transacties. Neem contact met ons op of probeer later." -"Title","Titel" -"Transaction Key","Transactiesleutel" -"You have reached the maximum number of credit card allowed to be used for the payment.","Het aantal toegestane creditcards voor deze betaling is bereikt." -"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Het aantal toegestane creditcards voor één betaling is bereikt. Het saldo is nog steeds onvoldoende om de betaling te voltooien. De betaling is geannuleerd en de vastgezette bedragen zijn vrijgegeven." -"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Uw creditcard is geweigerd. Klik op OK om een andere creditcard te gebruiken voor uw betaling. Klik op Cancel om het bedrag vrij te geven en kies een andere betaalmethode." -"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Uw order kan niet worden geplaatst, omdat de inhoud van uw winkelwagentje en/of adres gewijzigd zijn. Geautoriseerde bedragen van uw vorige betaling zijn vrijgegeven. Ga naar het betalingsproces voor de inhoud van uw huidige winkelwagen." -"Your payment has been cancelled. All authorized amounts have been released.","Uw betaling is geannuleerd. Alle geautoriseerde bedragen zijn vrijgegeven." -"amount %s","bedrag %s" -"authorize","autoriseer" -"authorize and capture","autoriseer en vang" -"capture","vang" -"failed","mislukt" -"refund","teruggave" -"successful","succesvol" -"void","ongeldig" diff --git a/app/code/Magento/Paygate/i18n/pt_BR.csv b/app/code/Magento/Paygate/i18n/pt_BR.csv deleted file mode 100644 index 895c8956ba7..00000000000 --- a/app/code/Magento/Paygate/i18n/pt_BR.csv +++ /dev/null @@ -1,65 +0,0 @@ -"3D Secure","3D Secure" -"3D Secure Card Validation","Validação de Cartão 3D Secure" -"API Login ID","ID de Login API" -"Accepted Currency","Moeda Aceita" -"Allow Partial Authorization","Permitir Autorização Parcial" -"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","Tem certeza de que deseja cancelar o seu pagamento? Clique em OK para cancelar o seu pagamento e liberar o montante em espera. Clique em Cancelar para inserir outro cartão de crédito e continuar com o seu pagamento." -"Authorize Only","Somente Autorizar" -"Authorize and Capture","Autorizar e Controlar" -"Authorize.Net Transaction ID %s","ID Transação Authorize.Net %s" -"Authorize.net","Authorize.net" -"Cancel","Cancelar" -"Centinel API URL","URL Centinel API" -"Credit Card Types","Tipos de Cartão de Crédito" -"Credit Card Verification","Verificação de Cartão de Crédito" -"Credit Card: xxxx-%s","Cartão de crédito: xxxx-%s" -"Debug","Debug" -"Email Customer","Enviar Email ao Cliente" -"Enabled","Ativado" -"Error in payment gateway.","Erro no portal de pagamento." -"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","Ações de portal são bloqueadas porque o portal não consegue completar uma ou mais das transações. Por favor entre na sua conta Authorize.Net manualmente para resolver o(s) problema(s)." -"Gateway error: %s","Erro do portal: %s" -"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","Se vazio, um valor definido será usado. URL personalizado pode ser fornecido por acordo CardinalCommerce." -"Invalid amount for authorization.","Valor inválido para autorização." -"Invalid amount for capture.","Valor inválido para captura." -"Invalid amount for partial authorization.","Valor inválido para autorização parcial." -"Invalid amount for refund.","Valor inválido para reembolso." -"Invalid split tenderId ID.","ID tenderId de divisão inválida." -"Maximum Order Total","Total Máximo do Pedido" -"Merchant's Email","Email do Vendedor" -"Minimum Order Total","Total MÃnimo do Pedido" -"New Order Status","Status do Novo Pedido" -"Payment Action","Ação de Pagamento" -"Payment authorization error.","Erro na autorização de pagamento." -"Payment canceling error.","Erro de cancelamento de pagamento." -"Payment capturing error.","Erro de captura de pagamento." -"Payment from Applicable Countries","Pagamento de PaÃses Aplicáveis" -"Payment from Specific Countries","Pagamento de PaÃses EspecÃficos" -"Payment partial authorization error.","Erro de autorização de pagamento parcial." -"Payment refunding error.","Erro de reembolso de pagamento." -"Payment updating error.","Erro de atualização de pagamento." -"Payment voiding error.","Erro de anulamento de pagamento." -"Processed Amount","Valor Processado" -"Remaining Balance","Balanço Restante" -"Severe 3D Secure Card Validation","Validação de Cartão Severe 3D Secure" -"Severe Validation Removes Chargeback Liability on Merchant","Validação Severe Remove a Responsabilidade de Cobrança Retroativa no Comerciante" -"Shopping cart contents and/or address has been changed.","Conteúdo do carrinho de compras e/ou endereço foi alterado." -"Sort Order","Classificar pedido" -"Test Mode","Modo de Teste" -"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","O valor no seu cartão de crédito é insuficiente para concluir a compra. O montante disponÃvel foi colocado em espera. Para concluir a sua compra, clique em OK e especifique o número do cartão de crédito adicional. Para cancelar a compra e liberar o montante em espera, clique em Cancelar." -"There was an error canceling transactions. Please contact us or try again later.","Ocorreu um erro ao cancelar as transações. Por favor entre em contato conosco ou tente novamente mais tarde." -"Title","TÃtulo" -"Transaction Key","Chave de Transação" -"You have reached the maximum number of credit card allowed to be used for the payment.","Você atingiu o número máximo de cartão de crédito autorizado a ser utilizado para o pagamento." -"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","Você atingiu o número máximo de cartões de crédito que pode ser usado para um único pagamento. Os montantes disponÃveis em todos os cartões utilizados foram insuficientes para completar o pagamento. O pagamento foi cancelado e os valores em espera foram liberados." -"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","Seu cartão de crédito foi recusado. Clique em OK para especificar outro cartão de crédito para concluir a compra. Clique em Cancelar para liberar a quantia em espera e selecione outro método de pagamento." -"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","Seu pedido não tenha sido colocado, porque o conteúdo do carrinho de compras e/ou endereço foi alterado. Montantes autorizados a partir do seu pagamento anterior que ficaram pendentes são agora liberados. Por favor siga através do processo de compra para o seu conteúdo recente do carrinho." -"Your payment has been cancelled. All authorized amounts have been released.","O seu pagamento foi cancelado. Todos os valores autorizados foram liberados." -"amount %s","valor %s" -"authorize","autorizar" -"authorize and capture","autorizar e capturar" -"capture","capturar" -"failed","fracassado" -"refund","reembolso" -"successful","bem sucedido" -"void","vazio" diff --git a/app/code/Magento/Paygate/i18n/zh_CN.csv b/app/code/Magento/Paygate/i18n/zh_CN.csv deleted file mode 100644 index 61b048be7fd..00000000000 --- a/app/code/Magento/Paygate/i18n/zh_CN.csv +++ /dev/null @@ -1,65 +0,0 @@ -"3D Secure","3D 安全" -"3D Secure Card Validation","3D 安全信用å¡éªŒè¯" -"API Login ID","API 登录 ID" -"Accepted Currency","接å—的汇率" -"Allow Partial Authorization","å…许部分身份验è¯" -"Are you sure you want to cancel your payment? Click OK to cancel your payment and release the amount on hold. Click Cancel to enter another credit card and continue with your payment.","您是å¦ç¡®å®šè¦å–消支付?å•击确定å¯å–消您的支付,并释放å 用的é¢åº¦ã€‚å•击喿¶ˆå¯è¾“入其他信用å¡ï¼Œå¹¶ç»§ç»è¿›è¡Œæ”¯ä»˜ã€‚" -"Authorize Only","仅供授æƒ" -"Authorize and Capture","授æƒå’Œæ•获" -"Authorize.Net Transaction ID %s","Authorize.Net 交易 ID %s" -"Authorize.net","Authorize.net" -"Cancel","å–æ¶ˆ" -"Centinel API URL","Centinel API URL" -"Credit Card Types","信用å¡ç±»åž‹" -"Credit Card Verification","信用å¡éªŒè¯" -"Credit Card: xxxx-%s","信用å¡ï¼šxxxx-%s" -"Debug","调试" -"Email Customer","å‘é€ç”µå邮件给客户" -"Enabled","å·²å¯ç”¨" -"Error in payment gateway.","支付网关出错。" -"Gateway actions are locked because the gateway cannot complete one or more of the transactions. Please log in to your Authorize.Net account to manually resolve the issue(s).","网关æ“作被é”å®šï¼Œå› ä¸ºç½‘å…³æ— æ³•å®Œæˆä¸€ä¸ªæˆ–多个交易。请登录到您的 Authorize.Net 叿ˆ·å¹¶æ‰‹å·¥è§£å†³è¯¥é—®é¢˜ã€‚" -"Gateway error: %s","网关错误:%s" -"If empty, a default value will be used. Custom URL may be provided by CardinalCommerce agreement.","如果为空,则会使用默认值。自定义URLå¯é€šè¿‡ CardinalCommerce åè®®æä¾›ã€‚" -"Invalid amount for authorization.","授æƒçš„é¢åº¦æ— 效。" -"Invalid amount for capture.","获å–çš„é¢åº¦æ— 效。" -"Invalid amount for partial authorization.","éƒ¨åˆ†èº«ä»½éªŒè¯æ— 效。" -"Invalid amount for refund.","退款é¢åº¦æ— 效。" -"Invalid split tenderId ID.","拆分的 tenderId ID æ— æ•ˆã€‚" -"Maximum Order Total","æœ€å¤§è®¢å•æ€»æ•°" -"Merchant's Email","商家电å邮件" -"Minimum Order Total","最å°è®¢å•总数" -"New Order Status","新订å•状æ€" -"Payment Action","支付æ“作" -"Payment authorization error.","支付授æƒé”™è¯¯ã€‚" -"Payment canceling error.","å–æ¶ˆæ”¯ä»˜è¿‡ç¨‹å‡ºé”™ã€‚" -"Payment capturing error.","支付æ•获出错。" -"Payment from Applicable Countries","ä»Žå¯æŽ¥å—的国家支付" -"Payment from Specific Countries","从指定的国家支付" -"Payment partial authorization error.","支付的部分身份验è¯å‡ºé”™ã€‚" -"Payment refunding error.","支付的退款出错。" -"Payment updating error.","支付更新错误。" -"Payment voiding error.","支付的作废出错。" -"Processed Amount","处ç†çš„é¢åº¦" -"Remaining Balance","剩下的余é¢" -"Severe 3D Secure Card Validation","æä¾› 3D 安全信用å¡éªŒè¯" -"Severe Validation Removes Chargeback Liability on Merchant","æ£å¼éªŒè¯å°†æ’¤é”€é“¶è¡Œçš„退款责任" -"Shopping cart contents and/or address has been changed.","è´ç‰©è½¦å†…容和/或地å€å·²è¢«æ›´æ”¹ã€‚" -"Sort Order","排åºé¡ºåº" -"Test Mode","测试模å¼" -"The amount on your credit card is insufficient to complete your purchase. The available amount has been put on hold. To complete your purchase click OK and specify additional credit card number. To cancel the purchase and release the amount on hold, click Cancel.","您信用å¡çš„ä½™é¢ä¸è¶³ä»¥å®Œæˆæœ¬æ¬¡è´ä¹°ã€‚å¯ç”¨ä½™é¢å·²ç»è¢«æš‚æŒ‚ã€‚ä¸ºå®Œæˆæ‚¨çš„è´ä¹°ï¼Œè¯·ç‚¹å‡»ç¡®å®šå¹¶æä¾›å¦ä¸€ä¸ªä¿¡ç”¨å¡å·ç 。è¦å–消è´ä¹°å¹¶é€€å›žæš‚挂的余é¢ï¼Œè¯·ç‚¹å‡»å–消。" -"There was an error canceling transactions. Please contact us or try again later.","å–æ¶ˆäº¤æ˜“æ—¶é‡åˆ°äº†é”™è¯¯ã€‚请è”系我们或ç¨å€™é‡è¯•。" -"Title","æ ‡é¢˜" -"Transaction Key","交易密钥" -"You have reached the maximum number of credit card allowed to be used for the payment.","您已ç»è¾¾åˆ°äº†å¯ç”¨äºŽäº¤æ˜“çš„ä¿¡ç”¨å¡æ•°é‡æœ€å¤§å€¼ã€‚" -"You have reached the maximum number of credit cards that can be used for one payment. The available amounts on all used cards were insufficient to complete payment. The payment has been cancelled and amounts on hold have been released.","您已ç»è¾¾åˆ°äº†ä¸€æ¬¡æ”¯ä»˜å¯ä½¿ç”¨ä¿¡ç”¨å¡æ•°é‡çš„æœ€å¤§å€¼ã€‚所有用过å¡ç‰‡çš„å¯ç”¨é¢åº¦éƒ½ä¸è¶³ä»¥å®Œæˆæ”¯ä»˜ã€‚ä»˜æ¬¾å·²è¢«å–æ¶ˆï¼Œæš‚挂的é¢åº¦å·²ç»è¢«è¿”还。" -"Your credit card has been declined. Click OK to specify another credit card to complete your purchase. Click Cancel to release the amount on hold and select another payment method.","您的信用å¡è¢«æ‹’ç»ã€‚点击确定以指定å¦ä¸€å¼ å¯å®Œæˆæ¤æ¬¡äº¤æ˜“的信用å¡ã€‚ç‚¹å‡»å–æ¶ˆä»¥è¿”还被暂挂的é¢åº¦ï¼Œå¹¶é€‰æ‹©å…¶ä»–支付方å¼ã€‚" -"Your order has not been placed, because contents of the shopping cart and/or address has been changed. Authorized amounts from your previous payment that were left pending are now released. Please go through the checkout process for your recent cart contents.","您的订å•åˆ›å»ºä¸æˆåŠŸï¼Œå› ä¸ºè´ç‰©è½¦çš„内容和/或地å€å·²ç»æœ‰å˜åŠ¨ã€‚æ‚¨çš„ä¸Šæ¬¡æ”¯ä»˜ä¸é€šè¿‡é¢„授æƒè¢«æš‚挂的é¢åº¦å·²ç»è¿”还。请为è´ç‰©è½¦ä¸çš„æ–°å†…容釿–°æ‰§è¡Œä»˜æ¬¾æµç¨‹ã€‚" -"Your payment has been cancelled. All authorized amounts have been released.","æ‚¨çš„ä»˜æ¬¾å·²è¢«å–æ¶ˆã€‚所有授æƒçš„é¢åº¦å·²ç»è¢«è¿”还。" -"amount %s","é¢åº¦ %s" -"authorize","授æƒ" -"authorize and capture","授æƒå’ŒèŽ·å–" -"capture","获å–" -"failed","失败" -"refund","退款" -"successful","æˆåŠŸ" -"void","é¿å…" diff --git a/app/code/Magento/Payment/Helper/Data.php b/app/code/Magento/Payment/Helper/Data.php index aec544dea26..1dbaf1064aa 100644 --- a/app/code/Magento/Payment/Helper/Data.php +++ b/app/code/Magento/Payment/Helper/Data.php @@ -69,6 +69,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected $_appEmulation; + /** + * @var \Magento\Core\Model\Config\Initial + */ + protected $_initialConfig; + /** * Construct * @@ -79,6 +84,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\Core\Model\Config $config * @param \Magento\Core\Model\App\Emulation $appEmulation * @param \Magento\Payment\Model\Config $paymentConfig + * @param \Magento\Core\Model\Config\Initial $initialConfig */ public function __construct( \Magento\App\Helper\Context $context, @@ -87,7 +93,8 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\Payment\Model\Method\Factory $paymentMethodFactory, \Magento\Core\Model\Config $config, \Magento\Core\Model\App\Emulation $appEmulation, - \Magento\Payment\Model\Config $paymentConfig + \Magento\Payment\Model\Config $paymentConfig, + \Magento\Core\Model\Config\Initial $initialConfig ) { parent::__construct($context); $this->_coreStoreConfig = $coreStoreConfig; @@ -96,6 +103,7 @@ class Data extends \Magento\App\Helper\AbstractHelper $this->_config = $config; $this->_appEmulation = $appEmulation; $this->_paymentConfig = $paymentConfig; + $this->_initialConfig = $initialConfig; } /** @@ -124,7 +132,7 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getStoreMethods($store = null, $quote = null) { $res = array(); - $methods = $this->getPaymentMethods($store); + $methods = $this->getPaymentMethods(); uasort($methods, array($this, '_sortMethods')); foreach ($methods as $code => $methodConfig) { $prefix = self::XML_PATH_PAYMENT_METHODS . '/' . $code . '/'; @@ -243,7 +251,7 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getRecurringProfileMethods($store = null) { $result = array(); - foreach ($this->getPaymentMethods($store) as $code => $data) { + foreach ($this->getPaymentMethods() as $code => $data) { $method = $this->getMethodInstance($code); if ($method && $method->canManageRecurringProfiles()) { $result[] = $method; @@ -255,12 +263,11 @@ class Data extends \Magento\App\Helper\AbstractHelper /** * Retrieve all payment methods * - * @param mixed $store * @return array */ - public function getPaymentMethods($store = null) + public function getPaymentMethods() { - return $this->_coreStoreConfig->getConfig(self::XML_PATH_PAYMENT_METHODS, $store); + return $this->_initialConfig->getDefault()[self::XML_PATH_PAYMENT_METHODS]; } /** @@ -290,7 +297,7 @@ class Data extends \Magento\App\Helper\AbstractHelper $groups = array(); $groupRelations = array(); - foreach ($this->getPaymentMethods($store) as $code => $data) { + foreach ($this->getPaymentMethods() as $code => $data) { if ((isset($data['title']))) { $methods[$code] = $data['title']; } else { diff --git a/app/code/Magento/Payment/etc/module.xml b/app/code/Magento/Payment/etc/module.xml index abad25efe2d..8e7c3f3b0db 100755 --- a/app/code/Magento/Payment/etc/module.xml +++ b/app/code/Magento/Payment/etc/module.xml @@ -34,7 +34,7 @@ <module name="Magento_Catalog"/> <module name="Magento_Sales"/> <module name="Magento_Centinel"/> - <module name="Magento_Checkout" type="soft"/> + <module name="Magento_Checkout"/> </depends> </module> </config> diff --git a/app/code/Magento/Paypal/Block/Express/Form.php b/app/code/Magento/Paypal/Block/Express/Form.php index 66f9e2c6a31..0d3becb6616 100644 --- a/app/code/Magento/Paypal/Block/Express/Form.php +++ b/app/code/Magento/Paypal/Block/Express/Form.php @@ -67,6 +67,7 @@ class Form extends \Magento\Paypal\Block\Standard\Form $this->_paypalData = $paypalData; $this->_customerSession = $customerSession; parent::__construct($context, $paypalConfigFactory, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Paypal/Block/Express/Shortcut.php b/app/code/Magento/Paypal/Block/Express/Shortcut.php index 37731635dbf..8d12c03ee2d 100644 --- a/app/code/Magento/Paypal/Block/Express/Shortcut.php +++ b/app/code/Magento/Paypal/Block/Express/Shortcut.php @@ -111,6 +111,11 @@ class Shortcut extends \Magento\View\Element\Template */ protected $mathRandom; + /** + * @var \Magento\Catalog\Model\ProductTypes\ConfigInterface + */ + protected $productTypeConfig; + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Paypal\Helper\Data $paypalData @@ -121,6 +126,7 @@ class Shortcut extends \Magento\View\Element\Template * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory * @param \Magento\Math\Random $mathRandom + * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig * @param array $data */ public function __construct( @@ -133,6 +139,7 @@ class Shortcut extends \Magento\View\Element\Template \Magento\Checkout\Model\Session $checkoutSession, \Magento\Paypal\Model\Express\Checkout\Factory $checkoutFactory, \Magento\Math\Random $mathRandom, + \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, array $data = array() ) { $this->_registry = $registry; @@ -143,7 +150,9 @@ class Shortcut extends \Magento\View\Element\Template $this->_checkoutSession = $checkoutSession; $this->_checkoutFactory = $checkoutFactory; $this->mathRandom = $mathRandom; + $this->productTypeConfig = $productTypeConfig; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** @@ -170,7 +179,7 @@ class Shortcut extends \Magento\View\Element\Template $currentProduct = $this->_registry->registry('current_product'); if (!is_null($currentProduct)) { $productPrice = (float)$currentProduct->getFinalPrice(); - if (empty($productPrice) && !$currentProduct->isGrouped()) { + if (empty($productPrice) && !$this->productTypeConfig->isProductSet($currentProduct->getTypeId())) { $this->_shouldRender = false; return $result; } diff --git a/app/code/Magento/Paypal/Block/Iframe.php b/app/code/Magento/Paypal/Block/Iframe.php index 4caa495127c..4dda948abb7 100644 --- a/app/code/Magento/Paypal/Block/Iframe.php +++ b/app/code/Magento/Paypal/Block/Iframe.php @@ -97,6 +97,7 @@ class Iframe extends \Magento\Payment\Block\Form $this->_orderFactory = $orderFactory; $this->_checkoutSession = $checkoutSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** @@ -114,7 +115,7 @@ class Iframe extends \Magento\Payment\Block\Form $templatePath = str_replace('_', '', $paymentCode); $templateFile = "{$templatePath}/iframe.phtml"; - $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $directory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $file = $this->_viewFileSystem->getFilename($templateFile, array('module' => 'Magento_Paypal')); if ($directory->isExist($directory->getRelativePath($file))) { $this->setTemplate($templateFile); diff --git a/app/code/Magento/Paypal/Model/Api/Nvp.php b/app/code/Magento/Paypal/Model/Api/Nvp.php index e4d4ff463ae..901a183c4ae 100644 --- a/app/code/Magento/Paypal/Model/Api/Nvp.php +++ b/app/code/Magento/Paypal/Model/Api/Nvp.php @@ -518,7 +518,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi * @var array */ protected $_doReferenceTransactionRequest = array('REFERENCEID', 'PAYMENTACTION', 'AMT', 'ITEMAMT', 'SHIPPINGAMT', - 'TAXAMT', 'INVNUM', 'NOTIFYURL' + 'TAXAMT', 'INVNUM', 'NOTIFYURL', 'CURRENCYCODE' ); protected $_doReferenceTransactionResponse = array('BILLINGAGREEMENTID', 'TRANSACTIONID'); diff --git a/app/code/Magento/Paypal/Model/Cert.php b/app/code/Magento/Paypal/Model/Cert.php index db1de4ec154..af12fbe703f 100644 --- a/app/code/Magento/Paypal/Model/Cert.php +++ b/app/code/Magento/Paypal/Model/Cert.php @@ -51,7 +51,7 @@ class Cert extends \Magento\Core\Model\AbstractModel /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -60,13 +60,13 @@ class Cert extends \Magento\Core\Model\AbstractModel public function __construct( \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->varDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $this->encryptor = $encryptor; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } diff --git a/app/code/Magento/Paypal/Model/Method/Agreement.php b/app/code/Magento/Paypal/Model/Method/Agreement.php index e84dad33355..e28db8951fc 100644 --- a/app/code/Magento/Paypal/Model/Method/Agreement.php +++ b/app/code/Magento/Paypal/Model/Method/Agreement.php @@ -349,13 +349,15 @@ class Agreement extends \Magento\Sales\Model\Payment\Method\Billing\AbstractAgre ); $parameters = array('params' => array($order)); + $proConfig = $this->_pro->getConfig(); $api = $this->_pro->getApi() ->setReferenceId($billingAgreement->getReferenceId()) - ->setPaymentAction($this->_pro->getConfig()->paymentAction) + ->setPaymentAction($proConfig->paymentAction) ->setAmount($amount) + ->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode()) ->setNotifyUrl($this->_urlBuilder->getUrl('paypal/ipn/')) ->setPaypalCart($this->_cartFactory->create($parameters)) - ->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled) + ->setIsLineItemsEnabled($proConfig->lineItemsEnabled) ->setInvNum($order->getIncrementId()); // call api and import transaction and other payment information diff --git a/app/code/Magento/Paypal/Model/Report/Settlement.php b/app/code/Magento/Paypal/Model/Report/Settlement.php index 691f98356c1..9ea857983fd 100644 --- a/app/code/Magento/Paypal/Model/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/Report/Settlement.php @@ -171,7 +171,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel /** * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -180,13 +180,13 @@ class Settlement extends \Magento\Core\Model\AbstractModel public function __construct( \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_tmpDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::SYS_TMP); + $this->_tmpDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::SYS_TMP_DIR); $this->_storeManager = $storeManager; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php index f98d2117d1b..7795617eac3 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php @@ -53,7 +53,7 @@ class Cert extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\Config $config * @param \Magento\Paypal\Model\CertFactory $certFactory * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -65,14 +65,14 @@ class Cert extends \Magento\Core\Model\Config\Value \Magento\Core\Model\Config $config, \Magento\Paypal\Model\CertFactory $certFactory, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_certFactory = $certFactory; $this->_encryptor = $encryptor; - $this->_tmpDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::SYS_TMP); + $this->_tmpDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::SYS_TMP_DIR); parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); } diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/BuyerCountry.php b/app/code/Magento/Paypal/Model/System/Config/Source/BuyerCountry.php index 84d26e2d886..341b31c8e3a 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Source/BuyerCountry.php +++ b/app/code/Magento/Paypal/Model/System/Config/Source/BuyerCountry.php @@ -39,18 +39,18 @@ class BuyerCountry implements \Magento\Core\Model\Option\ArrayInterface /** * @var \Magento\Directory\Model\Resource\Country\CollectionFactory */ - protected $_countryCollFactory; + protected $_countryCollectionFactory; /** * @param \Magento\Paypal\Model\ConfigFactory $configFactory - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory */ public function __construct( \Magento\Paypal\Model\ConfigFactory $configFactory, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory ) { $this->_configFactory = $configFactory; - $this->_countryCollFactory = $countryCollFactory; + $this->_countryCollectionFactory = $countryCollectionFactory; } /** @@ -60,7 +60,7 @@ class BuyerCountry implements \Magento\Core\Model\Option\ArrayInterface public function toOptionArray($isMultiselect = false) { $supported = $this->_configFactory->create()->getSupportedBuyerCountryCodes(); - $options = $this->_countryCollFactory->create()->addCountryCodeFilter($supported, 'iso2') + $options = $this->_countryCollectionFactory->create()->addCountryCodeFilter($supported, 'iso2') ->loadData() ->toOptionArray($isMultiselect ? false : __('--Please Select--')); diff --git a/app/code/Magento/Paypal/Model/System/Config/Source/MerchantCountry.php b/app/code/Magento/Paypal/Model/System/Config/Source/MerchantCountry.php index e30b6ef4a8a..0d98d5cc45f 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Source/MerchantCountry.php +++ b/app/code/Magento/Paypal/Model/System/Config/Source/MerchantCountry.php @@ -39,18 +39,18 @@ class MerchantCountry implements \Magento\Core\Model\Option\ArrayInterface /** * @var \Magento\Directory\Model\Resource\Country\CollectionFactory */ - protected $_countryCollFactory; + protected $_countryCollectionFactory; /** * @param \Magento\Paypal\Model\ConfigFactory $configFactory - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory */ public function __construct( \Magento\Paypal\Model\ConfigFactory $configFactory, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory ) { $this->_configFactory = $configFactory; - $this->_countryCollFactory = $countryCollFactory; + $this->_countryCollectionFactory = $countryCollectionFactory; } /** @@ -60,7 +60,7 @@ class MerchantCountry implements \Magento\Core\Model\Option\ArrayInterface public function toOptionArray($isMultiselect = false) { $supported = $this->_configFactory->create()->getSupportedMerchantCountryCodes(); - $options = $this->_countryCollFactory->create()->addCountryCodeFilter($supported, 'iso2') + $options = $this->_countryCollectionFactory->create()->addCountryCodeFilter($supported, 'iso2') ->loadData() ->toOptionArray($isMultiselect ? false : __('--Please Select--')); diff --git a/app/code/Magento/Paypal/etc/module.xml b/app/code/Magento/Paypal/etc/module.xml index 724186575d7..9e9cffd45e3 100755 --- a/app/code/Magento/Paypal/etc/module.xml +++ b/app/code/Magento/Paypal/etc/module.xml @@ -26,7 +26,6 @@ <config> <module name="Magento_Paypal" version="1.6.0.3" active="true"> <sequence> - <module name="Magento_Paygate"/> <module name="Magento_Checkout"/> <module name="Magento_Sales"/> </sequence> @@ -41,6 +40,7 @@ <module name="Magento_Directory"/> <module name="Magento_Theme"/> <module name="Magento_Centinel"/> + <module name="Magento_Catalog"/> </depends> </module> </config> diff --git a/app/code/Magento/PaypalUk/etc/module.xml b/app/code/Magento/PaypalUk/etc/module.xml index 0e0b7b2ae1c..89ca2937a36 100755 --- a/app/code/Magento/PaypalUk/etc/module.xml +++ b/app/code/Magento/PaypalUk/etc/module.xml @@ -26,7 +26,6 @@ <config> <module name="Magento_PaypalUk" version="1.6.0.0" active="true"> <sequence> - <module name="Magento_Paygate"/> <module name="Magento_Checkout"/> <module name="Magento_Sales"/> <module name="Magento_Paypal"/> diff --git a/app/code/Magento/Persistent/Block/Header/Additional.php b/app/code/Magento/Persistent/Block/Header/Additional.php index 15a069f7bd1..10bf7c675d7 100644 --- a/app/code/Magento/Persistent/Block/Header/Additional.php +++ b/app/code/Magento/Persistent/Block/Header/Additional.php @@ -55,6 +55,7 @@ class Additional extends \Magento\View\Element\Html\Link ) { $this->_persistentSession = $persistentSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /* diff --git a/app/code/Magento/Persistent/Model/Persistent/Config.php b/app/code/Magento/Persistent/Model/Persistent/Config.php index 116199b0a46..eadc9b3b713 100644 --- a/app/code/Magento/Persistent/Model/Persistent/Config.php +++ b/app/code/Magento/Persistent/Model/Persistent/Config.php @@ -82,7 +82,7 @@ class Config * @param \Magento\View\LayoutInterface $layout * @param \Magento\App\State $appState * @param \Magento\Persistent\Model\Factory $persistentFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Config\DomFactory $domFactory, @@ -90,14 +90,14 @@ class Config \Magento\View\LayoutInterface $layout, \Magento\App\State $appState, \Magento\Persistent\Model\Factory $persistentFactory, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_domFactory = $domFactory; $this->_moduleReader = $moduleReader; $this->_layout = $layout; $this->_appState = $appState; $this->_persistentFactory = $persistentFactory; - $this->_modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $this->_modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); } /** diff --git a/app/code/Magento/Persistent/etc/frontend/events.xml b/app/code/Magento/Persistent/etc/frontend/events.xml index 5eb094195c6..ce099785c6a 100644 --- a/app/code/Magento/Persistent/etc/frontend/events.xml +++ b/app/code/Magento/Persistent/etc/frontend/events.xml @@ -82,7 +82,7 @@ <event name="controller_action_predispatch_googlecheckout_redirect_checkout"> <observer name="persistent" instance="Magento\Persistent\Model\Observer" method="preventExpressCheckout" /> </event> - <event name="controller_action_predispatch_checkout_multishipping_index"> + <event name="controller_action_predispatch_multishipping_checkout_index"> <observer name="persistent" instance="Magento\Persistent\Model\Observer" method="preventExpressCheckout" /> </event> <event name="render_block"> diff --git a/app/code/Magento/ProductAlert/etc/module.xml b/app/code/Magento/ProductAlert/etc/module.xml index ebac0744f61..40d29f0c30a 100755 --- a/app/code/Magento/ProductAlert/etc/module.xml +++ b/app/code/Magento/ProductAlert/etc/module.xml @@ -34,6 +34,7 @@ <module name="Magento_Customer"/> <module name="Magento_Core"/> <module name="Magento_Tax"/> + <module name="Magento_Email"/> </depends> </module> </config> diff --git a/app/code/Magento/Rating/etc/module.xml b/app/code/Magento/Rating/etc/module.xml index 705ee56b5b8..9086e51999d 100755 --- a/app/code/Magento/Rating/etc/module.xml +++ b/app/code/Magento/Rating/etc/module.xml @@ -33,6 +33,7 @@ <module name="Magento_Core"/> <module name="Magento_Review"/> <module name="Magento_Customer"/> + <module name="Magento_Backend"/> </depends> </module> </config> diff --git a/app/code/Magento/Reports/Block/Product/AbstractProduct.php b/app/code/Magento/Reports/Block/Product/AbstractProduct.php index ec74cdc047c..03ab396976e 100644 --- a/app/code/Magento/Reports/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Reports/Block/Product/AbstractProduct.php @@ -75,6 +75,7 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Reports\Model\Product\Index\Factory $indexFactory * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -92,7 +93,8 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Reports\Model\Product\Index\Factory $indexFactory, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { parent::__construct( $context, @@ -106,10 +108,12 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); $this->_productVisibility = $productVisibility; $this->_indexFactory = $indexFactory; + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Index.php b/app/code/Magento/Reports/Controller/Adminhtml/Index.php index bfe3bf7a9bc..f74044ba2f3 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Index.php @@ -79,7 +79,7 @@ class Index extends \Magento\Backend\App\Action { $this->_view->loadLayout(false); $content = $this->_view->getLayout()->getChildBlock('adminhtml.report.search.grid', 'grid.export'); - return $this->_fileFactory->create('search.csv', $content->getCsvFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create('search.csv', $content->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -89,7 +89,7 @@ class Index extends \Magento\Backend\App\Action { $this->_view->loadLayout(false); $content = $this->_view->getLayout()->getChildBlock('adminhtml.report.search.grid', 'grid.export'); - return $this->_fileFactory->create('search.xml', $content->getExcelFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create('search.xml', $content->getExcelFile(), \Magento\App\Filesystem::VAR_DIR); } protected function _isAllowed() diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Customer.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Customer.php index 84a840000f8..d1a1d76fd83 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Customer.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Customer.php @@ -94,7 +94,7 @@ class Customer extends \Magento\Backend\App\Action $fileName = 'new_accounts.csv'; /** @var \Magento\Backend\Block\Widget\Grid\ExportInterface $exportBlock */ $exportBlock = $this->_view->getLayout()->getChildBlock('adminhtml.report.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -109,7 +109,7 @@ class Customer extends \Magento\Backend\App\Action return $this->_fileFactory->create( $fileName, $exportBlock->getExcelFile($fileName), - \Magento\Filesystem::VAR_DIR + \Magento\App\Filesystem::VAR_DIR ); } diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Review.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Review.php index 91d9307fed2..9bde9bd8683 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Review.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Review.php @@ -89,7 +89,7 @@ class Review extends \Magento\Backend\App\Action $exportBlock = $this->_view ->getLayout() ->getChildBlock('adminhtml.block.report.review.customer.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -102,7 +102,7 @@ class Review extends \Magento\Backend\App\Action $exportBlock = $this->_view ->getLayout() ->getChildBlock('adminhtml.block.report.review.customer.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getExcelFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $exportBlock->getExcelFile(), \Magento\App\Filesystem::VAR_DIR); } @@ -129,7 +129,7 @@ class Review extends \Magento\Backend\App\Action $exportBlock = $this->_view ->getLayout() ->getChildBlock('adminhtml.block.report.review.product.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -142,7 +142,7 @@ class Review extends \Magento\Backend\App\Action $exportBlock = $this->_view ->getLayout() ->getChildBlock('adminhtml.block.report.review.product.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getExcelFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $exportBlock->getExcelFile(), \Magento\App\Filesystem::VAR_DIR); } public function productDetailAction() @@ -168,7 +168,7 @@ class Review extends \Magento\Backend\App\Action $content = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Review\Detail\Grid') ->getCsv(); - return $this->_fileFactory->create($fileName, $content, \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } /** @@ -180,7 +180,7 @@ class Review extends \Magento\Backend\App\Action $content = $this->_view->getLayout()->createBlock('Magento\Reports\Block\Adminhtml\Review\Detail\Grid') ->getExcel($fileName); - return $this->_fileFactory->create($fileName, $content, \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } protected function _isAllowed() diff --git a/app/code/Magento/Reports/etc/module.xml b/app/code/Magento/Reports/etc/module.xml index 4f7730b78e8..4c6de7c795a 100755 --- a/app/code/Magento/Reports/etc/module.xml +++ b/app/code/Magento/Reports/etc/module.xml @@ -47,6 +47,10 @@ <module name="Magento_CatalogInventory"/> <module name="Magento_Tax"/> <module name="Magento_Rating"/> + <module name="Magento_Downloadable"/> + <module name="Magento_SalesRule"/> + <module name="Magento_Checkout"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php b/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php index d97551f702e..dc748d5a1d6 100644 --- a/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php +++ b/app/code/Magento/Reports/sql/reports_setup/mysql4-install-1.6.0.0.php @@ -131,7 +131,7 @@ $this->getConnection()->createTable($table); $installFile = __DIR__ . '/install-1.6.0.0.php'; /** @var \Magento\Filesystem\Directory\Read $modulesDirectory */ -$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\Filesystem::MODULES); +$modulesDirectory = $this->getFilesystem()->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); if ($modulesDirectory->isExist($modulesDirectory->getRelativePath($installFile))) { include $installFile; } diff --git a/app/code/Magento/Reports/view/frontend/widget/compared/column/compared_default_list.phtml b/app/code/Magento/Reports/view/frontend/widget/compared/column/compared_default_list.phtml index a516de7c245..33c2d571384 100644 --- a/app/code/Magento/Reports/view/frontend/widget/compared/column/compared_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/compared/column/compared_default_list.phtml @@ -67,8 +67,23 @@ if ($exist = $this->getRecentlyComparedProducts()) { <?php echo $this->getPriceHtml($_product, true, '-widget-compared-'.$suffix) ?> <?php if($_product->isSaleable()): ?> <div class="actions"> - <a href="<?php echo $this->getAddToCartUrl($_product) ?>" - class="action tocart"><span><?php echo __('Add to Cart') ?></span></a> + <?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?> + <button class="action tocart" + data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_product) ?>'}}" + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_product), ['product' => $_product->getEntityId()]) + ?> + <button class="action tocart" + data-post='<?php echo $postData; ?>' + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> </div> <?php else: ?> <?php if ($_product->getIsSalable()): ?> diff --git a/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_grid.phtml b/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_grid.phtml index 114ce964a69..e840d9f54c8 100644 --- a/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_grid.phtml @@ -24,6 +24,7 @@ ?> <?php +/** @var \Magento\Catalog\Block\Product\Compare\ListCompare $this */ if ($exist = $this->getRecentlyComparedProducts()) { $type = 'widget-compared'; $mode = 'grid'; @@ -77,11 +78,23 @@ if ($exist = $this->getRecentlyComparedProducts()) { <?php if($showCart): ?> <div class="primary"> <?php if($_item->isSaleable()): ?> - <button class="action tocart" - data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" - type="button" title="<?php echo __('Add to Cart') ?>"> - <span><?php echo __('Add to Cart') ?></span> - </button> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <button class="action tocart" + data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + <button class="action tocart" + data-post='<?php echo $postData; ?>' + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> <p class="stock available"><span><?php echo __('In stock') ?></span></p> @@ -93,17 +106,21 @@ if ($exist = $this->getRecentlyComparedProducts()) { <?php endif; ?> <?php if($showWishlist || $showCompare): ?> - <div class="secondary addto links"> + <div class="secondary addto links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" + <a href="#" + data-post='<?php echo $this->getAddToWishlistParams($_item); ?>' + data-action="add-to-wishlist" class="action towishlist" title="<?php echo __('Add to Wishlist') ?>"> <span><?php echo __('Add to Wishlist') ?></span> </a> <?php endif; ?> - <?php if($this->getAddToCompareUrl($_item) && $showCompare): ?> - <a href="<?php echo $this->getAddToCompareUrl($_item) ?>" - class="action tocompare" title="<?php echo __('Add to Compare') ?>"> + <?php if($this->getAddToCompareUrl() && $showCompare): ?> + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare'); ?> + <a href="#" class="action tocompare" + data-post='<?php echo $compareHelper->getPostDataParams($_item);?>' + title="<?php echo __('Add to Compare') ?>"> <span><?php echo __('Add to Compare') ?></span> </a> <?php endif; ?> @@ -118,4 +135,4 @@ if ($exist = $this->getRecentlyComparedProducts()) { </ol> </div> </div> -<?php endif;?> +<?php endif;?> \ No newline at end of file diff --git a/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_list.phtml b/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_list.phtml index 0a5060e53fa..cf2d934b134 100644 --- a/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_list.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/compared/content/compared_list.phtml @@ -24,6 +24,7 @@ ?> <?php +/** @var \Magento\Catalog\Block\Product\Compare\ListCompare $this */ if ($exist = $this->getRecentlyComparedProducts()) { $type = 'widget-compared'; $mode = 'list'; @@ -77,11 +78,23 @@ if ($exist = $this->getRecentlyComparedProducts()) { <?php if($showCart): ?> <div class="primary"> <?php if($_item->isSaleable()): ?> - <button class="action tocart" - data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" - type="button" title="<?php echo __('Add to Cart') ?>"> - <span><?php echo __('Add to Cart') ?></span> - </button> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <button class="action tocart" + data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + <button class="action tocart" + data-post='<?php echo $postData; ?>' + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> <p class="stock available"><span><?php echo __('In stock') ?></span></p> @@ -93,17 +106,21 @@ if ($exist = $this->getRecentlyComparedProducts()) { <?php endif; ?> <?php if($showWishlist || $showCompare): ?> - <div class="secondary addto links"> + <div class="secondary addto links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" + <a href="#" + data-post='<?php echo $this->getAddToWishlistParams($_item); ?>' + data-action="add-to-wishlist" class="action towishlist" title="<?php echo __('Add to Wishlist') ?>"> <span><?php echo __('Add to Wishlist') ?></span> </a> <?php endif; ?> - <?php if($this->getAddToCompareUrl($_item) && $showCompare): ?> - <a href="<?php echo $this->getAddToCompareUrl($_item) ?>" - class="action tocompare" title="<?php echo __('Add to Compare') ?>"> + <?php if($this->getAddToCompareUrl() && $showCompare): ?> + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> + <a href="#" class="action tocompare" + data-post='<?php echo $compareHelper->getPostDataParams($_item);?>' + title="<?php echo __('Add to Compare') ?>"> <span><?php echo __('Add to Compare') ?></span> </a> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/widget/viewed/column/viewed_default_list.phtml b/app/code/Magento/Reports/view/frontend/widget/viewed/column/viewed_default_list.phtml index 9908bae11ae..1b50f80a3f5 100644 --- a/app/code/Magento/Reports/view/frontend/widget/viewed/column/viewed_default_list.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/viewed/column/viewed_default_list.phtml @@ -75,7 +75,20 @@ if ($exist = $this->getRecentlyViewedProducts()) { <div class="product actions"> <?php if($_product->isSaleable()): ?> <div class="primary"> - <a href="<?php echo $this->getAddToCartUrl($_product) ?>" class="action tocart"><span><?php echo __('Add to Cart') ?></span></a> + <?php if ($_product->getTypeInstance()->hasRequiredOptions($_item)): ?> + <button class="action tocart" + data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?> + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); + ?> + <button type="button" class="action tocart" data-post='<?php echo $postData; ?>'> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> </div> <?php else: ?> <?php if ($_product->getIsSalable()): ?> diff --git a/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_grid.phtml b/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_grid.phtml index f19a1ad2203..151add3d1fc 100644 --- a/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_grid.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_grid.phtml @@ -80,9 +80,21 @@ if ($exist = $this->getRecentlyViewedProducts()) { <?php if($showCart): ?> <div class="primary"> <?php if($_item->isSaleable()): ?> - <button class="action tocart" data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" type="button" title="<?php echo __('Add to Cart') ?>"> - <span><?php echo __('Add to Cart') ?></span> - </button> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <button class="action tocart" data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]) + ?> + <button class="action tocart" + data-post='<?php echo $postData; ?>' + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> <p class="stock available"><span><?php echo __('In stock') ?></span></p> @@ -93,17 +105,20 @@ if ($exist = $this->getRecentlyViewedProducts()) { </div> <?php endif; ?> <?php if($showWishlist || $showCompare): ?> - <div class="secondary addto links"> + <div class="secondary addto links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" + <a href="#" class="action towishlist" data-action="add-to-wishlist" + data-post='<?php echo $this->getAddToWishlistParams($_item); ?>' title="<?php echo __('Add to Wishlist') ?>"> <span><?php echo __('Add to Wishlist') ?></span> </a> <?php endif; ?> - <?php if($this->getAddToCompareUrl($_item) && $showCompare): ?> - <a href="<?php echo $this->getAddToCompareUrl($_item) ?>" - class="action tocompare" title="<?php echo __('Add to Compare') ?>"> + <?php if($this->getAddToCompareUrl() && $showCompare): ?> + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> + <a href="#" class="action tocompare" + data-post='<?php echo $compareHelper->getPostDataParams($_item);?>' + title="<?php echo __('Add to Compare') ?>"> <span><?php echo __('Add to Compare') ?></span> </a> <?php endif; ?> diff --git a/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_list.phtml b/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_list.phtml index 2c029810511..bdd10e82d43 100644 --- a/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_list.phtml +++ b/app/code/Magento/Reports/view/frontend/widget/viewed/content/viewed_list.phtml @@ -81,11 +81,23 @@ if ($exist = $this->getRecentlyViewedProducts()) { <?php if($showCart): ?> <div class="primary"> <?php if($_item->isSaleable()): ?> - <button class="action tocart" - data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?>'}}" - type="button" title="<?php echo __('Add to Cart') ?>"> - <span><?php echo __('Add to Cart') ?></span> - </button> + <?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?> + <button class="action tocart" + data-mage-init="{redirectUrl: {url: '<?php echo $this->getAddToCartUrl($_item) ?> + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getAddToCartUrl($_item), ['product' => $_item->getEntityId()]); + ?> + <button class="action tocart" + data-post='<?php echo $postData; ?>' + type="button" title="<?php echo __('Add to Cart') ?>"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif; ?> <?php else: ?> <?php if ($_item->getIsSalable()): ?> <p class="stock available"><span><?php echo __('In stock') ?></span></p> @@ -97,17 +109,20 @@ if ($exist = $this->getRecentlyViewedProducts()) { <?php endif; ?> <?php if($showWishlist || $showCompare): ?> - <div class="secondary addto links"> + <div class="secondary addto links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow() && $showWishlist): ?> - <a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" + <a href="#" class="action towishlist" data-action="add-to-wishlist" + data-post='<?php echo $this->getAddToWishlistParams($_item); ?>' title="<?php echo __('Add to Wishlist') ?>"> <span><?php echo __('Add to Wishlist') ?></span> </a> <?php endif; ?> - <?php if($this->getAddToCompareUrl($_item) && $showCompare): ?> - <a href="<?php echo $this->getAddToCompareUrl($_item) ?>" - class="action tocompare" title="<?php echo __('Add to Compare') ?>"> + <?php if($this->getAddToCompareUrl() && $showCompare): ?> + <?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?> + <a href="#" class="action tocompare" + data-post='<?php echo $compareHelper->getPostDataParams($_item);?>' + title="<?php echo __('Add to Compare') ?>"> <span><?php echo __('Add to Compare') ?></span> </a> <?php endif; ?> diff --git a/app/code/Magento/Review/Block/Customer/ListCustomer.php b/app/code/Magento/Review/Block/Customer/ListCustomer.php index b7d25cd032a..ce91b039562 100644 --- a/app/code/Magento/Review/Block/Customer/ListCustomer.php +++ b/app/code/Magento/Review/Block/Customer/ListCustomer.php @@ -64,6 +64,7 @@ class ListCustomer extends \Magento\Customer\Block\Account\Dashboard ) { $this->_collectionFactory = $collectionFactory; parent::__construct($context, $customerSession, $subscriberFactory, $data); + $this->_isScopePrivate = true; } protected function _initCollection() diff --git a/app/code/Magento/Review/Block/Customer/Recent.php b/app/code/Magento/Review/Block/Customer/Recent.php index 52ceee84611..3e2ea6e2bb4 100644 --- a/app/code/Magento/Review/Block/Customer/Recent.php +++ b/app/code/Magento/Review/Block/Customer/Recent.php @@ -68,6 +68,7 @@ class Recent extends \Magento\View\Element\Template $this->_collectionFactory = $collectionFactory; $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Review/Block/Customer/View.php b/app/code/Magento/Review/Block/Customer/View.php index 02618f36012..f2514ef107a 100644 --- a/app/code/Magento/Review/Block/Customer/View.php +++ b/app/code/Magento/Review/Block/Customer/View.php @@ -81,6 +81,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Rating\Model\RatingFactory $ratingFactory * @param \Magento\Customer\Model\Session $customerSession * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -101,7 +102,8 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, \Magento\Rating\Model\RatingFactory $ratingFactory, \Magento\Customer\Model\Session $customerSession, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_productFactory = $productFactory; $this->_reviewFactory = $reviewFactory; @@ -121,8 +123,10 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } diff --git a/app/code/Magento/Review/Block/Form.php b/app/code/Magento/Review/Block/Form.php index dd29ec89793..31361997ee1 100644 --- a/app/code/Magento/Review/Block/Form.php +++ b/app/code/Magento/Review/Block/Form.php @@ -102,6 +102,7 @@ class Form extends \Magento\View\Element\Template $this->_ratingFactory = $ratingFactory; $this->messageManager = $messageManager; parent::__construct($context, $data); + $this->_isScopePrivate = true; } protected function _construct() diff --git a/app/code/Magento/Review/Block/Product/View.php b/app/code/Magento/Review/Block/Product/View.php index e3fec80bdfa..9ad39b65b6a 100644 --- a/app/code/Magento/Review/Block/Product/View.php +++ b/app/code/Magento/Review/Block/Product/View.php @@ -63,9 +63,11 @@ class View extends \Magento\Catalog\Block\Product\View * @param \Magento\Tax\Model\Calculation $taxCalculation * @param \Magento\Stdlib\String $string * @param \Magento\Catalog\Helper\Product $productHelper + * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig * @param \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory * @param array $data - * + * @param array $priceBlockTypes + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -86,8 +88,10 @@ class View extends \Magento\Catalog\Block\Product\View \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Stdlib\String $string, \Magento\Catalog\Helper\Product $productHelper, + \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_reviewsColFactory = $collectionFactory; parent::__construct( @@ -108,7 +112,9 @@ class View extends \Magento\Catalog\Block\Product\View $taxCalculation, $string, $productHelper, - $data + $productTypeConfig, + $data, + $priceBlockTypes ); } @@ -133,8 +139,11 @@ class View extends \Magento\Catalog\Block\Product\View * @param bool $displayIfNoReviews * @return string */ - public function getReviewsSummaryHtml(\Magento\Catalog\Model\Product $product, $templateType = false, $displayIfNoReviews = false) - { + public function getReviewsSummaryHtml( + \Magento\Catalog\Model\Product $product, + $templateType = false, + $displayIfNoReviews = false + ) { return $this->getLayout()->createBlock('Magento\Rating\Block\Entity\Detailed') ->setEntityId($this->getProduct()->getId()) diff --git a/app/code/Magento/Review/Block/View.php b/app/code/Magento/Review/Block/View.php index 3f9264a3fbc..b66af65dd34 100644 --- a/app/code/Magento/Review/Block/View.php +++ b/app/code/Magento/Review/Block/View.php @@ -69,6 +69,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Rating\Model\RatingFactory $ratingFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -87,7 +88,8 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, \Magento\Rating\Model\RatingFactory $ratingFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_voteFactory = $voteFactory; $this->_reviewFactory = $reviewFactory; @@ -104,7 +106,8 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); } diff --git a/app/code/Magento/Review/etc/module.xml b/app/code/Magento/Review/etc/module.xml index 0140f07ecf4..dd9449558cf 100755 --- a/app/code/Magento/Review/etc/module.xml +++ b/app/code/Magento/Review/etc/module.xml @@ -39,6 +39,8 @@ <module name="Magento_Backend"/> <module name="Magento_Tax"/> <module name="Magento_Newsletter"/> + <module name="Magento_Checkout"/> + <module name="Magento_Wishlist"/> </depends> </module> </config> diff --git a/app/code/Magento/Rss/Block/AbstractBlock.php b/app/code/Magento/Rss/Block/AbstractBlock.php index 3e0b12645ca..b4672438161 100644 --- a/app/code/Magento/Rss/Block/AbstractBlock.php +++ b/app/code/Magento/Rss/Block/AbstractBlock.php @@ -45,6 +45,7 @@ class AbstractBlock extends \Magento\View\Element\Template ) { $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Rss/Block/Catalog/AbstractCatalog.php b/app/code/Magento/Rss/Block/Catalog/AbstractCatalog.php index 3b1db06f81c..5244c5699c4 100644 --- a/app/code/Magento/Rss/Block/Catalog/AbstractCatalog.php +++ b/app/code/Magento/Rss/Block/Catalog/AbstractCatalog.php @@ -81,6 +81,7 @@ class AbstractCatalog extends \Magento\Rss\Block\AbstractBlock ) { $this->_catalogData = $catalogData; parent::__construct($context, $customerSession, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Rss/Block/ListBlock.php b/app/code/Magento/Rss/Block/ListBlock.php index 048adc0ded5..b488abdd6b1 100644 --- a/app/code/Magento/Rss/Block/ListBlock.php +++ b/app/code/Magento/Rss/Block/ListBlock.php @@ -60,6 +60,7 @@ class ListBlock extends \Magento\View\Element\Template $this->_customerSession = $customerSession; $this->_categoryFactory = $categoryFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Rss/Block/Wishlist.php b/app/code/Magento/Rss/Block/Wishlist.php index 8e81a685718..5f983466ca0 100644 --- a/app/code/Magento/Rss/Block/Wishlist.php +++ b/app/code/Magento/Rss/Block/Wishlist.php @@ -94,6 +94,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Catalog\Helper\Output $outputHelper * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -116,7 +117,8 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Catalog\Helper\Output $outputHelper, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_outputHelper = $outputHelper; $this->_coreData = $coreData; @@ -137,7 +139,8 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $imageHelper, $customerSession, $productFactory, - $data + $data, + $priceBlockTypes ); } diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index a61ce5e03fe..b3bc7f9007f 100755 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -46,6 +46,8 @@ <module name="Magento_Customer"/> <module name="Magento_Backend"/> <module name="Magento_GiftMessage"/> + <module name="Magento_Checkout"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php index c748d6822b7..f5857360a1f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php @@ -85,7 +85,7 @@ class View extends \Magento\Backend\Block\Template public function getSubmitUrl() { - return $this->getUrl('sales/*/addComment', array('id' => $this->getEntity()->getId())); + return $this->getUrl('*/*/addComment', array('id' => $this->getEntity()->getId())); } public function canSendCommentEmail() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php index ab25fe9add3..734d7e96276 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/Renderer/Qty.php @@ -44,7 +44,7 @@ class Qty */ protected function _isInactive($row) { - return $row->getTypeId() == \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE; + return $row->getTypeId() == \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE; } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Form.php index 726c203935d..cd6c7eae370 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Form.php @@ -65,13 +65,6 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder return $this->_coreRegistry->registry('current_invoice'); } - protected function _prepareLayout() - { - $trackingBlock = $this->getLayout()->createBlock('Magento\Sales\Block\Adminhtml\Order\Invoice\Create\Tracking'); - $this->setChild('tracking', $trackingBlock); - return parent::_prepareLayout(); - } - public function getSaveUrl() { return $this->getUrl('sales/*/save', array('order_id' => $this->getInvoice()->getOrderId())); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Tracking.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Tracking.php deleted file mode 100644 index 918ede84079..00000000000 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Invoice/Create/Tracking.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Sales - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Shipment tracking control form - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Sales\Block\Adminhtml\Order\Invoice\Create; - -class Tracking extends \Magento\Backend\Block\Template -{ - /** - * Core registry - * - * @var \Magento\Core\Model\Registry - */ - protected $_coreRegistry = null; - - /** - * @var \Magento\Shipping\Model\Config - */ - protected $_shippingConfig; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Shipping\Model\Config $shippingConfig - * @param \Magento\Core\Model\Registry $registry - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Shipping\Model\Config $shippingConfig, - \Magento\Core\Model\Registry $registry, - array $data = array() - ) { - $this->_shippingConfig = $shippingConfig; - $this->_coreRegistry = $registry; - parent::__construct($context, $data); - } - - public function _construct() - { - $this->setTemplate('order/invoice/create/tracking.phtml'); - } - - /** - * Prepares layout of block - * - * @return \Magento\Sales\Block\Adminhtml\Order\View\Giftmessage - */ - protected function _prepareLayout() - { - $this->addChild('add_button', 'Magento\Backend\Block\Widget\Button', array( - 'label' => __('Add Tracking Number'), - 'class' => '', - 'onclick' => 'trackingControl.add()' - )); - } - - /** - * Retrieve shipment model instance - * - * @return \Magento\Sales\Model\Order\Shipment - */ - public function getShipment() - { - return $this->_coreRegistry->registry('current_shipment'); - } - - /** - * Retrieve shipment model instance - * - * @return \Magento\Sales\Model\Order\Shipment - */ - public function getInvoice() - { - return $this->_coreRegistry->registry('current_invoice'); - } - - /** - * Retrieve - * - * @return unknown - */ - public function getCarriers() - { - - $carriers = array(); - $carrierInstances = $this->_shippingConfig->getAllCarriers( - $this->getInvoice()->getStoreId() - ); - $carriers['custom'] = __('Custom Value'); - foreach ($carrierInstances as $code => $carrier) { - if ($carrier->isTrackingAvailable()) { - $carriers[$code] = $carrier->getConfigData('title'); - } - } - return $carriers; - } -} diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php index 5e7bae068a1..5c01a6f55c9 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View.php @@ -296,7 +296,7 @@ class View extends \Magento\Backend\Block\Widget\Form\Container public function getShipUrl() { - return $this->getUrl('sales/order_shipment/start'); + return $this->getUrl('adminhtml/order_shipment/start'); } public function getCommentUrl() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Shipments.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Shipments.php index 79182e44b0f..9d7598bc97c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Shipments.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Shipments.php @@ -145,7 +145,7 @@ class Shipments public function getRowUrl($row) { return $this->getUrl( - '*/order_shipment/view', + 'adminhtml/order_shipment/view', array( 'shipment_id'=> $row->getId(), 'order_id' => $row->getOrderId() diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View.php index 1a69129c256..8661059a14a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View.php @@ -61,7 +61,7 @@ class View extends \Magento\Backend\Block\Widget\Container { $this->_addButton('back', array( 'label' => __('Back'), - 'onclick' => "setLocation('{$this->getUrl('adminhtml/*/')}')", + 'onclick' => "setLocation('{$this->getUrl('*/*/')}')", 'class' => 'back', )); @@ -70,7 +70,7 @@ class View extends \Magento\Backend\Block\Widget\Container // cancel if ($profile->canCancel()) { - $url = $this->getUrl('adminhtml/*/updateState', array('profile' => $profile->getId(), 'action' => 'cancel')); + $url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'cancel')); $this->_addButton('cancel', array( 'label' => __('Cancel'), 'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$url}')", @@ -80,7 +80,7 @@ class View extends \Magento\Backend\Block\Widget\Container // suspend if ($profile->canSuspend()) { - $url = $this->getUrl('adminhtml/*/updateState', array('profile' => $profile->getId(), 'action' => 'suspend')); + $url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'suspend')); $this->_addButton('suspend', array( 'label' => __('Suspend'), 'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$url}')", @@ -90,7 +90,7 @@ class View extends \Magento\Backend\Block\Widget\Container // activate if ($profile->canActivate()) { - $url = $this->getUrl('adminhtml/*/updateState', array('profile' => $profile->getId(), 'action' => 'activate')); + $url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'activate')); $this->_addButton('activate', array( 'label' => __('Activate'), 'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$url}')", @@ -100,7 +100,7 @@ class View extends \Magento\Backend\Block\Widget\Container // get update if ($profile->canFetchUpdate()) { - $url = $this->getUrl('adminhtml/*/updateProfile', array('profile' => $profile->getId(),)); + $url = $this->getUrl('*/*/updateProfile', array('profile' => $profile->getId(),)); $this->_addButton('update', array( 'label' => __('Get Update'), 'onclick' => "confirmSetLocation('{$confirmationMessage}', '{$url}')", diff --git a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Orders.php b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Orders.php index 7cfa36190f4..422dcefdea8 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Orders.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Recurring/Profile/View/Tab/Orders.php @@ -216,7 +216,7 @@ class Orders public function getTabUrl() { $recurringProfile = $this->_coreRegistry->registry('current_recurring_profile'); - return $this->getUrl('adminhtml/*/orders', array('profile' => $recurringProfile->getId())); + return $this->getUrl('*/*/orders', array('profile' => $recurringProfile->getId())); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Shipment/Grid.php b/app/code/Magento/Sales/Block/Adminhtml/Shipment/Grid.php index 1082ce1f26d..f69d9a75fae 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Shipment/Grid.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Shipment/Grid.php @@ -206,7 +206,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended $this->getMassactionBlock()->addItem('print_shipping_label', array( 'label' => __('Print Shipping Labels'), - 'url' => $this->getUrl('sales/order_shipment/massPrintShippingLabel'), + 'url' => $this->getUrl('adminhtml/order_shipment/massPrintShippingLabel'), )); return $this; diff --git a/app/code/Magento/Sales/Block/Billing/Agreement/View.php b/app/code/Magento/Sales/Block/Billing/Agreement/View.php index 0a5c566d633..59a5c435e2b 100644 --- a/app/code/Magento/Sales/Block/Billing/Agreement/View.php +++ b/app/code/Magento/Sales/Block/Billing/Agreement/View.php @@ -105,6 +105,7 @@ class View extends \Magento\View\Element\Template $this->_orderConfig = $orderConfig; $this->_coreRegistry = $registry; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Sales/Block/Billing/Agreements.php b/app/code/Magento/Sales/Block/Billing/Agreements.php index c82fff5e6a5..d1acdb29487 100644 --- a/app/code/Magento/Sales/Block/Billing/Agreements.php +++ b/app/code/Magento/Sales/Block/Billing/Agreements.php @@ -80,6 +80,7 @@ class Agreements extends \Magento\View\Element\Template $this->_customerSession = $customerSession; $this->_agreementCollection = $agreementCollection; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Sales/Block/Guest/Link.php b/app/code/Magento/Sales/Block/Guest/Link.php index 4e05f59da13..b4fb1d11edd 100644 --- a/app/code/Magento/Sales/Block/Guest/Link.php +++ b/app/code/Magento/Sales/Block/Guest/Link.php @@ -48,6 +48,7 @@ class Link extends \Magento\View\Element\Html\Link\Current ) { parent::__construct($context, $defaultPath, $data); $this->_customerSession = $customerSession; + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Sales/Block/Order/Comments.php b/app/code/Magento/Sales/Block/Order/Comments.php index b9eff231c7f..d199ceb686c 100644 --- a/app/code/Magento/Sales/Block/Order/Comments.php +++ b/app/code/Magento/Sales/Block/Order/Comments.php @@ -27,19 +27,21 @@ namespace Magento\Sales\Block\Order; class Comments extends \Magento\View\Element\Template { + /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Sales\Model\ResourceFactory $resourceFactory - * @param array $data + * @var \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory */ - public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Sales\Model\ResourceFactory $resourceFactory, - array $data = array() - ) { - $this->_resourceFactory = $resourceFactory; - parent::__construct($context, $data); - } + protected $_invoiceCollectionFactory; + + /** + * @var \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory + */ + protected $_memoCollectionFactory; + + /** + * @var \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory + */ + protected $_shipmentCollectionFactory; /** * Current entity (model instance) with getCommentsCollection() method @@ -55,6 +57,26 @@ class Comments extends \Magento\View\Element\Template */ protected $_commentCollection; + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $invoiceCollectionFactory + * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $memoCollectionFactory + * @param \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $shipmentCollectionFactory + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $invoiceCollectionFactory, + \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $memoCollectionFactory, + \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $shipmentCollectionFactory, + array $data = array() + ) { + parent::__construct($context, $data); + $this->_invoiceCollectionFactory = $invoiceCollectionFactory; + $this->_memoCollectionFactory = $memoCollectionFactory; + $this->_shipmentCollectionFactory = $shipmentCollectionFactory; + } + /** * Sets comments parent model instance * @@ -89,16 +111,15 @@ class Comments extends \Magento\View\Element\Template if (is_null($this->_commentCollection)) { $entity = $this->getEntity(); if ($entity instanceof \Magento\Sales\Model\Order\Invoice) { - $collectionClass = 'Magento\Sales\Model\Resource\Order\Invoice\Comment\Collection'; + $this->_commentCollection = $this->_invoiceCollectionFactory->create(); } else if ($entity instanceof \Magento\Sales\Model\Order\Creditmemo) { - $collectionClass = 'Magento\Sales\Model\Resource\Order\Creditmemo\Comment\Collection'; + $this->_commentCollection = $this->_memoCollectionFactory->create(); } else if ($entity instanceof \Magento\Sales\Model\Order\Shipment) { - $collectionClass = 'Magento\Sales\Model\Resource\Order\Shipment\Comment\Collection'; + $this->_commentCollection = $this->_shipmentCollectionFactory->create(); } else { throw new \Magento\Core\Exception(__('We found an invalid entity model.')); } - $this->_commentCollection = $this->_resourceFactory->create($collectionClass); $this->_commentCollection->setParentFilter($entity) ->setCreatedAtOrder() ->addVisibleOnFrontFilter(); diff --git a/app/code/Magento/Sales/Block/Order/Creditmemo.php b/app/code/Magento/Sales/Block/Order/Creditmemo.php index 4bc8fad1550..5051f6b8e15 100644 --- a/app/code/Magento/Sales/Block/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Block/Order/Creditmemo.php @@ -67,6 +67,7 @@ class Creditmemo extends \Magento\Sales\Block\Order\Creditmemo\Items $this->_paymentHelper = $paymentHelper; $this->_customerSession = $customerSession; parent::__construct($context, $registry, $data); + $this->_isScopePrivate = true; } protected function _prepareLayout() diff --git a/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php b/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php index b8f17de366f..9609d7a6789 100644 --- a/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php +++ b/app/code/Magento/Sales/Block/Order/Creditmemo/Totals.php @@ -27,6 +27,20 @@ namespace Magento\Sales\Block\Order\Creditmemo; class Totals extends \Magento\Sales\Block\Order\Totals { + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Core\Model\Registry $registry, + array $data = array() + ) { + parent::__construct($context, $registry, $data); + $this->_isScopePrivate = true; + } + protected $_creditmemo = null; public function getCreditmemo() diff --git a/app/code/Magento/Sales/Block/Order/History.php b/app/code/Magento/Sales/Block/Order/History.php index bda9b94898c..35dc5af2772 100644 --- a/app/code/Magento/Sales/Block/Order/History.php +++ b/app/code/Magento/Sales/Block/Order/History.php @@ -69,6 +69,7 @@ class History extends \Magento\View\Element\Template $this->_customerSession = $customerSession; $this->_orderConfig = $orderConfig; parent::__construct($context, $data); + $this->_isScopePrivate = true; } protected function _construct() diff --git a/app/code/Magento/Sales/Block/Order/Info/Buttons.php b/app/code/Magento/Sales/Block/Order/Info/Buttons.php index 4314569c5bb..e78513db515 100644 --- a/app/code/Magento/Sales/Block/Order/Info/Buttons.php +++ b/app/code/Magento/Sales/Block/Order/Info/Buttons.php @@ -64,6 +64,7 @@ class Buttons extends \Magento\View\Element\Template $this->_coreRegistry = $registry; $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Sales/Block/Order/Invoice.php b/app/code/Magento/Sales/Block/Order/Invoice.php index 9d81a7d6a11..4b84a76d58a 100644 --- a/app/code/Magento/Sales/Block/Order/Invoice.php +++ b/app/code/Magento/Sales/Block/Order/Invoice.php @@ -63,6 +63,7 @@ class Invoice extends \Magento\Sales\Block\Order\Invoice\Items $this->_paymentHelper = $paymentHelper; $this->_customerSession = $customerSession; parent::__construct($context, $registry, $data); + $this->_isScopePrivate = true; } protected function _prepareLayout() diff --git a/app/code/Magento/Sales/Block/Order/Invoice/Totals.php b/app/code/Magento/Sales/Block/Order/Invoice/Totals.php index 7baa2122364..b762ef093fc 100644 --- a/app/code/Magento/Sales/Block/Order/Invoice/Totals.php +++ b/app/code/Magento/Sales/Block/Order/Invoice/Totals.php @@ -27,6 +27,20 @@ namespace Magento\Sales\Block\Order\Invoice; class Totals extends \Magento\Sales\Block\Order\Totals { + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Core\Model\Registry $registry, + array $data = array() + ) { + parent::__construct($context, $registry, $data); + $this->_isScopePrivate = true; + } + protected $_invoice = null; public function getInvoice() diff --git a/app/code/Magento/Sales/Block/Order/Recent.php b/app/code/Magento/Sales/Block/Order/Recent.php index f3836b65498..312f041bdec 100644 --- a/app/code/Magento/Sales/Block/Order/Recent.php +++ b/app/code/Magento/Sales/Block/Order/Recent.php @@ -64,6 +64,7 @@ class Recent extends \Magento\View\Element\Template $this->_customerSession = $customerSession; $this->_orderConfig = $orderConfig; parent::__construct($context, $data); + $this->_isScopePrivate = true; } protected function _construct() diff --git a/app/code/Magento/Sales/Block/Order/View.php b/app/code/Magento/Sales/Block/Order/View.php index 45e04e584ca..764853bf3d0 100644 --- a/app/code/Magento/Sales/Block/Order/View.php +++ b/app/code/Magento/Sales/Block/Order/View.php @@ -71,6 +71,7 @@ class View extends \Magento\View\Element\Template $this->_coreRegistry = $registry; $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } protected function _prepareLayout() diff --git a/app/code/Magento/Sales/Block/Payment/Form/Billing/Agreement.php b/app/code/Magento/Sales/Block/Payment/Form/Billing/Agreement.php index 25f7d4b33a7..9e483abd502 100644 --- a/app/code/Magento/Sales/Block/Payment/Form/Billing/Agreement.php +++ b/app/code/Magento/Sales/Block/Payment/Form/Billing/Agreement.php @@ -53,6 +53,7 @@ class Agreement extends \Magento\Payment\Block\Form ) { $this->_agreementFactory = $agreementFactory; parent::__construct($context, $data); + $this->_isScopePrivate = true; } protected function _construct() diff --git a/app/code/Magento/Sales/Block/Recurring/Profile/Grid.php b/app/code/Magento/Sales/Block/Recurring/Profile/Grid.php index 3a68d1e93cc..af49a62aaec 100644 --- a/app/code/Magento/Sales/Block/Recurring/Profile/Grid.php +++ b/app/code/Magento/Sales/Block/Recurring/Profile/Grid.php @@ -63,7 +63,7 @@ class Grid extends \Magento\Sales\Block\Recurring\Profiles $this->_recurringProfile = $profile; $this->_registry = $registry; parent::__construct($context, $data); - + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Sales/Block/Recurring/Profile/Related/Orders/Grid.php b/app/code/Magento/Sales/Block/Recurring/Profile/Related/Orders/Grid.php index 8fdc585f618..73ea983ea6a 100644 --- a/app/code/Magento/Sales/Block/Recurring/Profile/Related/Orders/Grid.php +++ b/app/code/Magento/Sales/Block/Recurring/Profile/Related/Orders/Grid.php @@ -65,6 +65,7 @@ class Grid extends \Magento\Sales\Block\Recurring\Profile\View parent::__construct($context, $registry, $data); $this->_orderCollection = $collection; $this->_config = $config; + $this->_isScopePrivate = true; } /** * Prepare related orders collection diff --git a/app/code/Magento/Sales/Block/Recurring/Profiles.php b/app/code/Magento/Sales/Block/Recurring/Profiles.php index 7f69a54463f..39d2dcacdf3 100644 --- a/app/code/Magento/Sales/Block/Recurring/Profiles.php +++ b/app/code/Magento/Sales/Block/Recurring/Profiles.php @@ -32,6 +32,18 @@ namespace Magento\Sales\Block\Recurring; class Profiles extends \Magento\View\Element\Template { + /** + * @param \Magento\View\Element\Template\Context $context + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + array $data = array() + ) { + parent::__construct($context, $data); + $this->_isScopePrivate = true; + } + /** * Set back Url * diff --git a/app/code/Magento/Sales/Block/Reorder/Sidebar.php b/app/code/Magento/Sales/Block/Reorder/Sidebar.php index 86dcad5fb2c..feef9f90c6c 100644 --- a/app/code/Magento/Sales/Block/Reorder/Sidebar.php +++ b/app/code/Magento/Sales/Block/Reorder/Sidebar.php @@ -69,6 +69,7 @@ class Sidebar extends \Magento\View\Element\Template $this->_orderConfig = $orderConfig; $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Sales/Block/Widget/Guest/Form.php b/app/code/Magento/Sales/Block/Widget/Guest/Form.php index c86887ae55e..4b5464bc055 100644 --- a/app/code/Magento/Sales/Block/Widget/Guest/Form.php +++ b/app/code/Magento/Sales/Block/Widget/Guest/Form.php @@ -50,6 +50,7 @@ class Form ) { $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo.php b/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo.php index 9b703cfebe4..b87a90e317c 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo.php @@ -131,7 +131,7 @@ class AbstractCreditmemo extends \Magento\Backend\App\Action return $this->_fileFactory->create( 'creditmemo' . $date . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } @@ -151,7 +151,7 @@ class AbstractCreditmemo extends \Magento\Backend\App\Action return $this->_fileFactory->create( 'creditmemo' . $date . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice.php b/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice.php index 282aa1dc44e..2aa4d18f581 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Invoice/AbstractInvoice.php @@ -133,7 +133,7 @@ class AbstractInvoice return $this->_fileFactory->create( 'invoice' . $date . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } @@ -161,7 +161,7 @@ class AbstractInvoice return $this->_fileFactory->create( 'invoice' . $date . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order.php b/app/code/Magento/Sales/Controller/Adminhtml/Order.php index e580e81b29e..f5de7c9f885 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order.php @@ -529,7 +529,7 @@ class Order extends \Magento\Backend\App\Action return $this->_fileFactory->create( 'invoice' . $this->_objectManager->get('Magento\Core\Model\Date')->date('Y-m-d_H-i-s') . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } else { @@ -568,7 +568,7 @@ class Order extends \Magento\Backend\App\Action return $this->_fileFactory->create( 'packingslip' . $this->_objectManager->get('Magento\Core\Model\Date')->date('Y-m-d_H-i-s') . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } else { @@ -607,7 +607,7 @@ class Order extends \Magento\Backend\App\Action return $this->_fileFactory->create( 'creditmemo' . $this->_objectManager->get('Magento\Core\Model\Date')->date('Y-m-d_H-i-s') . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } else { @@ -672,7 +672,7 @@ class Order extends \Magento\Backend\App\Action return $this->_fileFactory->create( 'docs' . $this->_objectManager->get('Magento\Core\Model\Date')->date('Y-m-d_H-i-s') . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } else { @@ -761,7 +761,7 @@ class Order extends \Magento\Backend\App\Action $fileName = 'orders.csv'; /** @var \Magento\Backend\Block\Widget\Grid\ExportInterface $exportBlock */ $exportBlock = $this->_view->getLayout()->getChildBlock('sales.order.grid', 'grid.export'); - return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $exportBlock->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -776,7 +776,7 @@ class Order extends \Magento\Backend\App\Action return $this->_fileFactory->create( $fileName, $exportBlock->getExcelFile($fileName), - \Magento\Filesystem::VAR_DIR + \Magento\App\Filesystem::VAR_DIR ); } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment.php b/app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment.php index 15456ce7a7e..f17d5d24517 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Shipment/AbstractShipment.php @@ -81,7 +81,7 @@ class AbstractShipment extends \Magento\Backend\App\Action public function viewAction() { if ($shipmentId = $this->getRequest()->getParam('shipment_id')) { - $this->_forward('view', 'order_shipment', null, array('come_from'=>'shipment')); + $this->_forward('view', 'order_shipment', 'admin', array('come_from'=>'shipment')); } else { $this->_forward('noroute'); } @@ -105,7 +105,7 @@ class AbstractShipment extends \Magento\Backend\App\Action return $this->_fileFactory->create( 'packingslip' . $date . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } @@ -114,9 +114,8 @@ class AbstractShipment extends \Magento\Backend\App\Action public function printAction() { - /** @see \Magento\Sales\Controller\Adminhtml\Order\Invoice */ - $shipmentId = $this->getRequest()->getParam('invoice_id'); - if ($shipmentId) { // invoice_id o_0 + $shipmentId = $this->getRequest()->getParam('shipment_id'); + if ($shipmentId) { $shipment = $this->_objectManager->create('Magento\Sales\Model\Order\Shipment')->load($shipmentId); if ($shipment) { $pdf = $this->_objectManager->create('Magento\Sales\Model\Order\Pdf\Shipment') @@ -125,7 +124,7 @@ class AbstractShipment extends \Magento\Backend\App\Action return $this->_fileFactory->create( 'packingslip' . $date . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } diff --git a/app/code/Magento/Sales/Controller/Download.php b/app/code/Magento/Sales/Controller/Download.php index 14c38e37d5f..bd55866e0de 100644 --- a/app/code/Magento/Sales/Controller/Download.php +++ b/app/code/Magento/Sales/Controller/Download.php @@ -43,19 +43,19 @@ class Download extends \Magento\App\Action\Action /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; /** * @param \Magento\App\Action\Context $context * @param \Magento\App\Response\Http\FileFactory $fileResponseFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\App\Action\Context $context, \Magento\App\Response\Http\FileFactory $fileResponseFactory, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_fileResponseFactory = $fileResponseFactory; $this->_filesystem = $filesystem; @@ -76,8 +76,8 @@ class Download extends \Magento\App\Action\Action } /** @var \Magento\Filesystem\Directory\Read $directory */ - $directory = $this->_objectManager->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::ROOT); + $directory = $this->_objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $relativePath = $info['order_path']; $filePath = $directory->getAbsolutePath($relativePath); @@ -99,7 +99,7 @@ class Download extends \Magento\App\Action\Action 'value' => $filePath, 'type' => 'filename' ), - \Magento\Filesystem::ROOT + \Magento\App\Filesystem::ROOT_DIR ); } catch (\Exception $e) { $this->_forward('noroute'); @@ -128,8 +128,8 @@ class Download extends \Magento\App\Action\Action } /** @var \Magento\Filesystem\Directory\WriteInterface $directory */ - $directory = $this->_objectManager->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::ROOT); + $directory = $this->_objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $stream = $directory->openFile($filePath, 'w+'); $stream->lock(); $stream->write($filePath, $file->getContent()); diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 431f2f3f468..57913eee0c3 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -831,7 +831,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car \Magento\Catalog\Model\Product\Type\AbstractType::PROCESS_MODE_FULL ); if (is_string($item)) { - if ($product->getTypeId() != \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE) { + if ($product->getTypeId() != \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) { $item = $this->getQuote()->addProductAdvanced( $product, $config, diff --git a/app/code/Magento/Sales/Model/CarrierFactory.php b/app/code/Magento/Sales/Model/CarrierFactory.php deleted file mode 100644 index 0573598caf2..00000000000 --- a/app/code/Magento/Sales/Model/CarrierFactory.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Sales - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Factory class for \Magento\Core\Model\AbstractModel - */ -namespace Magento\Sales\Model; - -class CarrierFactory -{ - /** - * Object Manager instance - * - * @var \Magento\ObjectManager - */ - protected $_objectManager = null; - - /** - * @var \Magento\Core\Model\StoreManagerInterface - */ - protected $_storeManager; - - /** - * Factory constructor - * - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - */ - public function __construct( - \Magento\ObjectManager $objectManager, - \Magento\Core\Model\StoreManagerInterface $storeManager - ) { - $this->_storeManager = $storeManager; - $this->_objectManager = $objectManager; - } - - /** - * Create class instance with specified parameters - * - * @param string $carrierCode - * @param array $data - * @return \Magento\Core\Model\AbstractModel|bool - */ - public function create($carrierCode, array $data = array()) - { - $className = $this->_storeManager->getStore()->getConfig('carriers/' . $carrierCode . '/model'); - if ($className) { - return $this->_objectManager->create($className, $data); - } - return false; - } -} diff --git a/app/code/Magento/Sales/Model/Observer.php b/app/code/Magento/Sales/Model/Observer.php index 52cd25f4310..d02f977bf3e 100644 --- a/app/code/Magento/Sales/Model/Observer.php +++ b/app/code/Magento/Sales/Model/Observer.php @@ -82,9 +82,24 @@ class Observer protected $_coreLocale; /** - * @var \Magento\Sales\Model\ResourceFactory + * @var Resource\Report\OrderFactory */ - protected $_resourceFactory; + protected $_orderFactory; + + /** + * @var \Magento\Sales\Model\Resource\Report\InvoicedFactory + */ + protected $_invoicedFactory; + + /** + * @var \Magento\Sales\Model\Resource\Report\RefundedFactory + */ + protected $_refundedFactory; + + /** + * @var \Magento\Sales\Model\Resource\Report\BestsellersFactory + */ + protected $_bestsellersFactory; /** * @param \Magento\Event\ManagerInterface $eventManager @@ -94,7 +109,10 @@ class Observer * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\Sales\Model\Resource\Quote\CollectionFactory $quoteFactory * @param \Magento\Core\Model\LocaleInterface $coreLocale - * @param \Magento\Sales\Model\ResourceFactory $resourceFactory + * @param Resource\Report\OrderFactory $orderFactory + * @param Resource\Report\InvoicedFactory $invoicedFactory + * @param Resource\Report\RefundedFactory $refundedFactory + * @param Resource\Report\BestsellersFactory $bestsellersFactory */ public function __construct( \Magento\Event\ManagerInterface $eventManager, @@ -104,7 +122,10 @@ class Observer \Magento\Core\Model\Store\Config $storeConfig, \Magento\Sales\Model\Resource\Quote\CollectionFactory $quoteFactory, \Magento\Core\Model\LocaleInterface $coreLocale, - \Magento\Sales\Model\ResourceFactory $resourceFactory + \Magento\Sales\Model\Resource\Report\OrderFactory $orderFactory, + \Magento\Sales\Model\Resource\Report\InvoicedFactory $invoicedFactory, + \Magento\Sales\Model\Resource\Report\RefundedFactory $refundedFactory, + \Magento\Sales\Model\Resource\Report\BestsellersFactory $bestsellersFactory ) { $this->_eventManager = $eventManager; $this->_customerData = $customerData; @@ -113,7 +134,10 @@ class Observer $this->_storeConfig = $storeConfig; $this->_quoteCollectionFactory = $quoteFactory; $this->_coreLocale = $coreLocale; - $this->_resourceFactory = $resourceFactory; + $this->_orderFactory = $orderFactory; + $this->_invoicedFactory = $invoicedFactory; + $this->_refundedFactory = $refundedFactory; + $this->_bestsellersFactory = $bestsellersFactory; } /** @@ -179,23 +203,7 @@ class Observer $this->_coreLocale->emulate(0); $currentDate = $this->_coreLocale->date(); $date = $currentDate->subHour(25); - $this->_resourceFactory->create('Magento\Sales\Model\Resource\Report\Order')->aggregate($date); - $this->_coreLocale->revert(); - return $this; - } - - /** - * Refresh sales shipment report statistics for last day - * - * @param \Magento\Cron\Model\Schedule $schedule - * @return \Magento\Sales\Model\Observer - */ - public function aggregateSalesReportShipmentData($schedule) - { - $this->_coreLocale->emulate(0); - $currentDate = $this->_coreLocale->date(); - $date = $currentDate->subHour(25); - $this->_resourceFactory->create('Magento\Sales\Model\Resource\Report\Shipping')->aggregate($date); + $this->_orderFactory->create()->aggregate($date); $this->_coreLocale->revert(); return $this; } @@ -211,7 +219,7 @@ class Observer $this->_coreLocale->emulate(0); $currentDate = $this->_coreLocale->date(); $date = $currentDate->subHour(25); - $this->_resourceFactory->create('Magento\Sales\Model\Resource\Report\Invoiced')->aggregate($date); + $this->_invoicedFactory->create()->aggregate($date); $this->_coreLocale->revert(); return $this; } @@ -227,7 +235,7 @@ class Observer $this->_coreLocale->emulate(0); $currentDate = $this->_coreLocale->date(); $date = $currentDate->subHour(25); - $this->_resourceFactory->create('Magento\Sales\Model\Resource\Report\Refunded')->aggregate($date); + $this->_refundedFactory->create()->aggregate($date); $this->_coreLocale->revert(); return $this; } @@ -243,7 +251,7 @@ class Observer $this->_coreLocale->emulate(0); $currentDate = $this->_coreLocale->date(); $date = $currentDate->subHour(25); - $this->_resourceFactory->create('Magento\Sales\Model\Resource\Report\Bestsellers')->aggregate($date); + $this->_bestsellersFactory->create()->aggregate($date); $this->_coreLocale->revert(); return $this; } diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index ab0267c725f..bf2d901e426 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -428,11 +428,6 @@ class Order extends \Magento\Sales\Model\AbstractModel */ protected $_storeManager; - /** - * @var \Magento\Sales\Model\ResourceFactory - */ - protected $_resourceFactory; - /** * @var \Magento\Sales\Model\Order\Config */ @@ -456,7 +451,7 @@ class Order extends \Magento\Sales\Model\AbstractModel /** * @var \Magento\Sales\Model\Resource\Order\Item\CollectionFactory */ - protected $_orderItemCollFactory; + protected $_orderItemCollectionFactory; /** * @var \Magento\Catalog\Model\Product\Visibility @@ -491,12 +486,42 @@ class Order extends \Magento\Sales\Model\AbstractModel /** * @var \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory */ - protected $_orderTaxCollFactory; + protected $_orderTaxCollectionFactory; + + /** + * @var Resource\Order\Address\CollectionFactory + */ + protected $_addressCollectionFactory; + + /** + * @var Resource\Order\Payment\CollectionFactory + */ + protected $_paymentCollectionFactory; + + /** + * @var Resource\Order\Status\History\CollectionFactory + */ + protected $_historyCollectionFactory; /** - * @var \Magento\Sales\Model\CarrierFactory + * @var Resource\Order\Invoice\CollectionFactory */ - protected $_carrierFactory; + protected $_invoiceCollectionFactory; + + /** + * @var Resource\Order\Shipment\CollectionFactory + */ + protected $_shipmentCollectionFactory; + + /** + * @var Resource\Order\Creditmemo\CollectionFactory + */ + protected $_memoCollectionFactory; + + /** + * @var Resource\Order\Shipment\Track\CollectionFactory + */ + protected $_trackCollectionFactory; /** * @param \Magento\Core\Model\Context $context @@ -507,20 +532,25 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param \Magento\Sales\Helper\Data $salesData * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Sales\Model\ResourceFactory $resourceFactory - * @param \Magento\Sales\Model\Order\Config $orderConfig + * @param Order\Config $orderConfig * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Email\Model\Template\MailerFactory $templateMailerFactory * @param \Magento\Email\Model\InfoFactory $emailInfoFactory - * @param \Magento\Sales\Model\Resource\Order\Item\CollectionFactory $orderItemCollFactory + * @param Resource\Order\Item\CollectionFactory $orderItemCollectionFactory * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Tax\Model\Calculation $taxCalculation - * @param \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory + * @param Service\OrderFactory $serviceOrderFactory * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory - * @param \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $orderTaxCollFactory - * @param \Magento\Sales\Model\CarrierFactory $carrierFactory + * @param Order\Status\HistoryFactory $orderHistoryFactory + * @param \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $orderTaxCollectionFactory + * @param Resource\Order\Address\CollectionFactory $addressCollectionFactory + * @param Resource\Order\Payment\CollectionFactory $paymentCollectionFactory + * @param Resource\Order\Status\History\CollectionFactory $historyCollectionFactory + * @param Resource\Order\Invoice\CollectionFactory $invoiceCollectionFactory + * @param Resource\Order\Shipment\CollectionFactory $shipmentCollectionFactory + * @param Resource\Order\Creditmemo\CollectionFactory $memoCollectionFactory + * @param Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -534,20 +564,25 @@ class Order extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Helper\Data $salesData, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Sales\Model\ResourceFactory $resourceFactory, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Email\Model\Template\MailerFactory $templateMailerFactory, \Magento\Email\Model\InfoFactory $emailInfoFactory, - \Magento\Sales\Model\Resource\Order\Item\CollectionFactory $orderItemCollFactory, + \Magento\Sales\Model\Resource\Order\Item\CollectionFactory $orderItemCollectionFactory, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Tax\Model\Calculation $taxCalculation, \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Eav\Model\Config $eavConfig, \Magento\Sales\Model\Order\Status\HistoryFactory $orderHistoryFactory, - \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $orderTaxCollFactory, - \Magento\Sales\Model\CarrierFactory $carrierFactory, + \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $orderTaxCollectionFactory, + \Magento\Sales\Model\Resource\Order\Address\CollectionFactory $addressCollectionFactory, + \Magento\Sales\Model\Resource\Order\Payment\CollectionFactory $paymentCollectionFactory, + \Magento\Sales\Model\Resource\Order\Status\History\CollectionFactory $historyCollectionFactory, + \Magento\Sales\Model\Resource\Order\Invoice\CollectionFactory $invoiceCollectionFactory, + \Magento\Sales\Model\Resource\Order\Shipment\CollectionFactory $shipmentCollectionFactory, + \Magento\Sales\Model\Resource\Order\Creditmemo\CollectionFactory $memoCollectionFactory, + \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -556,20 +591,25 @@ class Order extends \Magento\Sales\Model\AbstractModel $this->_salesData = $salesData; $this->_coreStoreConfig = $coreStoreConfig; $this->_storeManager = $storeManager; - $this->_resourceFactory = $resourceFactory; $this->_orderConfig = $orderConfig; $this->_productFactory = $productFactory; $this->_templateMailerFactory = $templateMailerFactory; $this->_emailInfoFactory = $emailInfoFactory; - $this->_orderItemCollFactory = $orderItemCollFactory; + $this->_orderItemCollectionFactory = $orderItemCollectionFactory; $this->_productVisibility = $productVisibility; $this->_taxCalculation = $taxCalculation; $this->_serviceOrderFactory = $serviceOrderFactory; $this->_currencyFactory = $currencyFactory; $this->_eavConfig = $eavConfig; $this->_orderHistoryFactory = $orderHistoryFactory; - $this->_orderTaxCollFactory = $orderTaxCollFactory; - $this->_carrierFactory = $carrierFactory; + $this->_orderTaxCollectionFactory = $orderTaxCollectionFactory; + $this->_addressCollectionFactory = $addressCollectionFactory; + $this->_paymentCollectionFactory = $paymentCollectionFactory; + $this->_historyCollectionFactory = $historyCollectionFactory; + $this->_invoiceCollectionFactory = $invoiceCollectionFactory; + $this->_shipmentCollectionFactory = $shipmentCollectionFactory; + $this->_memoCollectionFactory = $memoCollectionFactory; + $this->_trackCollectionFactory = $trackCollectionFactory; parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data); } @@ -1364,28 +1404,6 @@ class Order extends \Magento\Sales\Model\AbstractModel return array(); } - /** - * Return model of shipping carrier - * - * @return bool|float|\Magento\Shipping\Model\Carrier\AbstractCarrier - */ - public function getShippingCarrier() - { - $carrierModel = $this->getData('shipping_carrier'); - if (is_null($carrierModel)) { - $carrierModel = false; - /** - * $method - carrier_method - */ - $method = $this->getShippingMethod(true); - if ($method instanceof \Magento\Object) { - $carrierModel = $this->_carrierFactory->create($method->getCarrierCode()); - } - $this->setData('shipping_carrier', $carrierModel); - } - return $carrierModel; - } - /** * Retrieve shipping method * @@ -1561,7 +1579,7 @@ class Order extends \Magento\Sales\Model\AbstractModel public function getAddressesCollection() { if (is_null($this->_addresses)) { - $this->_addresses = $this->_resourceFactory->create('Magento\Sales\Model\Resource\Order\Address\Collection') + $this->_addresses = $this->_addressCollectionFactory->create() ->setOrderFilter($this); if ($this->getId()) { @@ -1606,7 +1624,7 @@ class Order extends \Magento\Sales\Model\AbstractModel public function getItemsCollection($filterByTypes = array(), $nonChildrenOnly = false) { if (is_null($this->_items)) { - $this->_items = $this->_resourceFactory->create('Magento\Sales\Model\Resource\Order\Item\Collection') + $this->_items = $this->_orderItemCollectionFactory->create() ->setOrderFilter($this); if ($filterByTypes) { @@ -1656,7 +1674,7 @@ class Order extends \Magento\Sales\Model\AbstractModel */ protected function _getItemsRandomCollection($limit, $nonChildrenOnly = false) { - $collection = $this->_orderItemCollFactory->create() + $collection = $this->_orderItemCollectionFactory->create() ->setOrderFilter($this) ->setRandomOrder(); @@ -1766,7 +1784,7 @@ class Order extends \Magento\Sales\Model\AbstractModel public function getPaymentsCollection() { if (is_null($this->_payments)) { - $this->_payments = $this->_resourceFactory->create('Magento\Sales\Model\Resource\Order\Payment\Collection') + $this->_payments = $this->_paymentCollectionFactory->create() ->setOrderFilter($this); if ($this->getId()) { @@ -1833,7 +1851,7 @@ class Order extends \Magento\Sales\Model\AbstractModel public function getStatusHistoryCollection($reload = false) { if (is_null($this->_statusHistory) || $reload) { - $this->_statusHistory = $this->_resourceFactory->create('Magento\Sales\Model\Resource\Order\Status\History\Collection') + $this->_statusHistory = $this->_historyCollectionFactory->create() ->setOrderFilter($this) ->setOrder('created_at', 'desc') ->setOrder('entity_id', 'desc'); @@ -2057,7 +2075,7 @@ class Order extends \Magento\Sales\Model\AbstractModel public function getInvoiceCollection() { if (is_null($this->_invoices)) { - $this->_invoices = $this->_resourceFactory->create('Magento\Sales\Model\Resource\Order\Invoice\Collection') + $this->_invoices = $this->_invoiceCollectionFactory->create() ->setOrderFilter($this); if ($this->getId()) { @@ -2078,8 +2096,7 @@ class Order extends \Magento\Sales\Model\AbstractModel { if (empty($this->_shipments)) { if ($this->getId()) { - $this->_shipments = $this->_resourceFactory - ->create('Magento\Sales\Model\Resource\Order\Shipment\Collection') + $this->_shipments = $this->_shipmentCollectionFactory->create() ->setOrderFilter($this) ->load(); } else { @@ -2098,7 +2115,7 @@ class Order extends \Magento\Sales\Model\AbstractModel { if (empty($this->_creditmemos)) { if ($this->getId()) { - $this->_creditmemos = $this->_resourceFactory->create('Magento\Sales\Model\Resource\Order\Creditmemo\Collection') + $this->_creditmemos = $this->_memoCollectionFactory->create() ->setOrderFilter($this) ->load(); } else { @@ -2116,7 +2133,7 @@ class Order extends \Magento\Sales\Model\AbstractModel public function getTracksCollection() { if (empty($this->_tracks)) { - $this->_tracks = $this->_resourceFactory->create('Magento\Sales\Model\Resource\Order\Shipment\Track\Collection') + $this->_tracks = $this->_trackCollectionFactory->create() ->setOrderFilter($this); if ($this->getId()) { @@ -2398,7 +2415,7 @@ class Order extends \Magento\Sales\Model\AbstractModel public function getFullTaxInfo() { - $rates = $this->_orderTaxCollFactory->create()->loadByOrder($this)->toArray(); + $rates = $this->_orderTaxCollectionFactory->create()->loadByOrder($this)->toArray(); return $this->_taxCalculation->reproduceProcess($rates['items']); } diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php index 06b2138a9a0..11618803ffb 100644 --- a/app/code/Magento/Sales/Model/Order/Config.php +++ b/app/code/Magento/Sales/Model/Order/Config.php @@ -56,20 +56,20 @@ class Config /** * @var \Magento\Sales\Model\Resource\Order\Status\CollectionFactory */ - protected $_orderStatusCollFactory; + protected $_orderStatusCollectionFactory; /** * Constructor * * @param \Magento\Sales\Model\Order\StatusFactory $orderStatusFactory - * @param \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $orderStatusCollFactory + * @param \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $orderStatusCollectionFactory */ public function __construct( \Magento\Sales\Model\Order\StatusFactory $orderStatusFactory, - \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $orderStatusCollFactory + \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $orderStatusCollectionFactory ) { $this->_orderStatusFactory = $orderStatusFactory; - $this->_orderStatusCollFactory = $orderStatusCollFactory; + $this->_orderStatusCollectionFactory = $orderStatusCollectionFactory; } /** @@ -78,7 +78,7 @@ class Config protected function _getCollection() { if ($this->_collection == null) { - $this->_collection = $this->_orderStatusCollFactory->create()->joinStates(); + $this->_collection = $this->_orderStatusCollectionFactory->create()->joinStates(); } return $this->_collection; } @@ -149,7 +149,7 @@ class Config */ public function getStatuses() { - $statuses = $this->_orderStatusCollFactory->create()->toOptionHash(); + $statuses = $this->_orderStatusCollectionFactory->create()->toOptionHash(); return $statuses; } @@ -191,7 +191,7 @@ class Config foreach ($state as $_state) { $stateNode = $this->_getState($_state); if ($stateNode) { - $collection = $this->_orderStatusCollFactory->create() + $collection = $this->_orderStatusCollectionFactory->create() ->addStateFilter($_state) ->orderByLabel(); foreach ($collection as $item) { diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index f8f57b3ddcf..f36e6c94b5a 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -199,7 +199,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel /** * @var \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory */ - protected $_cmItemCollFactory; + protected $_cmItemCollectionFactory; /** * @var \Magento\Core\Model\CalculatorFactory @@ -219,7 +219,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel /** * @var \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory */ - protected $_commentCollFactory; + protected $_commentCollectionFactory; /** * @var \Magento\Email\Model\Template\MailerFactory @@ -241,11 +241,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Sales\Model\Order\Creditmemo\Config $creditmemoConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollFactory + * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory * @param \Magento\Core\Model\CalculatorFactory $calculatorFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Order\Creditmemo\CommentFactory $commentFactory - * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollFactory + * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Email\Model\Template\MailerFactory $templateMailerFactory * @param \Magento\Email\Model\InfoFactory $emailInfoFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource @@ -262,11 +262,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Sales\Model\Order\Creditmemo\Config $creditmemoConfig, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollFactory, + \Magento\Sales\Model\Resource\Order\Creditmemo\Item\CollectionFactory $cmItemCollectionFactory, \Magento\Core\Model\CalculatorFactory $calculatorFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\Creditmemo\CommentFactory $commentFactory, - \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollFactory, + \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory, \Magento\Email\Model\Template\MailerFactory $templateMailerFactory, \Magento\Email\Model\InfoFactory $emailInfoFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, @@ -278,11 +278,11 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel $this->_coreStoreConfig = $coreStoreConfig; $this->_creditmemoConfig = $creditmemoConfig; $this->_orderFactory = $orderFactory; - $this->_cmItemCollFactory = $cmItemCollFactory; + $this->_cmItemCollectionFactory = $cmItemCollectionFactory; $this->_calculatorFactory = $calculatorFactory; $this->_storeManager = $storeManager; $this->_commentFactory = $commentFactory; - $this->_commentCollFactory = $commentCollFactory; + $this->_commentCollectionFactory = $commentCollectionFactory; $this->_templateMailerFactory = $templateMailerFactory; $this->_emailInfoFactory = $emailInfoFactory; parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data); @@ -366,7 +366,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel public function getItemsCollection() { if (empty($this->_items)) { - $this->_items = $this->_cmItemCollFactory->create()->setCreditmemoFilter($this->getId()); + $this->_items = $this->_cmItemCollectionFactory->create()->setCreditmemoFilter($this->getId()); if ($this->getId()) { foreach ($this->_items as $item) { @@ -805,7 +805,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel public function getCommentsCollection($reload = false) { if (is_null($this->_comments) || $reload) { - $this->_comments = $this->_commentCollFactory->create() + $this->_comments = $this->_commentCollectionFactory->create() ->setCreditmemoFilter($this->getId()) ->setCreatedAtOrder(); /** diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php index 9c002cb9f89..d16d3a411e8 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Invoice.php @@ -215,7 +215,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel /** * @var \Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory */ - protected $_invoiceItemCollFactory; + protected $_invoiceItemCollectionFactory; /** * @var \Magento\Sales\Model\Order\Invoice\CommentFactory @@ -225,7 +225,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel /** * @var \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory */ - protected $_commentCollFactory; + protected $_commentCollectionFactory; /** * @var \Magento\Email\Model\Template\MailerFactory @@ -249,9 +249,9 @@ class Invoice extends \Magento\Sales\Model\AbstractModel * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Resource\OrderFactory $orderResourceFactory * @param \Magento\Core\Model\CalculatorFactory $calculatorFactory - * @param \Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory $invoiceItemCollFactory + * @param \Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory $invoiceItemCollectionFactory * @param \Magento\Sales\Model\Order\Invoice\CommentFactory $invoiceCommentFactory - * @param \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollFactory + * @param \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Email\Model\Template\MailerFactory $templateMailerFactory * @param \Magento\Email\Model\InfoFactory $emailInfoFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource @@ -270,9 +270,9 @@ class Invoice extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Resource\OrderFactory $orderResourceFactory, \Magento\Core\Model\CalculatorFactory $calculatorFactory, - \Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory $invoiceItemCollFactory, + \Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory $invoiceItemCollectionFactory, \Magento\Sales\Model\Order\Invoice\CommentFactory $invoiceCommentFactory, - \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollFactory, + \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory, \Magento\Email\Model\Template\MailerFactory $templateMailerFactory, \Magento\Email\Model\InfoFactory $emailInfoFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, @@ -286,9 +286,9 @@ class Invoice extends \Magento\Sales\Model\AbstractModel $this->_orderFactory = $orderFactory; $this->_orderResourceFactory = $orderResourceFactory; $this->_calculatorFactory = $calculatorFactory; - $this->_invoiceItemCollFactory = $invoiceItemCollFactory; + $this->_invoiceItemCollectionFactory = $invoiceItemCollectionFactory; $this->_invoiceCommentFactory = $invoiceCommentFactory; - $this->_commentCollFactory = $commentCollFactory; + $this->_commentCollectionFactory = $commentCollectionFactory; $this->_templateMailerFactory = $templateMailerFactory; $this->_emailInfoFactory = $emailInfoFactory; parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data); @@ -615,7 +615,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel public function getItemsCollection() { if (empty($this->_items)) { - $this->_items = $this->_invoiceItemCollFactory->create()->setInvoiceFilter($this->getId()); + $this->_items = $this->_invoiceItemCollectionFactory->create()->setInvoiceFilter($this->getId()); if ($this->getId()) { foreach ($this->_items as $item) { @@ -832,7 +832,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel public function getCommentsCollection($reload=false) { if (is_null($this->_comments) || $reload) { - $this->_comments = $this->_commentCollFactory->create() + $this->_comments = $this->_commentCollectionFactory->create() ->setInvoiceFilter($this->getId()) ->setCreatedAtOrder(); /** diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index 2e081f36d51..8bbddead84e 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -197,7 +197,7 @@ class Payment extends \Magento\Payment\Model\Info /** * @var \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory */ - protected $_transactionCollFactory; + protected $_transactionCollectionFactory; /** * @var \Magento\Sales\Model\Billing\AgreementFactory @@ -216,7 +216,7 @@ class Payment extends \Magento\Payment\Model\Info * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory * @param \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory - * @param \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollFactory + * @param \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollectionFactory * @param \Magento\Sales\Model\Billing\AgreementFactory $agreementFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Resource\AbstractResource $resource @@ -230,7 +230,7 @@ class Payment extends \Magento\Payment\Model\Info \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Sales\Model\Service\OrderFactory $serviceOrderFactory, \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory, - \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollFactory, + \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollectionFactory, \Magento\Sales\Model\Billing\AgreementFactory $agreementFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Resource\AbstractResource $resource = null, @@ -239,7 +239,7 @@ class Payment extends \Magento\Payment\Model\Info ) { $this->_serviceOrderFactory = $serviceOrderFactory; $this->_transactionFactory = $transactionFactory; - $this->_transactionCollFactory = $transactionCollFactory; + $this->_transactionCollectionFactory = $transactionCollectionFactory; $this->_agreementFactory = $agreementFactory; $this->_storeManager = $storeManager; parent::__construct($context, $registry, $paymentData, $encryptor, $resource, $resourceCollection, $data); @@ -1418,7 +1418,7 @@ class Payment extends \Magento\Payment\Model\Info { if (!$txnId) { if ($txnType && $this->getId()) { - $collection = $this->_transactionCollFactory->create() + $collection = $this->_transactionCollectionFactory->create() ->setOrderFilter($this->getOrder()) ->addPaymentIdFilter($this->getId()) ->addTxnTypeFilter($txnType) diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index 35dd76853e9..99792b1db71 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -107,12 +107,6 @@ abstract class AbstractPdf extends \Magento\Object * @var \Magento\Filesystem\Directory\ReadInterface */ protected $_rootDirectory; - - /** - * @var \Magento\Shipping\Model\Config - */ - protected $_shippingConfig; - /** * @var \Magento\Sales\Model\Order\Pdf\Config */ @@ -133,8 +127,7 @@ abstract class AbstractPdf extends \Magento\Object * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate - * @param \Magento\Filesystem $filesystem - * @param \Magento\Shipping\Model\Config $shippingConfig + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory @@ -148,8 +141,7 @@ abstract class AbstractPdf extends \Magento\Object \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, - \Magento\Filesystem $filesystem, - \Magento\Shipping\Model\Config $shippingConfig, + \Magento\App\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, @@ -161,9 +153,8 @@ abstract class AbstractPdf extends \Magento\Object $this->string = $string; $this->_coreStoreConfig = $coreStoreConfig; $this->_translate = $translate; - $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); - $this->_rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); - $this->_shippingConfig = $shippingConfig; + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); + $this->_rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->_pdfConfig = $pdfConfig; $this->_pdfTotalFactory = $pdfTotalFactory; $this->_pdfItemsFactory = $pdfItemsFactory; @@ -559,20 +550,9 @@ abstract class AbstractPdf extends \Magento\Object $yShipments -= 20; $this->_setFontRegular($page, 8); foreach ($tracks as $track) { - - $carrierCode = $track->getCarrierCode(); - if ($carrierCode != 'custom') { - $carrier = $this->_shippingConfig->getCarrierInstance($carrierCode); - $carrierTitle = $carrier->getConfigData('title'); - } else { - $carrierTitle = __('Custom Value'); - } - - //$truncatedCarrierTitle = substr($carrierTitle, 0, 35) . (strlen($carrierTitle) > 35 ? '...' : ''); $maxTitleLen = 45; $endOfTitle = strlen($track->getTitle()) > $maxTitleLen ? '...' : ''; $truncatedTitle = substr($track->getTitle(), 0, $maxTitleLen) . $endOfTitle; - //$page->drawText($truncatedCarrierTitle, 285, $yShipments, 'UTF-8'); $page->drawText($truncatedTitle, 292, $yShipments, 'UTF-8'); $page->drawText($track->getNumber(), 410, $yShipments, 'UTF-8'); $yShipments -= $topMargin - 5; diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php index 7fbfe1ca404..e1a26fb4a82 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php @@ -41,8 +41,7 @@ class Creditmemo extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate - * @param \Magento\Filesystem $filesystem - * @param \Magento\Shipping\Model\Config $shippingConfig + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory @@ -57,8 +56,7 @@ class Creditmemo extends \Magento\Sales\Model\Order\Pdf\AbstractPdf \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, - \Magento\Filesystem $filesystem, - \Magento\Shipping\Model\Config $shippingConfig, + \Magento\App\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, @@ -73,7 +71,6 @@ class Creditmemo extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $coreStoreConfig, $translate, $filesystem, - $shippingConfig, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php index 51e5c993279..63f57106ff5 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php @@ -41,8 +41,7 @@ class Invoice extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate - * @param \Magento\Filesystem $filesystem, - * @param \Magento\Shipping\Model\Config $shippingConfig + * @param \Magento\App\Filesystem $filesystem, * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory @@ -57,8 +56,7 @@ class Invoice extends \Magento\Sales\Model\Order\Pdf\AbstractPdf \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, - \Magento\Filesystem $filesystem, - \Magento\Shipping\Model\Config $shippingConfig, + \Magento\App\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, @@ -73,7 +71,6 @@ class Invoice extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $coreStoreConfig, $translate, $filesystem, - $shippingConfig, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php index c976c9b8f3f..747da4c7137 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php @@ -82,7 +82,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem, + * @param \Magento\App\Filesystem $filesystem, * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -91,13 +91,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_taxData = $taxData; - $this->_rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->_rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); parent::__construct($context, $registry, $resource, $resourceCollection, $data); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php index c75cfc98692..644e446049e 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php @@ -46,7 +46,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -56,7 +56,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php index 6d5600fe2c3..2fd98305705 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php @@ -42,7 +42,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -52,7 +52,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php index b88bd30e33f..3d5427b9e57 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php @@ -42,7 +42,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param \Magento\Core\Model\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -52,7 +52,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Tax\Helper\Data $taxData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php index d734988d92f..d005820fdab 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php @@ -41,8 +41,7 @@ class Shipment extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate - * @param \Magento\Filesystem $filesystem - * @param \Magento\Shipping\Model\Config $shippingConfig + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory @@ -57,8 +56,7 @@ class Shipment extends \Magento\Sales\Model\Order\Pdf\AbstractPdf \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, - \Magento\Filesystem $filesystem, - \Magento\Shipping\Model\Config $shippingConfig, + \Magento\App\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, @@ -73,7 +71,6 @@ class Shipment extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $coreStoreConfig, $translate, $filesystem, - $shippingConfig, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php index 9cabb2b5469..13b39a63e2d 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment.php @@ -82,6 +82,16 @@ class Shipment extends \Magento\Sales\Model\AbstractModel */ const HISTORY_ENTITY_NAME = 'shipment'; + /** + * Store address + */ + const XML_PATH_STORE_ADDRESS1 = 'shipping/origin/street_line1'; + const XML_PATH_STORE_ADDRESS2 = 'shipping/origin/street_line2'; + const XML_PATH_STORE_CITY = 'shipping/origin/city'; + const XML_PATH_STORE_REGION_ID = 'shipping/origin/region_id'; + const XML_PATH_STORE_ZIP = 'shipping/origin/postcode'; + const XML_PATH_STORE_COUNTRY_ID = 'shipping/origin/country_id'; + protected $_items; protected $_tracks; protected $_order; @@ -119,12 +129,12 @@ class Shipment extends \Magento\Sales\Model\AbstractModel /** * @var \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory */ - protected $_shipmentItemCollFactory; + protected $_shipmentItemCollectionFactory; /** * @var \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory */ - protected $_trackCollFactory; + protected $_trackCollectionFactory; /** * @var \Magento\Sales\Model\Order\Shipment\CommentFactory @@ -134,7 +144,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel /** * @var \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory */ - protected $_commentCollFactory; + protected $_commentCollectionFactory; /** * @var \Magento\Email\Model\Template\MailerFactory @@ -155,10 +165,10 @@ class Shipment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Sales\Helper\Data $salesData * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollFactory - * @param \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollFactory + * @param \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollectionFactory + * @param \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory * @param \Magento\Sales\Model\Order\Shipment\CommentFactory $commentFactory - * @param \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollFactory + * @param \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Email\Model\Template\MailerFactory $templateMailerFactory * @param \Magento\Email\Model\InfoFactory $emailInfoFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource @@ -174,10 +184,10 @@ class Shipment extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Helper\Data $salesData, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollFactory, - \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollFactory, + \Magento\Sales\Model\Resource\Order\Shipment\Item\CollectionFactory $shipmentItemCollectionFactory, + \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, \Magento\Sales\Model\Order\Shipment\CommentFactory $commentFactory, - \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollFactory, + \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory, \Magento\Email\Model\Template\MailerFactory $templateMailerFactory, \Magento\Email\Model\InfoFactory $emailInfoFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, @@ -188,10 +198,10 @@ class Shipment extends \Magento\Sales\Model\AbstractModel $this->_salesData = $salesData; $this->_coreStoreConfig = $coreStoreConfig; $this->_orderFactory = $orderFactory; - $this->_shipmentItemCollFactory = $shipmentItemCollFactory; - $this->_trackCollFactory = $trackCollFactory; + $this->_shipmentItemCollectionFactory = $shipmentItemCollectionFactory; + $this->_trackCollectionFactory = $trackCollectionFactory; $this->_commentFactory = $commentFactory; - $this->_commentCollFactory = $commentCollFactory; + $this->_commentCollectionFactory = $commentCollectionFactory; $this->_templateMailerFactory = $templateMailerFactory; $this->_emailInfoFactory = $emailInfoFactory; parent::__construct($context, $registry, $coreLocale, $dateTime, $resource, $resourceCollection, $data); @@ -316,7 +326,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel public function getItemsCollection() { if (empty($this->_items)) { - $this->_items = $this->_shipmentItemCollFactory->create()->setShipmentFilter($this->getId()); + $this->_items = $this->_shipmentItemCollectionFactory->create()->setShipmentFilter($this->getId()); if ($this->getId()) { foreach ($this->_items as $item) { @@ -379,7 +389,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel public function getTracksCollection() { if (empty($this->_tracks)) { - $this->_tracks = $this->_trackCollFactory->create()->setShipmentFilter($this->getId()); + $this->_tracks = $this->_trackCollectionFactory->create()->setShipmentFilter($this->getId()); if ($this->getId()) { foreach ($this->_tracks as $track) { @@ -477,7 +487,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel public function getCommentsCollection($reload=false) { if (is_null($this->_comments) || $reload) { - $this->_comments = $this->_commentCollFactory->create() + $this->_comments = $this->_commentCollectionFactory->create() ->setShipmentFilter($this->getId()) ->setCreatedAtOrder(); diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Order/Shipment/Track.php index 1809893589e..9a16ef629bc 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Track.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Track.php @@ -69,11 +69,6 @@ class Track extends \Magento\Sales\Model\AbstractModel */ protected $_storeManager; - /** - * @var \Magento\Shipping\Model\Config - */ - protected $_shippingConfig; - /** * @var \Magento\Sales\Model\Order\ShipmentFactory */ @@ -85,7 +80,6 @@ class Track extends \Magento\Sales\Model\AbstractModel * @param \Magento\Core\Model\LocaleInterface $coreLocale * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection @@ -97,7 +91,6 @@ class Track extends \Magento\Sales\Model\AbstractModel \Magento\Core\Model\LocaleInterface $coreLocale, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Shipping\Model\Config $shippingConfig, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, @@ -113,7 +106,6 @@ class Track extends \Magento\Sales\Model\AbstractModel $data ); $this->_storeManager = $storeManager; - $this->_shippingConfig = $shippingConfig; $this->_shipmentFactory = $shipmentFactory; } @@ -192,31 +184,6 @@ class Track extends \Magento\Sales\Model\AbstractModel return (string)$this->getShipment()->getProtectCode(); } - /** - * Retrieve detail for shipment track - * - * @return string - */ - public function getNumberDetail() - { - $carrierInstance = $this->_shippingConfig->getCarrierInstance($this->getCarrierCode()); - if (!$carrierInstance) { - $custom = array(); - $custom['title'] = $this->getTitle(); - $custom['number'] = $this->getTrackNumber(); - return $custom; - } else { - $carrierInstance->setStore($this->getStore()); - } - - $trackingInfo = $carrierInstance->getTrackingInfo($this->getNumber()); - if (!$trackingInfo) { - return __('No detail for number "%1"', $this->getNumber()); - } - - return $trackingInfo; - } - /** * Get store object * diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php index aca9268335c..61594e2c68f 100644 --- a/app/code/Magento/Sales/Model/Quote.php +++ b/app/code/Magento/Sales/Model/Quote.php @@ -242,7 +242,7 @@ class Quote extends \Magento\Core\Model\AbstractModel /** * @var \Magento\Sales\Model\Resource\Quote\Item\CollectionFactory */ - protected $_quoteItemCollFactory; + protected $_quoteItemCollectionFactory; /** * @var \Magento\Sales\Model\Quote\ItemFactory @@ -272,7 +272,7 @@ class Quote extends \Magento\Core\Model\AbstractModel /** * @var \Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory */ - protected $_quotePaymentCollFactory; + protected $_quotePaymentCollectionFactory; /** * @var \Magento\Sales\Model\Recurring\ProfileFactory @@ -295,13 +295,13 @@ class Quote extends \Magento\Core\Model\AbstractModel * @param \Magento\Sales\Model\Quote\AddressFactory $quoteAddressFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Customer\Model\GroupFactory $customerGroupFactory - * @param \Magento\Sales\Model\Resource\Quote\Item\CollectionFactory $quoteItemCollFactory + * @param \Magento\Sales\Model\Resource\Quote\Item\CollectionFactory $quoteItemCollectionFactory * @param \Magento\Sales\Model\Quote\ItemFactory $quoteItemFactory * @param \Magento\Message\Factory $messageFactory * @param \Magento\Sales\Model\Status\ListFactory $statusListFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Sales\Model\Quote\PaymentFactory $quotePaymentFactory - * @param \Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory $quotePaymentCollFactory + * @param \Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory $quotePaymentCollectionFactory * @param \Magento\Sales\Model\Recurring\ProfileFactory $recurringProfileFactory * @param \Magento\Object\Copy $objectCopyService * @param \Magento\Core\Model\Resource\AbstractResource $resource @@ -319,13 +319,13 @@ class Quote extends \Magento\Core\Model\AbstractModel \Magento\Sales\Model\Quote\AddressFactory $quoteAddressFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Customer\Model\GroupFactory $customerGroupFactory, - \Magento\Sales\Model\Resource\Quote\Item\CollectionFactory $quoteItemCollFactory, + \Magento\Sales\Model\Resource\Quote\Item\CollectionFactory $quoteItemCollectionFactory, \Magento\Sales\Model\Quote\ItemFactory $quoteItemFactory, \Magento\Message\Factory $messageFactory, \Magento\Sales\Model\Status\ListFactory $statusListFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Sales\Model\Quote\PaymentFactory $quotePaymentFactory, - \Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory $quotePaymentCollFactory, + \Magento\Sales\Model\Resource\Quote\Payment\CollectionFactory $quotePaymentCollectionFactory, \Magento\Sales\Model\Recurring\ProfileFactory $recurringProfileFactory, \Magento\Object\Copy $objectCopyService, \Magento\Core\Model\Resource\AbstractResource $resource = null, @@ -340,13 +340,13 @@ class Quote extends \Magento\Core\Model\AbstractModel $this->_quoteAddressFactory = $quoteAddressFactory; $this->_customerFactory = $customerFactory; $this->_customerGroupFactory = $customerGroupFactory; - $this->_quoteItemCollFactory = $quoteItemCollFactory; + $this->_quoteItemCollectionFactory = $quoteItemCollectionFactory; $this->_quoteItemFactory = $quoteItemFactory; $this->messageFactory = $messageFactory; $this->_statusListFactory = $statusListFactory; $this->_productFactory = $productFactory; $this->_quotePaymentFactory = $quotePaymentFactory; - $this->_quotePaymentCollFactory = $quotePaymentCollFactory; + $this->_quotePaymentCollectionFactory = $quotePaymentCollectionFactory; $this->_recurringProfileFactory = $recurringProfileFactory; $this->_objectCopyService = $objectCopyService; parent::__construct($context, $registry, $resource, $resourceCollection, $data); @@ -911,7 +911,7 @@ class Quote extends \Magento\Core\Model\AbstractModel return $this->getData('items_collection'); } if (null === $this->_items) { - $this->_items = $this->_quoteItemCollFactory->create(); + $this->_items = $this->_quoteItemCollectionFactory->create(); $this->_items->setQuote($this); } return $this->_items; @@ -1417,7 +1417,7 @@ class Quote extends \Magento\Core\Model\AbstractModel public function getPaymentsCollection() { if (null === $this->_payments) { - $this->_payments = $this->_quotePaymentCollFactory->create() + $this->_payments = $this->_quotePaymentCollectionFactory->create() ->setQuoteFilter($this->getId()); if ($this->getId()) { diff --git a/app/code/Magento/Sales/Model/Quote/Address.php b/app/code/Magento/Sales/Model/Quote/Address.php index 74adb8b3644..96346165848 100644 --- a/app/code/Magento/Sales/Model/Quote/Address.php +++ b/app/code/Magento/Sales/Model/Quote/Address.php @@ -227,17 +227,17 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress /** * @var \Magento\Sales\Model\Resource\Quote\Address\Item\CollectionFactory */ - protected $_itemCollFactory; + protected $_itemCollectionFactory; /** - * @var \Magento\Shipping\Model\ShippingFactory + * @var \Magento\Sales\Model\Quote\Address\RateCollectorInterface */ - protected $_shippingFactory; + protected $_rateCollector; /** * @var \Magento\Sales\Model\Resource\Quote\Address\Rate\CollectionFactory */ - protected $_rateCollFactory; + protected $_rateCollectionFactory; /** * @var \Magento\Sales\Model\Quote\Address\Total\CollectorFactory @@ -260,14 +260,15 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Customer\Model\AddressFactory $addressFactory * @param \Magento\Sales\Model\Quote\Address\ItemFactory $addressItemFactory - * @param \Magento\Sales\Model\Resource\Quote\Address\Item\CollectionFactory $itemCollFactory + * @param \Magento\Sales\Model\Resource\Quote\Address\Item\CollectionFactory $itemCollectionFactory * @param \Magento\Sales\Model\Quote\Address\RateFactory $addressRateFactory - * @param \Magento\Shipping\Model\ShippingFactory $shippingFactory - * @param \Magento\Sales\Model\Resource\Quote\Address\Rate\CollectionFactory $rateCollFactory - * @param \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory + * @param \Magento\Sales\Model\Quote\Address\RateCollectorInterface $rateCollector + * @param \Magento\Sales\Model\Resource\Quote\Address\Rate\CollectionFactory $rateCollectionFactory + * @param \Magento\Sales\Model\Quote\Address\RateRequestFactory $rateRequestFactory * @param \Magento\Sales\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory * @param \Magento\Sales\Model\Quote\Address\TotalFactory $addressTotalFactory * @param \Magento\Object\Copy $objectCopyService + * @param \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -283,14 +284,15 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Customer\Model\AddressFactory $addressFactory, \Magento\Sales\Model\Quote\Address\ItemFactory $addressItemFactory, - \Magento\Sales\Model\Resource\Quote\Address\Item\CollectionFactory $itemCollFactory, + \Magento\Sales\Model\Resource\Quote\Address\Item\CollectionFactory $itemCollectionFactory, \Magento\Sales\Model\Quote\Address\RateFactory $addressRateFactory, - \Magento\Shipping\Model\ShippingFactory $shippingFactory, - \Magento\Sales\Model\Resource\Quote\Address\Rate\CollectionFactory $rateCollFactory, - \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory, + \Magento\Sales\Model\Quote\Address\RateCollectorInterface $rateCollector, + \Magento\Sales\Model\Resource\Quote\Address\Rate\CollectionFactory $rateCollectionFactory, + \Magento\Sales\Model\Quote\Address\RateRequestFactory $rateRequestFactory, \Magento\Sales\Model\Quote\Address\Total\CollectorFactory $totalCollectorFactory, \Magento\Sales\Model\Quote\Address\TotalFactory $addressTotalFactory, \Magento\Object\Copy $objectCopyService, + \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -298,14 +300,15 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress $this->_coreStoreConfig = $coreStoreConfig; $this->_addressFactory = $addressFactory; $this->_addressItemFactory = $addressItemFactory; - $this->_itemCollFactory = $itemCollFactory; + $this->_itemCollectionFactory = $itemCollectionFactory; $this->_addressRateFactory = $addressRateFactory; - $this->_shippingFactory = $shippingFactory; - $this->_rateCollFactory = $rateCollFactory; + $this->_rateCollector = $rateCollector; + $this->_rateCollectionFactory = $rateCollectionFactory; $this->_rateRequestFactory = $rateRequestFactory; $this->_totalCollectorFactory = $totalCollectorFactory; $this->_addressTotalFactory = $addressTotalFactory; $this->_objectCopyService = $objectCopyService; + $this->_carrierFactory = $carrierFactory; parent::__construct( $context, $registry, @@ -520,7 +523,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress public function getItemsCollection() { if (null === $this->_items) { - $this->_items = $this->_itemCollFactory->create()->setAddressFilter($this->getId()); + $this->_items = $this->_itemCollectionFactory->create()->setAddressFilter($this->getId()); if ($this->getId()) { foreach ($this->_items as $item) { $item->setAddress($this); @@ -816,7 +819,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress public function getShippingRatesCollection() { if (null === $this->_rates) { - $this->_rates = $this->_rateCollFactory->create()->setAddressFilter($this->getId()); + $this->_rates = $this->_rateCollectionFactory->create()->setAddressFilter($this->getId()); if ($this->getQuote()->hasNominalItems(false)) { $this->_rates->setFixedOnlyFilter(true); } @@ -854,13 +857,14 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress { $rates = array(); foreach ($this->getShippingRatesCollection() as $rate) { - if (!$rate->isDeleted() && $rate->getCarrierInstance()) { + if (!$rate->isDeleted() && $this->_carrierFactory->get($rate->getCarrier())) { if (!isset($rates[$rate->getCarrier()])) { $rates[$rate->getCarrier()] = array(); } $rates[$rate->getCarrier()][] = $rate; - $rates[$rate->getCarrier()][0]->carrier_sort_order = $rate->getCarrierInstance()->getSortOrder(); + $rates[$rate->getCarrier()][0]->carrier_sort_order + = $this->_carrierFactory->get($rate->getCarrier())->getSortOrder(); } } uasort($rates, array($this, '_sortRates')); @@ -982,7 +986,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress */ public function requestShippingRates(\Magento\Sales\Model\Quote\Item\AbstractItem $item = null) { - /** @var $request \Magento\Shipping\Model\Rate\Request */ + /** @var $request \Magento\Sales\Model\Quote\Address\RateRequest */ $request = $this->_rateRequestFactory->create(); $request->setAllItems($item ? array($item) : $this->getAllItems()); $request->setDestCountryId($this->getCountryId()); @@ -1027,7 +1031,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress $request->setBaseSubtotalInclTax($this->getBaseSubtotalInclTax()); - $result = $this->_shippingFactory->create()->collectRates($request)->getResult(); + $result = $this->_rateCollector->collectRates($request)->getResult(); $found = false; if ($result) { diff --git a/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php b/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php new file mode 100644 index 00000000000..501de1bf31e --- /dev/null +++ b/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php @@ -0,0 +1,211 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Quote\Address; + +interface AbstractCarrierInterface +{ + /** + * Retrieve information from carrier configuration + * + * @param string $field + * @return mixed + */ + public function getConfigData($field); + + /** + * Collect and get rates + * + * @abstract + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request + * @return \Magento\Object|bool|null + */ + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request); + + /** + * Do request to shipment + * Implementation must be in overridden method + * + * @param \Magento\Object $request + * @return \Magento\Object + */ + public function requestToShipment($request); + + /** + * Do return of shipment + * Implementation must be in overridden method + * + * @param $request + * @return \Magento\Object + */ + public function returnOfShipment($request); + + /** + * Return container types of carrier + * + * @param \Magento\Object|null $params + * @return array + */ + public function getContainerTypes(\Magento\Object $params = null); + + /** + * Get Container Types, that could be customized + * + * @return array + */ + public function getCustomizableContainerTypes(); + + /** + * Return delivery confirmation types of carrier + * + * @param \Magento\Object|null $params + * @return array + */ + public function getDeliveryConfirmationTypes(\Magento\Object $params = null); + + /** + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request + * @return $this|bool|false|\Magento\Core\Model\AbstractModel + */ + public function checkAvailableShipCountries(\Magento\Sales\Model\Quote\Address\RateRequest $request); + + /** + * Processing additional validation to check is carrier applicable. + * + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request + * @return $this|\Magento\Sales\Model\Quote\Address\RateResult\Error|boolean + */ + public function proccessAdditionalValidation(\Magento\Sales\Model\Quote\Address\RateRequest $request); + + /** + * Determine whether current carrier enabled for activity + * + * @return bool + */ + public function isActive(); + + /** + * Whether this carrier has fixed rates calculation + * + * @return bool + */ + public function isFixed(); + + /** + * Check if carrier has shipping tracking option available + * + * @return bool + */ + public function isTrackingAvailable(); + + /** + * Check if carrier has shipping label option available + * + * @return bool + */ + public function isShippingLabelsAvailable(); + + /** + * Retrieve sort order of current carrier + * + * @return mixed + */ + public function getSortOrder(); + + /** + * Calculate price considering free shipping and handling fee + * + * @param string $cost + * @param string $method + * @return float|string + */ + public function getMethodPrice($cost, $method = ''); + + /** + * Get the handling fee for the shipping + cost + * + * @param float $cost + * @return float final price for shipping method + */ + public function getFinalPriceWithHandlingFee($cost); + + /** + * Return weight in pounds + * + * @param integer Weight in someone measure + * @return float Weight in pounds + */ + public function convertWeightToLbs($weight); + + /** + * Set the number of boxes for shipping + * + * @param int|float $weight + * @return int|float weight + */ + public function getTotalNumOfBoxes($weight); + + /** + * Is state province required + * + * @return bool + */ + public function isStateProvinceRequired(); + + /** + * Check if city option required + * + * @return bool + */ + public function isCityRequired(); + + /** + * Determine whether zip-code is required for the country of destination + * + * @param string|null $countryId + * @return bool + */ + public function isZipCodeRequired($countryId = null); + + /** + * Used to call debug method from not Payment Method context + * + * @param mixed $debugData + */ + public function debugData($debugData); + + /** + * Getter for carrier code + * + * @return string + */ + public function getCarrierCode(); + + /** + * Return content types of package + * + * @param \Magento\Object $params + * @return array + */ + public function getContentTypes(\Magento\Object $params); +} diff --git a/app/code/Magento/Sales/Model/Quote/Address/CarrierFactoryInterface.php b/app/code/Magento/Sales/Model/Quote/Address/CarrierFactoryInterface.php new file mode 100644 index 00000000000..88700e13b02 --- /dev/null +++ b/app/code/Magento/Sales/Model/Quote/Address/CarrierFactoryInterface.php @@ -0,0 +1,61 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Quote\Address; + +interface CarrierFactoryInterface +{ + /** + * Get carrier instance + * + * @param string $carrierCode + * @return bool|AbstractCarrierInterface + */ + public function get($carrierCode); + + /** + * Create carrier instance + * + * @param string $carrierCode + * @param int|null $storeId + * @return bool|AbstractCarrierInterface + */ + public function create($carrierCode, $storeId = null); + + /** + * Get carrier by its code if it is active + * + * @param string $carrierCode + * @return bool|AbstractCarrierInterface + */ + public function getIfActive($carrierCode); + + /** + * Create carrier by its code if it is active + * + * @param $carrierCode + * @param null|int $storeId + * @return bool|AbstractCarrierInterface + */ + public function createIfActive($carrierCode, $storeId = null); +} diff --git a/app/code/Magento/Sales/Model/Quote/Address/Rate.php b/app/code/Magento/Sales/Model/Quote/Address/Rate.php index 5b8b27355d3..884182ad6ec 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Rate.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Rate.php @@ -57,7 +57,9 @@ */ namespace Magento\Sales\Model\Quote\Address; -class Rate extends \Magento\Shipping\Model\Rate\AbstractRate +use \Magento\Core\Model\AbstractModel; + +class Rate extends AbstractModel { /** * @var \Magento\Sales\Model\Quote\Address @@ -100,17 +102,17 @@ class Rate extends \Magento\Shipping\Model\Rate\AbstractRate } /** - * @param \Magento\Shipping\Model\Rate\Result\AbstractResult $rate + * @param \Magento\Sales\Model\Quote\Address\RateResult\AbstractResult $rate * @return $this */ - public function importShippingRate(\Magento\Shipping\Model\Rate\Result\AbstractResult $rate) + public function importShippingRate(\Magento\Sales\Model\Quote\Address\RateResult\AbstractResult $rate) { - if ($rate instanceof \Magento\Shipping\Model\Rate\Result\Error) { + if ($rate instanceof \Magento\Sales\Model\Quote\Address\RateResult\Error) { $this->setCode($rate->getCarrier() . '_error') ->setCarrier($rate->getCarrier()) ->setCarrierTitle($rate->getCarrierTitle()) ->setErrorMessage($rate->getErrorMessage()); - } elseif ($rate instanceof \Magento\Shipping\Model\Rate\Result\Method) { + } elseif ($rate instanceof \Magento\Sales\Model\Quote\Address\RateResult\Method) { $this->setCode($rate->getCarrier() . '_' . $rate->getMethod()) ->setCarrier($rate->getCarrier()) ->setCarrierTitle($rate->getCarrierTitle()) diff --git a/app/code/Magento/Sales/Model/Quote/Address/RateCollectorInterface.php b/app/code/Magento/Sales/Model/Quote/Address/RateCollectorInterface.php new file mode 100644 index 00000000000..d867bb49b34 --- /dev/null +++ b/app/code/Magento/Sales/Model/Quote/Address/RateCollectorInterface.php @@ -0,0 +1,33 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Quote\Address; + +interface RateCollectorInterface +{ + /** + * @param RateRequest $request + * @return $this + */ + public function collectRates(RateRequest $request); +} diff --git a/app/code/Magento/Sales/Model/Quote/Address/RateRequest.php b/app/code/Magento/Sales/Model/Quote/Address/RateRequest.php new file mode 100644 index 00000000000..b00b16de2b3 --- /dev/null +++ b/app/code/Magento/Sales/Model/Quote/Address/RateRequest.php @@ -0,0 +1,134 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Quote\Address; + +/** + * Fields: + * - orig: + * - country_id: UK + * - region_id: 1 + * - postcode: 90034 + * - dest: + * - country_id: UK + * - region_id: 2 + * - postcode: 01005 + * - package: + * - value: $100 + * - weight: 1.5 lb + * - height: 10" + * - width: 10" + * - depth: 10" + * - order: + * - total_qty: 10 + * - subtotal: $100 + * - option + * - insurance: true + * - handling: $1 + * - table (shiptable) + * - condition_name: package_weight + * - limit + * - carrier: ups + * - method: 3dp + * - ups + * - pickup: CC + * - container: CP + * - address: RES + * + * @method int getStoreId() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setStoreId(int $value) + * @method int getWebsiteId() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setWebsiteId(int $value) + * @method string getBaseCurrency() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setBaseCurrency(string $value) + * + * @method \Magento\Sales\Model\Quote\Address\RateRequest setAllItems(array $items) + * @method array getAllItems() + * + * @method \Magento\Sales\Model\Quote\Address\RateRequest setOrigCountryId(string $value) + * @method string getOrigCountryId() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setOrigRegionId(int $value) + * @method int getOrigRegionId() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setOrigPostcode(string $value) + * @method string getOrigPostcode() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setOrigCity(string $value) + * @method string getOrigCity() + * + * @method \Magento\Sales\Model\Quote\Address\RateRequest setDestCountryId(string $value) + * @method string getDestCountryId() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setDestRegionId(int $value) + * @method int getDestRegionId() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setDestRegionCode(string $value) + * @method string getDestRegionCode() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setDestPostcode(string $value) + * @method string getDestPostcode() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setDestCity(string $value) + * @method string getDestCity() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setDestStreet(string $value) + * @method string getDestStreet() + * + * @method \Magento\Sales\Model\Quote\Address\RateRequest setPackageValue(float $value) + * @method float getPackageValue() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setPackageValueWithDiscount(float $value) + * @method float getPackageValueWithDiscount() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setPackagePhysicalValue(float $value) + * @method float getPackagePhysicalValue() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setPackageQty(float $value) + * @method float getPackageQty() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setPackageWeight(float $value) + * @method float getPackageWeight() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setPackageHeight(int $value) + * @method int getPackageHeight() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setPackageWidth(int $value) + * @method int getPackageWidth() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setPackageDepth(int $value) + * @method int getPackageDepth() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setPackageCurrency(string $value) + * @method string getPackageCurrency() + * + * @method \Magento\Sales\Model\Quote\Address\RateRequest setOrderTotalQty(float $value) + * @method float getOrderTotalQty() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setOrderSubtotal(float $value) + * @method float getOrderSubtotal() + * + * @method boolean getFreeShipping() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setFreeShipping(boolean $flag) + * @method float getFreeMethodWeight() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setFreeMethodWeight(float $value) + * + * @method \Magento\Sales\Model\Quote\Address\RateRequest setOptionInsurance(boolean $value) + * @method boolean getOptionInsurance() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setOptionHandling(float $flag) + * @method float getOptionHandling() + * + * @method \Magento\Sales\Model\Quote\Address\RateRequest setConditionName(array|string $value) + * @method array|string getConditionName() + * + * @method \Magento\Sales\Model\Quote\Address\RateRequest setLimitCarrier(string $value) + * @method string getLimitCarrier() + * @method \Magento\Sales\Model\Quote\Address\RateRequest setLimitMethod(string $value) + * @method string getLimitMethod() + */ +class RateRequest extends \Magento\Object +{ +} diff --git a/app/code/Magento/Shipping/Model/Rate/Result/AbstractResult.php b/app/code/Magento/Sales/Model/Quote/Address/RateResult/AbstractResult.php similarity index 90% rename from app/code/Magento/Shipping/Model/Rate/Result/AbstractResult.php rename to app/code/Magento/Sales/Model/Quote/Address/RateResult/AbstractResult.php index 6792c8c9bbf..8867eb76400 100644 --- a/app/code/Magento/Shipping/Model/Rate/Result/AbstractResult.php +++ b/app/code/Magento/Sales/Model/Quote/Address/RateResult/AbstractResult.php @@ -18,16 +18,11 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Shipping * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - - -namespace Magento\Shipping\Model\Rate\Result; +namespace Magento\Sales\Model\Quote\Address\RateResult; class AbstractResult extends \Magento\Object { - } diff --git a/app/code/Magento/Shipping/Model/Rate/Result/Error.php b/app/code/Magento/Sales/Model/Quote/Address/RateResult/Error.php similarity index 87% rename from app/code/Magento/Shipping/Model/Rate/Result/Error.php rename to app/code/Magento/Sales/Model/Quote/Address/RateResult/Error.php index 4c7c3fa0cda..ea28a43c2ef 100644 --- a/app/code/Magento/Shipping/Model/Rate/Result/Error.php +++ b/app/code/Magento/Sales/Model/Quote/Address/RateResult/Error.php @@ -18,18 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Shipping * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Sales\Model\Quote\Address\RateResult; - -namespace Magento\Shipping\Model\Rate\Result; - -class Error extends \Magento\Shipping\Model\Rate\Result\AbstractResult +class Error extends AbstractResult { - public function getErrorMessage() { if (!$this->getData('error_message')) { diff --git a/app/code/Magento/Shipping/Model/Rate/Result/Method.php b/app/code/Magento/Sales/Model/Quote/Address/RateResult/Method.php similarity index 88% rename from app/code/Magento/Shipping/Model/Rate/Result/Method.php rename to app/code/Magento/Sales/Model/Quote/Address/RateResult/Method.php index d005a31dc7f..9013941b8ab 100644 --- a/app/code/Magento/Shipping/Model/Rate/Result/Method.php +++ b/app/code/Magento/Sales/Model/Quote/Address/RateResult/Method.php @@ -18,12 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Shipping * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +namespace Magento\Sales\Model\Quote\Address\RateResult; /** * Fields: @@ -34,9 +32,7 @@ * - price: $9.40 (cost+handling) * - cost: $8.00 */ -namespace Magento\Shipping\Model\Rate\Result; - -class Method extends \Magento\Shipping\Model\Rate\Result\AbstractResult +class Method extends AbstractResult { /** * @var \Magento\Core\Model\StoreManagerInterface @@ -59,7 +55,7 @@ class Method extends \Magento\Shipping\Model\Rate\Result\AbstractResult * Round shipping carrier's method price * * @param string|float|int $price - * @return \Magento\Shipping\Model\Rate\Result\Method + * @return \Magento\Sales\Model\Quote\Address\RateResult\Method */ public function setPrice($price) { diff --git a/app/code/Magento/Sales/Model/Resource/Order/Grid/StatusesArray.php b/app/code/Magento/Sales/Model/Resource/Order/Grid/StatusesArray.php index 67246c9a95f..1fab8d5cb91 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Grid/StatusesArray.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Grid/StatusesArray.php @@ -34,14 +34,14 @@ class StatusesArray implements \Magento\Core\Model\Option\ArrayInterface /** * @var \Magento\Sales\Model\Resource\Order\Status\CollectionFactory */ - protected $_statusCollFactory; + protected $_statusCollectionFactory; /** - * @param \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $statusCollFactory + * @param \Magento\Sales\Model\Resource\Order\Status\CollectionFactory $statusCollectionFactory */ - public function __construct(\Magento\Sales\Model\Resource\Order\Status\CollectionFactory $statusCollFactory) + public function __construct(\Magento\Sales\Model\Resource\Order\Status\CollectionFactory $statusCollectionFactory) { - $this->_statusCollFactory = $statusCollFactory; + $this->_statusCollectionFactory = $statusCollectionFactory; } /** @@ -51,7 +51,7 @@ class StatusesArray implements \Magento\Core\Model\Option\ArrayInterface */ public function toOptionArray() { - $statuses = $this->_statusCollFactory->create()->toOptionHash(); + $statuses = $this->_statusCollectionFactory->create()->toOptionHash(); return $statuses; } } diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php index e47918a4987..450cf78348e 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php @@ -43,6 +43,29 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ protected $_allowFixedOnly = false; + /** + * @param \Magento\Core\Model\EntityFactory $entityFactory + * @param \Magento\Logger $logger + * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory + * @param mixed $connection + * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + */ + public function __construct( + \Magento\Core\Model\EntityFactory $entityFactory, + \Magento\Logger $logger, + \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, + \Magento\Event\ManagerInterface $eventManager, + \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, + $connection = null, + \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + ) { + parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + $this->_carrierFactory = $carrierFactory; + } + + /** * Resource initialization * @@ -89,7 +112,8 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function addItem(\Magento\Object $rate) { - if ($this->_allowFixedOnly && (!$rate->getCarrierInstance() || !$rate->getCarrierInstance()->isFixed())) { + $carrier = $this->_carrierFactory->get($rate->getCarrier()); + if ($this->_allowFixedOnly && (!$carrier || !$carrier->isFixed())) { return $this; } return parent::addItem($rate); diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php index ee0b148f13a..40cec6c4bd2 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php @@ -48,12 +48,12 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @var \Magento\Sales\Model\Resource\Quote\Item\Option\CollectionFactory */ - protected $_itemOptionCollFactory; + protected $_itemOptionCollectionFactory; /** * @var \Magento\Catalog\Model\Resource\Product\CollectionFactory */ - protected $_productCollFactory; + protected $_productCollectionFactory; /** * @var \Magento\Sales\Model\Quote\Config @@ -65,8 +65,8 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Sales\Model\Resource\Quote\Item\Option\CollectionFactory $itemOptionCollFactory - * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory + * @param \Magento\Sales\Model\Resource\Quote\Item\Option\CollectionFactory $itemOptionCollectionFactory + * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Sales\Model\Quote\Config $quoteConfig * @param mixed $connection * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource @@ -76,15 +76,15 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Sales\Model\Resource\Quote\Item\Option\CollectionFactory $itemOptionCollFactory, - \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, + \Magento\Sales\Model\Resource\Quote\Item\Option\CollectionFactory $itemOptionCollectionFactory, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Sales\Model\Quote\Config $quoteConfig, $connection = null, \Magento\Core\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); - $this->_itemOptionCollFactory = $itemOptionCollFactory; - $this->_productCollFactory = $productCollFactory; + $this->_itemOptionCollectionFactory = $itemOptionCollectionFactory; + $this->_productCollectionFactory = $productCollectionFactory; $this->_quoteConfig = $quoteConfig; } @@ -189,7 +189,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl protected function _assignOptions() { $itemIds = array_keys($this->_items); - $optionCollection = $this->_itemOptionCollFactory->create()->addItemFilter($itemIds); + $optionCollection = $this->_itemOptionCollectionFactory->create()->addItemFilter($itemIds); foreach ($this as $item) { $item->setOptions($optionCollection->getOptionsByItem($item)); } @@ -213,7 +213,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl } $this->_productIds = array_merge($this->_productIds, $productIds); - $productCollection = $this->_productCollFactory->create() + $productCollection = $this->_productCollectionFactory->create() ->setStoreId($this->getStoreId()) ->addIdFilter($this->_productIds) ->addAttributeToSelect($this->_quoteConfig->getProductAttributes()) diff --git a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php index 440693c5764..750cb673401 100644 --- a/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php +++ b/app/code/Magento/Sales/Model/Resource/Report/Bestsellers.php @@ -155,7 +155,7 @@ class Bestsellers extends \Magento\Sales\Model\Resource\Report\AbstractReport ->where('source_table.state != ?', \Magento\Sales\Model\Order::STATE_CANCELED); $productTypes = array( - \Magento\Catalog\Model\Product\Type::TYPE_GROUPED, + \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE, \Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE, \Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, ); diff --git a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php index 4c2456838f0..90a44fbb5dc 100644 --- a/app/code/Magento/Sales/Model/Resource/Sale/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Sale/Collection.php @@ -79,7 +79,7 @@ class Collection extends \Magento\Data\Collection\Db /** * @var \Magento\Core\Model\Resource\Store\CollectionFactory */ - protected $_storeCollFactory; + protected $_storeCollectionFactory; /** * @var \Magento\Core\Model\StoreManagerInterface @@ -93,12 +93,12 @@ class Collection extends \Magento\Data\Collection\Db \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, \Magento\Sales\Model\Resource\Order $resource, - \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollFactory, + \Magento\Core\Model\Resource\Store\CollectionFactory $storeCollectionFactory, \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_eventManager = $eventManager; $this->_orderResource = $resource; - $this->_storeCollFactory = $storeCollFactory; + $this->_storeCollectionFactory = $storeCollectionFactory; $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $this->_orderResource->getReadConnection()); } @@ -206,7 +206,7 @@ class Collection extends \Magento\Data\Collection\Db $data = $this->getData(); $this->resetData(); - $stores = $this->_storeCollFactory->create() + $stores = $this->_storeCollectionFactory->create() ->setWithoutDefaultFilter() ->load() ->toOptionHash(); diff --git a/app/code/Magento/Sales/Model/Resource/Setup.php b/app/code/Magento/Sales/Model/Resource/Setup.php index 5dc63a1e761..4d0e07fc222 100644 --- a/app/code/Magento/Sales/Model/Resource/Setup.php +++ b/app/code/Magento/Sales/Model/Resource/Setup.php @@ -45,7 +45,7 @@ class Setup extends \Magento\Eav\Model\Entity\Setup * @param \Magento\Core\Model\Resource\Setup\Context $context * @param string $resourceName * @param \Magento\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory * @param \Magento\Core\Model\Config $config * @param string $moduleName * @param string $connectionName @@ -54,14 +54,14 @@ class Setup extends \Magento\Eav\Model\Entity\Setup \Magento\Core\Model\Resource\Setup\Context $context, $resourceName, \Magento\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Core\Model\Config $config, $moduleName = 'Magento_Sales', $connectionName = '' ) { $this->_config = $config; $this->_encryptor = $context->getEncryptor(); - parent::__construct($context, $resourceName, $cache, $attrGrCollFactory, $moduleName, $connectionName); + parent::__construct($context, $resourceName, $cache, $attrGroupCollectionFactory, $moduleName, $connectionName); } /** diff --git a/app/code/Magento/Sales/etc/module.xml b/app/code/Magento/Sales/etc/module.xml index 20bb0161348..ca7f4f1ff6d 100755 --- a/app/code/Magento/Sales/etc/module.xml +++ b/app/code/Magento/Sales/etc/module.xml @@ -28,11 +28,13 @@ <sequence> <module name="Magento_Rule"/> <module name="Magento_Catalog"/> + <module name="Magento_GroupedProduct" /> <module name="Magento_Customer"/> <module name="Magento_Payment"/> </sequence> <depends> <module name="Magento_Catalog"/> + <module name="Magento_GroupedProduct" /> <module name="Magento_Customer"/> <module name="Magento_Payment"/> <module name="Magento_Core"/> @@ -45,11 +47,12 @@ <module name="Magento_Eav"/> <module name="Magento_Tax"/> <module name="Magento_GiftMessage"/> - <module name="Magento_Shipping"/> - <module name="Magento_Usa"/> <module name="Magento_Reports"/> <module name="Magento_Weee"/> <module name="Magento_Rss"/> + <module name="Magento_CatalogInventory"/> + <module name="Magento_Wishlist"/> + <module name="Magento_Email"/> </depends> </module> </config> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_grid_block.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_grid_block.xml index 10e78848d54..81e89315e90 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_grid_block.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_grid_block.xml @@ -80,7 +80,7 @@ </item> <item name="print_shipping_label" xsi:type="array"> <item name="label" xsi:type="string" translate="true">Print Shipping Labels</item> - <item name="url" xsi:type="string">sales/order_shipment/massPrintShippingLabel</item> + <item name="url" xsi:type="string">adminhtml/order_shipment/massPrintShippingLabel</item> </item> </argument> </arguments> diff --git a/app/code/Magento/Sales/view/adminhtml/order/create/sidebar/items.phtml b/app/code/Magento/Sales/view/adminhtml/order/create/sidebar/items.phtml index 487820018cf..702e9d3e2f7 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/create/sidebar/items.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/create/sidebar/items.phtml @@ -70,7 +70,7 @@ <td><?php echo $this->escapeHtml($_item->getName()) ?></td> <?php if ($this->canDisplayItemQty()): ?> <td class="a-center"> - <?php if ($_item->getProduct()->getTypeId() != \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE): ?> + <?php if ($_item->getProduct()->getTypeId() != \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE): ?> <?php echo $_item->getQty()*1 ? $_item->getQty()*1 : 1 ?> <?php endif; ?> </td> @@ -82,9 +82,9 @@ <td class="a-center"><input type="checkbox" name="sidebar[remove][<?php echo $this->getItemId($_item) ?>]" value="<?php echo $this->getDataId() ?>" title="<?php echo __('Remove') ?>"/></td> <?php endif; ?> <td class="a-center"> - <?php if ($_item->getTypeId() == \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE && $this->getDataId() == 'wishlist'): ?> + <?php if ($_item->getTypeId() == \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE && $this->getDataId() == 'wishlist'): ?> <a href="#" onclick="order.sidebarConfigureProduct('<?php echo 'sidebar_wishlist' ?>', <?php echo $this->getProductId($_item) ?>, <?php echo $this->getItemId($_item) ?>); return false;"><img src="<?php echo $this->getViewFileUrl('images/grouped_to_order_icon.png') ?>" class="v-middle" alt="<?php echo __('Configure and Add to Order') ?>" title="<?php echo __('Configure and Add to Order') ?>" width="16" height="16"/></a> - <?php elseif ($_item->getTypeId() == \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE): ?> + <?php elseif ($_item->getTypeId() == \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE): ?> <a href="#" onclick="order.sidebarConfigureProduct('<?php echo 'sidebar' ?>', <?php echo $this->getProductId($_item) ?>); return false;"><img src="<?php echo $this->getViewFileUrl('images/grouped_to_order_icon.png') ?>" class="v-middle" alt="<?php echo __('Configure and Add to Order') ?>" title="<?php echo __('Configure and Add to Order') ?>" width="16" height="16"/></a> <?php else: ?> <input type="checkbox" name="sidebar[<?php echo $this->getSidebarStorageAction() ?>][<?php echo $this->getIdentifierId($_item) ?>]" value="<?php echo $this->canDisplayItemQty() ? $_item->getQty()*1 : 1 ?>" title="<?php echo __('Add To Order') ?>"/> diff --git a/app/code/Magento/Sales/view/adminhtml/order/invoice/create/tracking.phtml b/app/code/Magento/Sales/view/adminhtml/order/invoice/create/tracking.phtml deleted file mode 100644 index 0d5b6dca8bc..00000000000 --- a/app/code/Magento/Sales/view/adminhtml/order/invoice/create/tracking.phtml +++ /dev/null @@ -1,105 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @package default_default - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<?php /** @var $this \Magento\Sales\Block\Adminhtml\Order\Invoice\Create\Tracking */ ?> -<script type="text/javascript"> -//<![CDATA[ -var trackingControl; -trackingControl = { - index : 0, - add : function () { - this.index++; - var data = {index:this.index}; - Element.insert($('track_row_container'), {bottom: this.template.evaluate(data)}); - $('trackingC' + this.index).disabled = false; - $('trackingT' + this.index).disabled = false; - $('trackingN' + this.index).disabled = false; - this.bindCurrierOnchange(); - }, - deleteRow : function(event) { - var row = Event.findElement(event, 'tr'); - if (row) { - row.parentNode.removeChild(row) - } - }, - bindCurrierOnchange : function() { - var elems = $('tracking_numbers_table').select('.select'); - elems.each(function (elem) { - if (!elem.onchangeBound) { - elem.onchangeBound = true; - elem.valueInput = $(elem.parentNode.parentNode).select('.number-title')[0]; - elem.observe('change', this.currierOnchange); - } - }.bind(this)); - }, - currierOnchange : function(event) { - var elem = Event.element(event); - var option = elem.options[elem.selectedIndex]; - if (option.value && option.value != 'custom') { - elem.valueInput.value = option.text; - } - else { - elem.valueInput.value = ''; - } - } -} -//]]> -</script> - -<table cellspacing="0" class="data-table" id="tracking_numbers_table"> - <thead> - <tr class="headings"> - <th class="col-carrier"><?php echo __('Carrier') ?></th> - <th class="col-title"><?php echo __('Title') ?></th> - <th class="col-number"><?php echo __('Number') ?></th> - <th class="col-delete last"><?php echo __('Action') ?></th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="4" class="last"><?php echo $this->getChildHtml('add_button') ?></td> - </tr> - </tfoot> - <tbody id="track_row_container"> - <tr id="track_row_template" class="template no-display"> - <td class="col-carrier"> - <select name="tracking[__index__][carrier_code]" id="trackingC__index__" class="select carrier" disabled="disabled"> - <?php foreach ($this->getCarriers() as $_code=>$_name): ?> - <option value="<?php echo $_code ?>"><?php echo $this->escapeHtml($_name) ?></option> - <?php endforeach; ?> - </select> - </td> - <td class="col-title"><input class="input-text number-title" type="text" name="tracking[__index__][title]" id="trackingT__index__" value="" disabled="disabled" /></td> - <td class="col-number"><input class="input-text" type="text" name="tracking[__index__][number]" id="trackingN__index__" value="" disabled="disabled" /></td> - <td class="col-delete last"><a class="action- delete" href="#" onclick="trackingControl.deleteRow(event);return false"><span><?php echo __('Delete') ?></a></span></td> - </tr> - </tbody> -</table> -<script type="text/javascript"> -//<![CDATA[ -trackingControl.template = new Template('<tr>' + $('track_row_template').innerHTML.replace(/__index__/g, '#{index}') + '<\/tr>'); -//]]> -</script> diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/create/tracking.phtml b/app/code/Magento/Sales/view/adminhtml/order/shipment/create/tracking.phtml deleted file mode 100644 index be94032de65..00000000000 --- a/app/code/Magento/Sales/view/adminhtml/order/shipment/create/tracking.phtml +++ /dev/null @@ -1,104 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @package default_default - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<?php /** @var $this \Magento\Sales\Block\Adminhtml\Order\Shipment\Create\Tracking */ ?> -<script type="text/javascript"> -//<![CDATA[ -var trackingControl; -trackingControl = { - index : 0, - add : function () { - this.index++; - var data = {index:this.index}; - Element.insert($('track_row_container'), {bottom: this.template.evaluate(data)}); - $('trackingC' + this.index).disabled = false; - $('trackingT' + this.index).disabled = false; - $('trackingN' + this.index).disabled = false; - this.bindCurrierOnchange(); - }, - deleteRow : function(event) { - var row = Event.findElement(event, 'tr'); - if (row) { - row.parentNode.removeChild(row) - } - }, - bindCurrierOnchange : function() { - var elems = $('tracking_numbers_table').select('.select'); - elems.each(function (elem) { - if (!elem.onchangeBound) { - elem.onchangeBound = true; - elem.valueInput = $(elem.parentNode.parentNode).select('.number-title')[0]; - elem.observe('change', this.currierOnchange); - } - }.bind(this)); - }, - currierOnchange : function(event) { - var elem = Event.element(event); - var option = elem.options[elem.selectedIndex]; - if (option.value && option.value != 'custom') { - elem.valueInput.value = option.text; - } - else { - elem.valueInput.value = ''; - } - } -} -//]]> -</script> -<table cellspacing="0" class="data-table" id="tracking_numbers_table"> - <thead> - <tr class="headings"> - <th class="col-carrier"><?php echo __('Carrier') ?></th> - <th class="col-title"><?php echo __('Title') ?></th> - <th class="col-number"><?php echo __('Number') ?> <span class="required">*</span></th> - <th class="col-delete last"><?php echo __('Action') ?></th> - </tr> - </thead> - <tfoot> - <tr> - <td colspan="4" class="last"><?php echo $this->getChildHtml('add_button') ?></td> - </tr> - </tfoot> - <tbody id="track_row_container"> - <tr id="track_row_template" class="template no-display"> - <td class="col-carrier"> - <select name="tracking[__index__][carrier_code]" id="trackingC__index__" class="select carrier" disabled="disabled"> - <?php foreach ($this->getCarriers() as $_code=>$_name): ?> - <option value="<?php echo $_code ?>"><?php echo $this->escapeHtml($_name) ?></option> - <?php endforeach; ?> - </select> - </td> - <td class="col-title"><input class="input-text number-title" type="text" name="tracking[__index__][title]" id="trackingT__index__" value="" disabled="disabled" /></td> - <td class="col-number"><input class="input-text required-entry" type="text" name="tracking[__index__][number]" id="trackingN__index__" value="" disabled="disabled" /></td> - <td class="col-delete last"><a href="#" class="action- delete" onclick="trackingControl.deleteRow(event);return false"><span><?php echo __('Delete') ?></span></a></td> - </tr> - </tbody> -</table> -<script type="text/javascript"> -//<![CDATA[ -trackingControl.template = new Template('<tr>' + $('track_row_template').innerHTML.replace(/__index__/g, '#{index}') + '<\/tr>'); -//]]> -</script> diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/tracking/info.phtml b/app/code/Magento/Sales/view/adminhtml/order/shipment/tracking/info.phtml deleted file mode 100644 index 0dda09b8ea4..00000000000 --- a/app/code/Magento/Sales/view/adminhtml/order/shipment/tracking/info.phtml +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @package default_default - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<span class="field-row grid" id="shipment_tracking_info"> -<?php if($this->getTrackingInfo()): ?> - <?php if ($this->getTrackingInfo()->getErrorMessage()): ?> - <?php echo $this->getTrackingInfo()->getErrorMessage() ?> - <?php else: ?> - <?php if ($this->getTrackingInfo()->getUrl()): ?> - Please, visit for more info: <a href="<?php echo $this->getTrackingInfo()->getUrl() ?>" target="_blank"> - <?php echo $this->escapeHtml($this->getTrackingInfo()->getCarrierTitle()) ?> - </a><br/> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getStatus()): ?> - Status: <?php echo $this->getTrackingInfo()->getStatus() ?><br/> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getDeliverydate()): ?> - Delivery Date: <?php echo $this->getTrackingInfo()->getDeliverydate() ?><br/> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getDeliverytime()): ?> - Delivery Time: <?php echo $this->getTrackingInfo()->getDeliverytime() ?><br/> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getDeliverylocation()): ?> - Delivery Location: <?php echo $this->getTrackingInfo()->getDeliverylocation() ?><br/> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getSignedby()): ?> - Signed by: <?php echo $this->getTrackingInfo()->getSignedby() ?><br/> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getTrackSummary()): ?> - Tracking summary: <?php echo $this->getTrackingInfo()->getTrackSummary() ?><br/> - <?php endif; ?> - - <?php endif; ?> -<?php endif; ?> -</span> diff --git a/app/code/Magento/Sales/view/adminhtml/order/view/info.phtml b/app/code/Magento/Sales/view/adminhtml/order/view/info.phtml index 68cafe39a15..1ff35e383e5 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/view/info.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/view/info.phtml @@ -105,7 +105,7 @@ $orderStoreDate = $this->formatDate($_order->getCreatedAtStoreDate(), 'medium', <?php if($_order->getBaseCurrencyCode() != $_order->getOrderCurrencyCode()): ?> <tr> <th><?php echo __('%1 / %2 rate:', $_order->getOrderCurrencyCode(), $_order->getBaseCurrencyCode()) ?></th> - <th><?php echo $_order->getBaseToOrderRate() ?></td> + <th><?php echo $_order->getBaseToOrderRate() ?></th> </tr> <?php endif; ?> </table> diff --git a/app/code/Magento/Sales/view/adminhtml/order/view/tab/info.phtml b/app/code/Magento/Sales/view/adminhtml/order/view/tab/info.phtml index d602315e91b..d4dd4208d06 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/view/tab/info.phtml +++ b/app/code/Magento/Sales/view/adminhtml/order/view/tab/info.phtml @@ -53,38 +53,7 @@ </div><?php /* opening div is in app\code\Magento\Sales\view\adminhtml\order\view\info.phtml */ ?> <?php endif; ?> - <?php if (!$_order->getIsVirtual()): ?> - <div class="order-shipping-method"> - <!--Shipping Method--> - <div class="fieldset-wrapper"> - <div class="fieldset-wrapper-title"> - <span class="title"><?php echo __('Shipping & Handling Information') ?></span> - </div> - <div class="shipping-description-wrapper"> - <?php if ($_order->getTracksCollection()->count()) : ?> - <p><a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('Magento\Shipping\Helper\Data')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo __('Track Order') ?>"><?php echo __('Track Order') ?></a></p> - <?php endif; ?> - <?php if ($_order->getShippingDescription()): ?> - <strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong> - - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()): ?> - <?php $_excl = $this->displayShippingPriceInclTax($_order); ?> - <?php else: ?> - <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?> - <?php endif; ?> - <?php $_incl = $this->displayShippingPriceInclTax($_order); ?> - - <?php echo $_excl; ?> - <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> - (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) - <?php endif; ?> - <?php else: ?> - <?php echo __('No shipping information available'); ?> - <?php endif; ?> - </div> - </div> - </div> - <?php endif; ?> +<?php echo $this->getChildHtml('order_shipping_view') ?> <?php if (!$_order->getIsVirtual()): ?> </div> diff --git a/app/code/Magento/Sales/view/adminhtml/order/view/tracking.phtml b/app/code/Magento/Sales/view/adminhtml/order/view/tracking.phtml deleted file mode 100644 index 2542d25cf35..00000000000 --- a/app/code/Magento/Sales/view/adminhtml/order/view/tracking.phtml +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @package default_default - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<?php $_shippingCarrier = $this->getOrder()->getShippingCarrier(); ?> -<?php if ($_shippingCarrier && $_shippingCarrier->isTrackingAvailable()): ?> -<span class="field-row" id="order_tracking_info"> -<table cellpadding="0" cellspacing="0" width="100%"> - <tr> - <td><label for="tracking_number"><?php echo __('Tracking Number') ?></label></td> - <td width="100%"> - <?php $_numbers = $this->getOrder()->getTrackingNumbers(); ?> - <?php if ($_numbers): ?> - <?php foreach ($_numbers as $_number): ?> - <a href="#" onclick="<?php echo $this->getViewLinkHtml($_number) ?>"><?php echo $_number ?></a> - <a href="#" onclick="<?php echo $this->getRemoveLinkHtml($_number) ?>"><?php echo __('Delete') ?></a><br/> - <span id="order_tracking_info_response_<?php echo $_number ?>"></span> - <?php endforeach; ?> - <?php endif; ?> - <input class="input-text" type="text" id="tracking_number" name="tracking_number" value="" style="width:120px;"/> - <?php echo $this->getSaveButtonHtml() ?> - </td> - </tr> -</table> -</span> -<?php endif; ?> diff --git a/app/code/Magento/Sales/view/email/shipment_new.html b/app/code/Magento/Sales/view/email/shipment_new.html index ecbe06b92a6..2eaacd365aa 100644 --- a/app/code/Magento/Sales/view/email/shipment_new.html +++ b/app/code/Magento/Sales/view/email/shipment_new.html @@ -96,7 +96,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; </table> <br/> {{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}} - {{block type='Magento\View\Element\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}} + {{block type='Magento\\View\\Element\\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}} <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p> </td> </tr> diff --git a/app/code/Magento/Sales/view/email/shipment_new_guest.html b/app/code/Magento/Sales/view/email/shipment_new_guest.html index 7ac86422816..776950ea512 100644 --- a/app/code/Magento/Sales/view/email/shipment_new_guest.html +++ b/app/code/Magento/Sales/view/email/shipment_new_guest.html @@ -94,7 +94,7 @@ body,td { color:#2f2f2f; font:11px/1.35em Verdana, Arial, Helvetica, sans-serif; </table> <br/> {{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}} - {{block type='Magento\View\Element\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}} + {{block type='Magento\\View\\Element\\Template' area='frontend' template='Magento_Sales::email/shipment/track.phtml' shipment=$shipment order=$order}} <p style="font-size:12px; margin:0 10px 10px 0">{{var comment}}</p> </td> </tr> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_guest_shipment.xml b/app/code/Magento/Sales/view/frontend/layout/sales_guest_shipment.xml index 15636594810..82caa305d0f 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_guest_shipment.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_guest_shipment.xml @@ -33,12 +33,6 @@ <block class="Magento\Sales\Block\Order\Info" as="info" name="sales.order.info"> <block class="Magento\Sales\Block\Order\Info\Buttons" as="buttons" name="sales.order.info.buttons" cacheable="false"/> </block> - <block class="Magento\Sales\Block\Order\Shipment" name="sales.order.shipment" after="sales.order.info" cacheable="false"> - <block class="Magento\Sales\Block\Order\Shipment\Items" name="shipment_items" template="order/shipment/items.phtml"> - <block class="Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer" as="default" template="order/shipment/items/renderer/default.phtml"/> - <block class="Magento\Sales\Block\Order\Comments" name="shipment_comments" template="order/comments.phtml"/> - </block> - </block> </referenceContainer> <update handle="sales_order_guest_info_links"/> </layout> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml index 8669eb1d08d..99ea6d8b5e9 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml @@ -29,12 +29,6 @@ <block class="Magento\Sales\Block\Order\Info" as="info" name="sales.order.info"> <block class="Magento\Sales\Block\Order\Info\Buttons" as="buttons" name="sales.order.info.buttons" cacheable="false"/> </block> - <block class="Magento\Sales\Block\Order\Shipment" name="sales.order.shipment" after="sales.order.info" cacheable="false"> - <block class="Magento\Sales\Block\Order\Shipment\Items" name="shipment_items" template="order/shipment/items.phtml"> - <block class="Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer" as="default" template="order/shipment/items/renderer/default.phtml"/> - <block class="Magento\Sales\Block\Order\Comments" name="shipment_comments" template="order/comments.phtml"/> - </block> - </block> </referenceContainer> <update handle="sales_order_info_links"/> <block class="Magento\View\Element\Template" name="additional.product.info" template="Magento_Core::template.phtml"/> diff --git a/app/code/Magento/Sales/view/frontend/order/trackinginfo.phtml b/app/code/Magento/Sales/view/frontend/order/trackinginfo.phtml deleted file mode 100644 index 496058dc42a..00000000000 --- a/app/code/Magento/Sales/view/frontend/order/trackinginfo.phtml +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<div class="field row grid" id="shipment_tracking_info"> -<?php if($this->getTrackingInfo()): ?> - <div class="title"><strong><?php echo $this->escapeHtml($this->getTrackingInfo()->getCarrierTitle()) ?></strong> - <?php echo $this->getTrackingInfo()->getTracking() ?></div> - <div class="info"> - <?php if ($this->getTrackingInfo()->getErrorMessage()): ?> - <?php echo $this->escapeHtml($this->getTrackingInfo()->getErrorMessage()) ?> - <?php else: ?> - <?php if ($this->getTrackingInfo()->getUrl()): ?> - <?php echo __('Please, visit for more info') ?>: <a href="<?php echo $this->getTrackingInfo()->getUrl() ?>" target="_blank"><?php echo $this->escapeHtml($this->getTrackingInfo()->getCarrierTitle()) ?></a><br /> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getStatus()): ?> - <?php echo __('Status') ?>: <?php echo $this->getTrackingInfo()->getStatus() ?><br /> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getDeliverydate()): ?> - <?php echo __('Delivery Date') ?>: <?php echo $this->getTrackingInfo()->getDeliverydate() ?><br /> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getDeliverytime()): ?> - <?php echo __('Delivery Time') ?>: <?php echo $this->getTrackingInfo()->getDeliverytime() ?><br /> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getDeliverylocation()): ?> - <?php echo __('Delivery Location') ?>: <?php echo $this->getTrackingInfo()->getDeliverylocation() ?><br /> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getSignedby()): ?> - <?php echo __('Signed by') ?>: <?php echo $this->getTrackingInfo()->getSignedby() ?><br /> - <?php endif; ?> - - <?php if ($this->getTrackingInfo()->getTrackSummary()): ?> - <?php echo __('Tracking summary') ?>: <?php echo $this->getTrackingInfo()->getTrackSummary() ?><br /> - <?php endif; ?> - <?php endif; ?> - </div> -<?php endif; ?> -</div> diff --git a/app/code/Magento/Sales/view/frontend/order/view.phtml b/app/code/Magento/Sales/view/frontend/order/view.phtml index 29bc5523a36..af4e422a513 100644 --- a/app/code/Magento/Sales/view/frontend/order/view.phtml +++ b/app/code/Magento/Sales/view/frontend/order/view.phtml @@ -23,18 +23,14 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> +<?php /** @var $this \Magento\Sales\Block\Order\View*/?> <div class="order details items"> <?php $_order = $this->getOrder() ?> <div class="order subtitle caption"> <strong><?php echo __('Items Ordered') ?></strong> <?php if ($_order->getTracksCollection()->count()) : ?> - <a href="#" - data-mage-init="{popupWindow: {windowURL:'<?php echo $this->helper('Magento\Shipping\Helper\Data')->getTrackingPopupUrlBySalesModel($_order) ?>',windowName:'trackorder',top:0,left:0,width:800,height:600,resizable:1,scrollbars:1}}" - title="<?php echo __('Track your order') ?>" - class="action track"> - <span><?php echo __('Track your order') ?></span> - </a> + <?php echo $this->getChildHtml('tracking-info-link') ?> <?php endif; ?> </div> diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php index 24228e79088..f7c88fa3de7 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php @@ -321,7 +321,7 @@ class Quote extends \Magento\Backend\App\Action /** * Export coupon codes as excel xml file * - * @return void + * @return \Magento\App\ResponseInterface|null */ public function exportCouponsXmlAction() { @@ -332,7 +332,7 @@ class Quote extends \Magento\Backend\App\Action $content = $this->_view->getLayout() ->createBlock('Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid') ->getExcelFile($fileName); - return $this->_fileFactory->create($fileName, $content, \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } else { $this->_redirect('sales_rule/*/detail', array('_current' => true)); return; @@ -342,7 +342,7 @@ class Quote extends \Magento\Backend\App\Action /** * Export coupon codes as CSV file * - * @return void + * @return \Magento\App\ResponseInterface|null */ public function exportCouponsCsvAction() { @@ -353,7 +353,7 @@ class Quote extends \Magento\Backend\App\Action $content = $this->_view->getLayout() ->createBlock('Magento\SalesRule\Block\Adminhtml\Promo\Quote\Edit\Tab\Coupons\Grid') ->getCsvFile(); - return $this->_fileFactory->create($fileName, $content, \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create($fileName, $content, \Magento\App\Filesystem::VAR_DIR); } else { $this->_redirect('sales_rule/*/detail', array('_current' => true)); return; diff --git a/app/code/Magento/SalesRule/etc/module.xml b/app/code/Magento/SalesRule/etc/module.xml index 866685ab5da..d3c447efbf9 100755 --- a/app/code/Magento/SalesRule/etc/module.xml +++ b/app/code/Magento/SalesRule/etc/module.xml @@ -43,6 +43,8 @@ <module name="Magento_Shipping"/> <module name="Magento_Payment"/> <module name="Magento_Reports"/> + <module name="Magento_CatalogRule"/> + <module name="Magento_Widget"/> </depends> </module> </config> diff --git a/app/code/Magento/Sendfriend/Block/Send.php b/app/code/Magento/Sendfriend/Block/Send.php index bb98538ff8b..6b65cc34b37 100644 --- a/app/code/Magento/Sendfriend/Block/Send.php +++ b/app/code/Magento/Sendfriend/Block/Send.php @@ -73,6 +73,7 @@ class Send extends \Magento\View\Element\Template $this->_coreRegistry = $registry; $this->_sendfriendData = $sendfriendData; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Sendfriend/etc/module.xml b/app/code/Magento/Sendfriend/etc/module.xml index 6dc5657e233..d9f8318e8a8 100755 --- a/app/code/Magento/Sendfriend/etc/module.xml +++ b/app/code/Magento/Sendfriend/etc/module.xml @@ -32,6 +32,8 @@ <module name="Magento_Catalog"/> <module name="Magento_Core"/> <module name="Magento_Customer"/> + <module name="Magento_Email"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create.php b/app/code/Magento/Shipping/Block/Adminhtml/Create.php similarity index 95% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create.php rename to app/code/Magento/Shipping/Block/Adminhtml/Create.php index 48b65b5e0c5..c86625f04da 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Create.php @@ -28,7 +28,7 @@ * Adminhtml shipment create */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment; +namespace Magento\Shipping\Block\Adminhtml; class Create extends \Magento\Backend\Block\Widget\Form\Container { @@ -56,7 +56,6 @@ class Create extends \Magento\Backend\Block\Widget\Form\Container protected function _construct() { $this->_objectId = 'order_id'; - $this->_controller = 'adminhtml_order_shipment'; $this->_mode = 'create'; parent::_construct(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Form.php b/app/code/Magento/Shipping/Block/Adminhtml/Create/Form.php similarity index 84% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Form.php rename to app/code/Magento/Shipping/Block/Adminhtml/Create/Form.php index 46ac3e0d8ff..f30ca8c4c53 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Form.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Create/Form.php @@ -28,7 +28,7 @@ * Adminhtml shipment create form */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment\Create; +namespace Magento\Shipping\Block\Adminhtml\Create; class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder { @@ -64,8 +64,7 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder protected function _prepareLayout() { - $this->addChild('items', 'Magento\Sales\Block\Adminhtml\Order\Shipment\Create\Items'); - $this->addChild('tracking', 'Magento\Sales\Block\Adminhtml\Order\Shipment\Create\Tracking'); + $this->addChild('items', 'Magento\Shipping\Block\Adminhtml\Create\Items'); return parent::_prepareLayout(); } @@ -81,6 +80,6 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder public function getSaveUrl() { - return $this->getUrl('sales/*/save', array('order_id' => $this->getShipment()->getOrderId())); + return $this->getUrl('*/*/save', array('order_id' => $this->getShipment()->getOrderId())); } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Items.php b/app/code/Magento/Shipping/Block/Adminhtml/Create/Items.php similarity index 89% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Items.php rename to app/code/Magento/Shipping/Block/Adminhtml/Create/Items.php index 4cbcf2ad4e1..7eb898cd27f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Items.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Create/Items.php @@ -27,7 +27,7 @@ /** * Adminhtml shipment items grid */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment\Create; +namespace Magento\Shipping\Block\Adminhtml\Create; class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems { @@ -38,11 +38,17 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems */ protected $_salesData = null; + /** + * @var \Magento\Shipping\Model\CarrierFactory + */ + protected $_carrierFactory; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Core\Model\Registry $registry * @param \Magento\Sales\Helper\Data $salesData + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param array $data */ public function __construct( @@ -50,9 +56,11 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Core\Model\Registry $registry, \Magento\Sales\Helper\Data $salesData, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, array $data = array() ) { $this->_salesData = $salesData; + $this->_carrierFactory = $carrierFactory; parent::__construct($context, $productFactory, $registry, $data); } @@ -148,7 +156,9 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems */ public function canCreateShippingLabel() { - $shippingCarrier = $this->getOrder()->getShippingCarrier(); + $shippingCarrier = $this->_carrierFactory->create( + $this->getOrder()->getShippingMethod(true)->getCarrierCode() + ); return $shippingCarrier && $shippingCarrier->isShippingLabelsAvailable(); } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php similarity index 85% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging.php rename to app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php index cf7f65dd1f2..c11167aa936 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Sales * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +26,7 @@ * Adminhtml shipment packaging */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment; +namespace Magento\Shipping\Block\Adminhtml\Order; class Packaging extends \Magento\Backend\Block\Template { @@ -49,11 +47,17 @@ class Packaging extends \Magento\Backend\Block\Template */ protected $_jsonEncoder; + /** + * @var \Magento\Shipping\Model\CarrierFactory + */ + protected $_carrierFactory; + /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Usa\Model\Shipping\Carrier\Usps\Source\Size $sourceSizeModel * @param \Magento\Core\Model\Registry $coreRegistry + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param array $data */ public function __construct( @@ -61,11 +65,13 @@ class Packaging extends \Magento\Backend\Block\Template \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Usa\Model\Shipping\Carrier\Usps\Source\Size $sourceSizeModel, \Magento\Core\Model\Registry $coreRegistry, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, array $data = array() ) { $this->_jsonEncoder = $jsonEncoder; $this->_coreRegistry = $coreRegistry; $this->_sourceSizeModel = $sourceSizeModel; + $this->_carrierFactory = $carrierFactory; parent::__construct($context, $data); } @@ -98,8 +104,8 @@ class Packaging extends \Magento\Backend\Block\Template if ($shipmentId) { $urlParams['shipment_id'] = $shipmentId; - $createLabelUrl = $this->getUrl('sales/order_shipment/createLabel', $urlParams); - $itemsGridUrl = $this->getUrl('sales/order_shipment/getShippingItemsGrid', $urlParams); + $createLabelUrl = $this->getUrl('adminhtml/order_shipment/createLabel', $urlParams); + $itemsGridUrl = $this->getUrl('adminhtml/order_shipment/getShippingItemsGrid', $urlParams); foreach ($this->getShipment()->getAllItems() as $item) { $itemsQty[$item->getId()] = $item->getQty(); $itemsPrice[$item->getId()] = $item->getPrice(); @@ -110,8 +116,8 @@ class Packaging extends \Magento\Backend\Block\Template } } else if ($orderId) { $urlParams['order_id'] = $orderId; - $createLabelUrl = $this->getUrl('sales/order_shipment/save', $urlParams); - $itemsGridUrl = $this->getUrl('sales/order_shipment/getShippingItemsGrid', $urlParams); + $createLabelUrl = $this->getUrl('adminhtml/order_shipment/save', $urlParams); + $itemsGridUrl = $this->getUrl('adminhtml/order_shipment/getShippingItemsGrid', $urlParams); foreach ($this->getShipment()->getAllItems() as $item) { $itemsQty[$item->getOrderItemId()] = $item->getQty()*1; @@ -149,8 +155,8 @@ class Packaging extends \Magento\Backend\Block\Template $order = $this->getShipment()->getOrder(); $storeId = $this->getShipment()->getStoreId(); $address = $order->getShippingAddress(); - $carrier = $order->getShippingCarrier(); - $countryShipper = $this->_storeConfig->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, $storeId); + $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); + $countryShipper = $this->_storeConfig->getConfig(\Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $storeId); if ($carrier) { $params = new \Magento\Object(array( 'method' => $order->getShippingMethod(true)->getMethod(), @@ -169,7 +175,8 @@ class Packaging extends \Magento\Backend\Block\Template */ protected function _getCustomizableContainers() { - $carrier = $this->getShipment()->getOrder()->getShippingCarrier(); + $order = $this->getShipment()->getOrder(); + $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); if ($carrier) { return $carrier->getCustomizableContainerTypes(); } @@ -184,7 +191,8 @@ class Packaging extends \Magento\Backend\Block\Template */ public function getContainerTypeByCode($code) { - $carrier = $this->getShipment()->getOrder()->getShippingCarrier(); + $order = $this->getShipment()->getOrder(); + $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); if ($carrier) { $containerTypes = $carrier->getContainerTypes(); $containerType = !empty($containerTypes[$code]) ? $containerTypes[$code] : ''; @@ -202,7 +210,8 @@ class Packaging extends \Magento\Backend\Block\Template public function getDeliveryConfirmationTypeByCode($code) { $countryId = $this->getShipment()->getOrder()->getShippingAddress()->getCountryId(); - $carrier = $this->getShipment()->getOrder()->getShippingCarrier(); + $order = $this->getShipment()->getOrder(); + $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); if ($carrier) { $params = new \Magento\Object(array('country_recipient' => $countryId)); $confirmationTypes = $carrier->getDeliveryConfirmationTypes($params); @@ -268,7 +277,7 @@ class Packaging extends \Magento\Backend\Block\Template $order = $this->getShipment()->getOrder(); $address = $order->getShippingAddress(); $shipperAddressCountryCode = $this->_storeConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $storeId ); $recipientAddressCountryCode = $address->getCountryId(); @@ -286,7 +295,8 @@ class Packaging extends \Magento\Backend\Block\Template public function getDeliveryConfirmationTypes() { $countryId = $this->getShipment()->getOrder()->getShippingAddress()->getCountryId(); - $carrier = $this->getShipment()->getOrder()->getShippingCarrier(); + $order = $this->getShipment()->getOrder(); + $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); $params = new \Magento\Object(array('country_recipient' => $countryId)); if ($carrier && is_array($carrier->getDeliveryConfirmationTypes($params))) { return $carrier->getDeliveryConfirmationTypes($params); @@ -302,7 +312,7 @@ class Packaging extends \Magento\Backend\Block\Template public function getPrintButton() { $data['shipment_id'] = $this->getShipment()->getId(); - $url = $this->getUrl('sales/order_shipment/printPackage', $data); + $url = $this->getUrl('adminhtml/order_shipment/printPackage', $data); return $this->getLayout() ->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( @@ -314,16 +324,12 @@ class Packaging extends \Magento\Backend\Block\Template /** * Check whether girth is allowed for current carrier - * - * @return void */ public function isGirthAllowed() { - return $this - ->getShipment() - ->getOrder() - ->getShippingCarrier() - ->isGirthAllowed($this->getShipment()->getOrder()->getShippingAddress()->getCountryId()); + $order = $this->getShipment()->getOrder(); + $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); + return $carrier->isGirthAllowed($this->getShipment()->getOrder()->getShippingAddress()->getCountryId()); } /** @@ -336,8 +342,8 @@ class Packaging extends \Magento\Backend\Block\Template $order = $this->getShipment()->getOrder(); $storeId = $this->getShipment()->getStoreId(); $address = $order->getShippingAddress(); - $carrier = $order->getShippingCarrier(); - $countryShipper = $this->_storeConfig->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, $storeId); + $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); + $countryShipper = $this->_storeConfig->getConfig(\Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $storeId); if ($carrier) { $params = new \Magento\Object(array( 'method' => $order->getShippingMethod(true)->getMethod(), diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging/Grid.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php similarity index 88% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging/Grid.php rename to app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php index 9ac5eed5d58..164b2308d8d 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Packaging/Grid.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Packaging/Grid.php @@ -18,25 +18,16 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Bundle * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Grid of packaging shipment - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment\Packaging; +namespace Magento\Shipping\Block\Adminhtml\Order\Packaging; class Grid extends \Magento\Backend\Block\Template { - protected $_template = 'order/shipment/packaging/grid.phtml'; + protected $_template = 'order/packaging/grid.phtml'; /** * Core registry @@ -104,7 +95,7 @@ class Grid extends \Magento\Backend\Block\Template $order = $this->getShipment()->getOrder(); $address = $order->getShippingAddress(); $shipperAddressCountryCode = $this->_storeConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $storeId ); $recipientAddressCountryCode = $address->getCountryId(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Tracking.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking.php similarity index 89% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Tracking.php rename to app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking.php index 88cec6e5e78..e67478fb5c5 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Create/Tracking.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Sales * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,11 +25,8 @@ /** * Shipment tracking control form * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment\Create; +namespace Magento\Shipping\Block\Adminhtml\Order; class Tracking extends \Magento\Backend\Block\Template { @@ -76,7 +71,6 @@ class Tracking extends \Magento\Backend\Block\Template 'class' => '', 'onclick' => 'trackingControl.add()' )); - } /** @@ -90,16 +84,14 @@ class Tracking extends \Magento\Backend\Block\Template } /** - * Retrieve + * Retrieve carriers * - * @return unknown + * @return array */ public function getCarriers() { $carriers = array(); - $carrierInstances = $this->_shippingConfig->getAllCarriers( - $this->getShipment()->getStoreId() - ); + $carrierInstances = $this->_getCarriersInstances(); $carriers['custom'] = __('Custom Value'); foreach ($carrierInstances as $code => $carrier) { if ($carrier->isTrackingAvailable()) { @@ -108,4 +100,11 @@ class Tracking extends \Magento\Backend\Block\Template } return $carriers; } + + protected function _getCarriersInstances() + { + return $this->_shippingConfig->getAllCarriers( + $this->getShipment()->getStoreId() + ); + } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Tracking/Info.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/Invoice.php similarity index 62% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Tracking/Info.php rename to app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/Invoice.php index 8a5a9556ed8..c35fc28fa33 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/Tracking/Info.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/Invoice.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Sales * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,14 +25,30 @@ /** * Shipment tracking control form * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment\Tracking; +namespace Magento\Shipping\Block\Adminhtml\Order\Tracking; -class Info extends \Magento\Backend\Block\Template +class Invoice extends \Magento\Shipping\Block\Adminhtml\Order\Tracking { + /** + * Retrieve shipment model instance + * + * @return \Magento\Sales\Model\Order\Shipment + */ + public function getInvoice() + { + return $this->_coreRegistry->registry('current_invoice'); + } - protected $_template = 'order/shipment/tracking/info.phtml'; + /** + * Retrieve + * + * @return unknown + */ + protected function _getCarriersInstances() + { + return $this->_shippingConfig->getAllCarriers( + $this->getInvoice()->getStoreId() + ); + } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Tracking.php b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/View.php similarity index 58% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Tracking.php rename to app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/View.php index 6d86636c13d..35a3369d526 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Tracking.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/View.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Sales * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,41 +25,32 @@ /** * Shipment tracking control form * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment\View; +namespace Magento\Shipping\Block\Adminhtml\Order\Tracking; -class Tracking extends \Magento\Backend\Block\Template +class View extends \Magento\Shipping\Block\Adminhtml\Order\Tracking { /** - * Core registry - * - * @var \Magento\Core\Model\Registry - */ - protected $_coreRegistry = null; - - /** - * @var \Magento\Shipping\Model\Config + * @var \Magento\Shipping\Model\CarrierFactory */ - protected $_shippingConfig; + protected $_carrierFactory; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Core\Model\Registry $registry, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, array $data = array() ) { - $this->_shippingConfig = $shippingConfig; - $this->_coreRegistry = $registry; - parent::__construct($context, $data); + parent::__construct($context, $shippingConfig, $registry, $data); + $this->_carrierFactory = $carrierFactory; } /** @@ -79,16 +68,6 @@ class Tracking extends \Magento\Backend\Block\Template )); } - /** - * Retrieve shipment model instance - * - * @return \Magento\Sales\Model\Order\Shipment - */ - public function getShipment() - { - return $this->_coreRegistry->registry('current_shipment'); - } - /** * Retrieve save url * @@ -96,7 +75,7 @@ class Tracking extends \Magento\Backend\Block\Template */ public function getSubmitUrl() { - return $this->getUrl('sales/*/addTrack/', array('shipment_id'=>$this->getShipment()->getId())); + return $this->getUrl('adminhtml/*/addTrack/', array('shipment_id'=>$this->getShipment()->getId())); } /** @@ -112,52 +91,20 @@ class Tracking extends \Magento\Backend\Block\Template /** * Retrieve remove url * + * @param $track * @return string */ public function getRemoveUrl($track) { - return $this->getUrl('sales/*/removeTrack/', array( - 'shipment_id' => $this->getShipment()->getId(), - 'track_id' => $track->getId() - )); - } - - /** - * Retrieve remove url - * - * @return string - */ - public function getTrackInfoUrl($track) - { - return $this->getUrl('sales/*/viewTrack/', array( + return $this->getUrl('adminhtml/*/removeTrack/', array( 'shipment_id' => $this->getShipment()->getId(), 'track_id' => $track->getId() )); } - /** - * Retrieve - * - * @return unknown - */ - public function getCarriers() - { - $carriers = array(); - $carrierInstances = $this->_shippingConfig->getAllCarriers( - $this->getShipment()->getStoreId() - ); - $carriers['custom'] = __('Custom Value'); - foreach ($carrierInstances as $code => $carrier) { - if ($carrier->isTrackingAvailable()) { - $carriers[$code] = $carrier->getConfigData('title'); - } - } - return $carriers; - } - public function getCarrierTitle($code) { - $carrier = $this->_shippingConfig->getCarrierInstance($code); + $carrier = $this->_carrierFactory->create($code); if ($carrier) { return $carrier->getConfigData('title'); } else { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View.php b/app/code/Magento/Shipping/Block/Adminhtml/View.php similarity index 74% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View.php rename to app/code/Magento/Shipping/Block/Adminhtml/View.php index 488ec0870b7..3dddf344edf 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/View.php @@ -31,7 +31,7 @@ * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment; +namespace Magento\Shipping\Block\Adminhtml; class View extends \Magento\Backend\Block\Widget\Form\Container { @@ -58,9 +58,8 @@ class View extends \Magento\Backend\Block\Widget\Form\Container protected function _construct() { - $this->_objectId = 'shipment_id'; - $this->_controller = 'adminhtml_order_shipment'; - $this->_mode = 'view'; + $this->_objectId = 'shipment_id'; + $this->_mode = 'view'; parent::_construct(); @@ -72,18 +71,22 @@ class View extends \Magento\Backend\Block\Widget\Form\Container if ($this->_authorization->isAllowed('Magento_Sales::emails')) { $this->_updateButton('save', 'label', __('Send Tracking Information')); - $this->_updateButton('save', - 'onclick', "deleteConfirm('" + $this->_updateButton( + 'save', + 'onclick', + "deleteConfirm('" . __('Are you sure you want to send a Shipment email to customer?') . "', '" . $this->getEmailUrl() . "')" ); } if ($this->getShipment()->getId()) { - $this->_addButton('print', array( - 'label' => __('Print'), - 'class' => 'save', - 'onclick' => 'setLocation(\''.$this->getPrintUrl().'\')' + $this->_addButton( + 'print', + array( + 'label' => __('Print'), + 'class' => 'save', + 'onclick' => 'setLocation(\'' . $this->getPrintUrl() . '\')' ) ); } @@ -106,7 +109,12 @@ class View extends \Magento\Backend\Block\Widget\Form\Container } else { $emailSent = __('the shipment email is not sent'); } - return __('Shipment #%1 | %3 (%2)', $this->getShipment()->getIncrementId(), $emailSent, $this->formatDate($this->getShipment()->getCreatedAtDate(), 'medium', true)); + return __( + 'Shipment #%1 | %3 (%2)', + $this->getShipment()->getIncrementId(), + $emailSent, + $this->formatDate($this->getShipment()->getCreatedAtDate(), 'medium', true) + ); } public function getBackUrl() @@ -116,26 +124,34 @@ class View extends \Magento\Backend\Block\Widget\Form\Container array( 'order_id' => $this->getShipment() ? $this->getShipment()->getOrderId() : null, 'active_tab' => 'order_shipments' - )); + ) + ); } public function getEmailUrl() { - return $this->getUrl('sales/order_shipment/email', array('shipment_id' => $this->getShipment()->getId())); + return $this->getUrl('adminhtml/order_shipment/email', array('shipment_id' => $this->getShipment()->getId())); } public function getPrintUrl() { - return $this->getUrl('sales/*/print', array( - 'invoice_id' => $this->getShipment()->getId() - )); + return $this->getUrl( + 'sales/shipment/print', + array( + 'shipment_id' => $this->getShipment()->getId() + ) + ); } public function updateBackButtonUrl($flag) { if ($flag) { if ($this->getShipment()->getBackUrl()) { - return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getShipment()->getBackUrl() . '\')'); + return $this->_updateButton( + 'back', + 'onclick', + 'setLocation(\'' . $this->getShipment()->getBackUrl() . '\')' + ); } return $this->_updateButton('back', 'onclick', 'setLocation(\'' . $this->getUrl('sales/shipment/') . '\')'); } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Comments.php b/app/code/Magento/Shipping/Block/Adminhtml/View/Comments.php similarity index 97% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Comments.php rename to app/code/Magento/Shipping/Block/Adminhtml/View/Comments.php index b317fb5dc7a..65bccdf3480 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Comments.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/View/Comments.php @@ -32,7 +32,7 @@ * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment\View; +namespace Magento\Shipping\Block\Adminhtml\View; class Comments extends \Magento\Backend\Block\Text\ListText { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Form.php b/app/code/Magento/Shipping/Block/Adminhtml/View/Form.php similarity index 75% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Form.php rename to app/code/Magento/Shipping/Block/Adminhtml/View/Form.php index f197732a87b..b7a1ac3b597 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Form.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/View/Form.php @@ -31,10 +31,33 @@ * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment\View; +namespace Magento\Shipping\Block\Adminhtml\View; class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder { + /** + * @var \Magento\Shipping\Model\CarrierFactory + */ + protected $_carrierFactory; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Sales\Helper\Admin $adminHelper + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Sales\Helper\Admin $adminHelper, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, + array $data = array() + ) { + $this->_carrierFactory = $carrierFactory; + parent::__construct($context, $registry, $adminHelper, $data); + } + /** * Retrieve shipment model instance * @@ -73,7 +96,7 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder public function getCreateLabelButton() { $data['shipment_id'] = $this->getShipment()->getId(); - $url = $this->getUrl('sales/order_shipment/createLabel', $data); + $url = $this->getUrl('adminhtml/order_shipment/createLabel', $data); return $this->getLayout() ->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( @@ -91,7 +114,7 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder public function getPrintLabelButton() { $data['shipment_id'] = $this->getShipment()->getId(); - $url = $this->getUrl('sales/order_shipment/printLabel', $data); + $url = $this->getUrl('adminhtml/order_shipment/printLabel', $data); return $this->getLayout() ->createBlock('Magento\Backend\Block\Widget\Button') ->setData(array( @@ -124,7 +147,7 @@ class Form extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder */ public function canCreateShippingLabel() { - $shippingCarrier = $this->getOrder()->getShippingCarrier(); + $shippingCarrier = $this->_carrierFactory->create($this->getOrder()->getShippingMethod(true)->getCarrierCode()); return $shippingCarrier && $shippingCarrier->isShippingLabelsAvailable(); } } diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Items.php b/app/code/Magento/Shipping/Block/Adminhtml/View/Items.php similarity index 96% rename from app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Items.php rename to app/code/Magento/Shipping/Block/Adminhtml/View/Items.php index 0f812c5371b..38551debc2a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Shipment/View/Items.php +++ b/app/code/Magento/Shipping/Block/Adminhtml/View/Items.php @@ -32,7 +32,7 @@ * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Adminhtml\Order\Shipment\View; +namespace Magento\Shipping\Block\Adminhtml\View; class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems { diff --git a/app/code/Magento/Sales/Block/Order/Shipment/Items.php b/app/code/Magento/Shipping/Block/Items.php similarity index 98% rename from app/code/Magento/Sales/Block/Order/Shipment/Items.php rename to app/code/Magento/Shipping/Block/Items.php index b0a47858759..079c92af58f 100644 --- a/app/code/Magento/Sales/Block/Order/Shipment/Items.php +++ b/app/code/Magento/Shipping/Block/Items.php @@ -31,7 +31,7 @@ * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Block\Order\Shipment; +namespace Magento\Shipping\Block; class Items extends \Magento\Sales\Block\Items\AbstractItems { diff --git a/app/code/Magento/Sales/Block/Order/Shipment.php b/app/code/Magento/Shipping/Block/Order/Shipment.php similarity index 98% rename from app/code/Magento/Sales/Block/Order/Shipment.php rename to app/code/Magento/Shipping/Block/Order/Shipment.php index 69b957a445c..ac9ae1692bd 100644 --- a/app/code/Magento/Sales/Block/Order/Shipment.php +++ b/app/code/Magento/Shipping/Block/Order/Shipment.php @@ -27,7 +27,7 @@ /** * Sales order view block */ -namespace Magento\Sales\Block\Order; +namespace Magento\Shipping\Block\Order; class Shipment extends \Magento\View\Element\Template { @@ -71,6 +71,7 @@ class Shipment extends \Magento\View\Element\Template $this->_coreRegistry = $registry; $this->_customerSession = $customerSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } protected function _prepareLayout() diff --git a/app/code/Magento/PageCache/Block/Adminhtml/Cache/Additional.php b/app/code/Magento/Shipping/Block/Tracking/Link.php similarity index 52% rename from app/code/Magento/PageCache/Block/Adminhtml/Cache/Additional.php rename to app/code/Magento/Shipping/Block/Tracking/Link.php index 114a2b310f5..43849379fbf 100644 --- a/app/code/Magento/PageCache/Block/Adminhtml/Cache/Additional.php +++ b/app/code/Magento/Shipping/Block/Tracking/Link.php @@ -18,62 +18,64 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_PageCache * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Shipping\Block\Tracking; + /** - * System cache management additional block - * - * @category Magento - * @package Magento_PageCache - * @author Magento Core Team <core@magentocommerce.com> + * Tracking info link */ -namespace Magento\PageCache\Block\Adminhtml\Cache; - -class Additional extends \Magento\Backend\Block\Template +class Link extends \Magento\View\Element\Html\Link { /** - * Page cache data + * Core registry + * + * @var \Magento\Core\Model\Registry + */ + protected $_coreRegistry; + + /** + * Shipping data * - * @var \Magento\PageCache\Helper\Data + * @var \Magento\Shipping\Helper\Data */ - protected $_pageCacheData = null; + protected $_shippingData; /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\PageCache\Helper\Data $pageCacheData + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Shipping\Helper\Data $shippingData * @param array $data */ public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\PageCache\Helper\Data $pageCacheData, + \Magento\View\Element\Template\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Shipping\Helper\Data $shippingData, array $data = array() ) { - $this->_pageCacheData = $pageCacheData; + $this->_shippingData = $shippingData; + $this->_coreRegistry = $registry; parent::__construct($context, $data); } /** - * Get clean cache url - * + * @param \Magento\Sales\Model\AbstractModel $model * @return string */ - public function getCleanExternalCacheUrl() + public function getWindowUrl($model) { - return $this->getUrl('adminhtml/pageCache/clean'); + return $this->_shippingData->getTrackingPopupUrlBySalesModel($model); } /** - * Check if block can be displayed + * Retrieve current order model instance * - * @return bool + * @return \Magento\Sales\Model\Order */ - public function canShowButton() + public function getOrder() { - return $this->_pageCacheData->isEnabled() - && $this->_authorization->isAllowed('Magento_PageCache::page_cache'); + return $this->_coreRegistry->registry('current_order'); } } diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php similarity index 85% rename from app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php rename to app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php index 051f034840d..3ea830b4f8e 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Shipment.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php @@ -25,13 +25,13 @@ */ /** - * Adminhtml sales order shipment controller + * Adminhtml order shipment controller * * @category Magento * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Sales\Controller\Adminhtml\Order; +namespace Magento\Shipping\Controller\Adminhtml\Order; class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShipment { @@ -40,25 +40,33 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip * * @var \Magento\Core\Model\Registry */ - protected $_coreRegistry = null; + protected $_coreRegistry; /** * @var \Magento\App\Response\Http\FileFactory */ protected $_fileFactory; + /** + * @var \Magento\Shipping\Model\CarrierFactory + */ + protected $_carrierFactory; + /** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\App\Response\Http\FileFactory $fileFactory * @param \Magento\Core\Model\Registry $coreRegistry + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory */ public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\App\Response\Http\FileFactory $fileFactory, - \Magento\Core\Model\Registry $coreRegistry + \Magento\Core\Model\Registry $coreRegistry, + \Magento\Shipping\Model\CarrierFactory $carrierFactory ) { $this->_coreRegistry = $coreRegistry; $this->_fileFactory = $fileFactory; + $this->_carrierFactory = $carrierFactory; parent::__construct($context, $fileFactory); } @@ -79,6 +87,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip /** * Initialize shipment model instance * + * @throws \Magento\Core\Exception * @return \Magento\Sales\Model\Order\Shipment|bool */ protected function _initShipment() @@ -91,7 +100,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip if ($shipmentId) { $shipment = $this->_objectManager->create('Magento\Sales\Model\Order\Shipment')->load($shipmentId); } elseif ($orderId) { - $order = $this->_objectManager->create('Magento\Sales\Model\Order')->load($orderId); + $order = $this->_objectManager->create('Magento\Sales\Model\Order')->load($orderId); /** * Check order existing @@ -139,7 +148,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip * Save shipment and order in one transaction * * @param \Magento\Sales\Model\Order\Shipment $shipment - * @return \Magento\Sales\Controller\Adminhtml\Order\Shipment + * @return \Magento\Shipping\Controller\Adminhtml\Order\Shipment */ protected function _saveShipment($shipment) { @@ -178,7 +187,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip /** * Clear old values for shipment qty's */ - $this->_redirect('sales/*/new', array('order_id'=>$this->getRequest()->getParam('order_id'))); + $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id'))); } /** @@ -199,7 +208,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->_setActiveMenu('Magento_Sales::sales_order'); $this->_view->renderLayout(); } else { - $this->_redirect('sales/order/view', array('order_id' => $this->getRequest()->getParam('order_id'))); + $this->_redirect('*/order/view', array('order_id' => $this->getRequest()->getParam('order_id'))); } } @@ -253,10 +262,13 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $shipment->sendEmail(!empty($data['send_email']), $comment); $shipmentCreatedMessage = __('The shipment has been created.'); - $labelCreatedMessage = __('You created the shipping label.'); + $labelCreatedMessage = __('You created the shipping label.'); - $this->messageManager->addSuccess($isNeedCreateLabel ? $shipmentCreatedMessage . ' ' . $labelCreatedMessage - : $shipmentCreatedMessage); + $this->messageManager->addSuccess( + $isNeedCreateLabel + ? $shipmentCreatedMessage . ' ' . $labelCreatedMessage + : $shipmentCreatedMessage + ); $this->_objectManager->get('Magento\Backend\Model\Session')->getCommentText(true); } catch (\Magento\Core\Exception $e) { if ($isNeedCreateLabel) { @@ -264,17 +276,16 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $responseAjax->setMessage($e->getMessage()); } else { $this->messageManager->addError($e->getMessage()); - $this->_redirect('sales/*/new', array('order_id' => $this->getRequest()->getParam('order_id'))); + $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id'))); } } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); if ($isNeedCreateLabel) { $responseAjax->setError(true); - $responseAjax->setMessage( - __('An error occurred while creating shipping label.')); + $responseAjax->setMessage(__('An error occurred while creating shipping label.')); } else { $this->messageManager->addError(__('Cannot save shipment.')); - $this->_redirect('sales/*/new', array('order_id' => $this->getRequest()->getParam('order_id'))); + $this->_redirect('*/*/new', array('order_id' => $this->getRequest()->getParam('order_id'))); } } @@ -296,7 +307,8 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $shipment->sendEmail(true) ->setEmailSent(true) ->save(); - $historyItem = $this->_objectManager->create('Magento\Sales\Model\Resource\Order\Status\History\Collection') + $historyItem = $this->_objectManager + ->create('Magento\Sales\Model\Resource\Order\Status\History\Collection') ->getUnnotifiedForInstance($shipment, \Magento\Sales\Model\Order\Shipment::HISTORY_ENTITY_NAME); if ($historyItem) { $historyItem->setIsCustomerNotified(1); @@ -309,9 +321,12 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip } catch (\Exception $e) { $this->messageManager->addError(__('Cannot send shipment information.')); } - $this->_redirect('sales/*/view', array( - 'shipment_id' => $this->getRequest()->getParam('shipment_id') - )); + $this->_redirect( + '*/*/view', + array( + 'shipment_id' => $this->getRequest()->getParam('shipment_id') + ) + ); } /** @@ -321,8 +336,8 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip { try { $carrier = $this->getRequest()->getPost('carrier'); - $number = $this->getRequest()->getPost('number'); - $title = $this->getRequest()->getPost('title'); + $number = $this->getRequest()->getPost('number'); + $title = $this->getRequest()->getPost('title'); if (empty($carrier)) { throw new \Magento\Core\Exception(__('Please specify a carrier.')); } @@ -368,7 +383,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip */ public function removeTrackAction() { - $trackId = $this->getRequest()->getParam('track_id'); + $trackId = $this->getRequest()->getParam('track_id'); $track = $this->_objectManager->create('Magento\Sales\Model\Order\Shipment\Track')->load($trackId); if ($track->getId()) { try { @@ -401,44 +416,6 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->getResponse()->setBody($response); } - /** - * View shipment tracking information - */ - public function viewTrackAction() - { - $trackId = $this->getRequest()->getParam('track_id'); - $track = $this->_objectManager->create('Magento\Sales\Model\Order\Shipment\Track')->load($trackId); - if ($track->getId()) { - try { - $response = $track->getNumberDetail(); - } catch (\Exception $e) { - $response = array( - 'error' => true, - 'message' => __('Cannot retrieve tracking number detail.'), - ); - } - } else { - $response = array( - 'error' => true, - 'message' => __('Cannot load track with retrieving identifier.'), - ); - } - - if (is_object($response)) { - $block = $this->_objectManager->create('Magento\Backend\Block\Template'); - $block->setTemplate('sales/order/shipment/tracking/info.phtml'); - $block->setTrackingInfo($response); - - $this->getResponse()->setBody($block->toHtml()); - } else { - if (is_array($response)) { - $response = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response); - } - - $this->getResponse()->setBody($response); - } - } - /** * Add comment to shipment history */ @@ -484,6 +461,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip * Create shipping label for specific shipment with validation. * * @param \Magento\Sales\Model\Order\Shipment $shipment + * @throws \Magento\Core\Exception * @return bool */ protected function _createShippingLabel(\Magento\Sales\Model\Order\Shipment $shipment) @@ -491,7 +469,8 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip if (!$shipment) { return false; } - $carrier = $shipment->getOrder()->getShippingCarrier(); + $order = $shipment->getOrder(); + $carrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); if (!$carrier->isShippingLabelsAvailable()) { return false; } @@ -517,13 +496,13 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $shipment->setShippingLabel($outputPdf->render()); $carrierCode = $carrier->getCarrierCode(); $carrierTitle = $this->_objectManager->get('Magento\Core\Model\Store\Config') - ->getConfig('carriers/'.$carrierCode.'/title', $shipment->getStoreId()); + ->getConfig('carriers/' . $carrierCode . '/title', $shipment->getStoreId()); if ($trackingNumbers) { foreach ($trackingNumbers as $trackingNumber) { $track = $this->_objectManager->create('Magento\Sales\Model\Order\Shipment\Track') - ->setNumber($trackingNumber) - ->setCarrierCode($carrierCode) - ->setTitle($carrierTitle); + ->setNumber($trackingNumber) + ->setCarrierCode($carrierCode) + ->setTitle($carrierTitle); $shipment->addTrack($track); } } @@ -532,7 +511,6 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip /** * Create shipping label action for specific shipment - * */ public function createLabelAction() { @@ -558,7 +536,6 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip /** * Print label for one specific shipment - * */ public function printLabelAction() { @@ -574,7 +551,10 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $page = $this->_createPdfPageFromImageString($labelContent); if (!$page) { $this->messageManager->addError( - __('We don\'t recognize or support the file extension in this shipment: %1.', $shipment->getIncrementId()) + __( + 'We don\'t recognize or support the file extension in this shipment: %1.', + $shipment->getIncrementId() + ) ); } $pdf->pages[] = $page; @@ -584,7 +564,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip return $this->_fileFactory->create( 'ShippingLabel(' . $shipment->getIncrementId() . ').pdf', $pdfContent, - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } @@ -593,27 +573,30 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $this->messageManager->addError(__('An error occurred while creating shipping label.')); - } - $this->_redirect('sales/order_shipment/view', array( - 'shipment_id' => $this->getRequest()->getParam('shipment_id') - )); + } + $this->_redirect( + 'adminhtml/order_shipment/view', + array( + 'shipment_id' => $this->getRequest()->getParam('shipment_id') + ) + ); } /** * Create pdf document with information about packages * - * @return void + * @return \Magento\App\ResponseInterface */ public function printPackageAction() { $shipment = $this->_initShipment(); if ($shipment) { - $pdf = $this->_objectManager->create('Magento\Sales\Model\Order\Pdf\Shipment\Packaging')->getPdf($shipment); + $pdf = $this->_objectManager->create('Magento\Shipping\Model\Order\Pdf\Packaging')->getPdf($shipment); return $this->_fileFactory->create( 'packingslip' . $this->_objectManager->get('Magento\Core\Model\Date')->date('Y-m-d_H-i-s') . '.pdf', $pdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } else { @@ -667,7 +650,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip return $this->_fileFactory->create( 'ShippingLabels.pdf', $outputPdf->render(), - \Magento\Filesystem::VAR_DIR, + \Magento\App\Filesystem::VAR_DIR, 'application/pdf' ); } @@ -677,7 +660,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->_redirect('sales/order/index'); } else { $this->messageManager->addError(__('There are no shipping labels related to selected shipments.')); - $this->_redirect('sales/order_shipment/index'); + $this->_redirect('adminhtml/order_shipment/index'); } } @@ -715,8 +698,8 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip protected function _createPdfPageFromImageString($imageString) { /** @var \Magento\Filesystem\Directory\Write $directory */ - $directory = $this->_objectManager->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::TMP); + $directory = $this->_objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::TMP_DIR); $image = imagecreatefromstring($imageString); if (!$image) { return false; @@ -745,9 +728,9 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->_initShipment(); return $this->getResponse()->setBody( $this->_view->getLayout() - ->createBlock('Magento\Sales\Block\Adminhtml\Order\Shipment\Packaging\Grid') + ->createBlock('Magento\Shipping\Block\Adminhtml\Order\Packaging\Grid') ->setIndex($this->getRequest()->getParam('index')) ->toHtml() - ); + ); } } diff --git a/app/code/Magento/Shipping/Controller/Tracking.php b/app/code/Magento/Shipping/Controller/Tracking.php index de7633c02e8..b12f7df47c8 100644 --- a/app/code/Magento/Shipping/Controller/Tracking.php +++ b/app/code/Magento/Shipping/Controller/Tracking.php @@ -18,24 +18,16 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Shipping * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Sales orders controller - * - * @category Magento - * @package Magento_Sales - * @author Magento Core Team <core@magentocommerce.com> - */ - namespace Magento\Shipping\Controller; use Magento\App\Action\NotFoundException; +/** + * Sales orders controller + */ class Tracking extends \Magento\App\Action\Action { /** @@ -58,49 +50,21 @@ class Tracking extends \Magento\App\Action\Action /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Shipping\Model\InfoFactory $shippingInfoFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory */ public function __construct( \Magento\App\Action\Context $context, \Magento\Core\Model\Registry $coreRegistry, - \Magento\Customer\Model\Session $customerSession, \Magento\Shipping\Model\InfoFactory $shippingInfoFactory, \Magento\Sales\Model\OrderFactory $orderFactory ) { $this->_coreRegistry = $coreRegistry; - $this->_customerSession = $customerSession; $this->_shippingInfoFactory = $shippingInfoFactory; $this->_orderFactory = $orderFactory; parent::__construct($context); } - /** - * Ajax action - * - */ - public function ajaxAction() - { - $order = $this->_initOrder(); - if ($order) { - $response = ''; - $tracks = $order->getTracksCollection(); - - $block = $this->_objectManager->create('Magento\View\Element\Template'); - $block->setType('Magento\View\Element\Template') - ->setTemplate('order/trackinginfo.phtml'); - - foreach ($tracks as $track) { - $trackingInfo = $track->getNumberDetail(); - $block->setTrackingInfo($trackingInfo); - $response .= $block->toHtml()."\n<br />"; - } - - $this->getResponse()->setBody($response); - } - } - /** * Popup action * Shows tracking info if it's present, otherwise redirects to 404 @@ -117,24 +81,4 @@ class Tracking extends \Magento\App\Action\Action $this->_view->loadLayout(); $this->_view->renderLayout(); } - - - /** - * Initialize order model instance - * - * @return \Magento\Sales\Model\Order || false - */ - protected function _initOrder() - { - $id = $this->getRequest()->getParam('order_id'); - - $order = $this->_orderFactory->create()->load($id); - $customerId = $this->_customerSession->getCustomerId(); - - if (!$order->getId() || !$customerId || $order->getCustomerId() != $customerId) { - return false; - } - return $order; - } - } diff --git a/app/code/Magento/Shipping/Helper/Data.php b/app/code/Magento/Shipping/Helper/Data.php index bb1d1de7f5c..58833fa5287 100644 --- a/app/code/Magento/Shipping/Helper/Data.php +++ b/app/code/Magento/Shipping/Helper/Data.php @@ -124,29 +124,4 @@ class Data extends \Magento\App\Helper\AbstractHelper } return ''; } - - /** - * Retrieve tracking ajax url - * - * @return string - */ - public function getTrackingAjaxUrl() - { - return $this->_getUrl('shipping/tracking/ajax'); - } - - /** - * @param string $method - * @param mixed $storeId - * @return bool - */ - public function isFreeMethod($method, $storeId = null) - { - $arr = explode('_', $method, 2); - if (!isset($arr[1])) { - return false; - } - $freeMethod = $this->_coreStoreConfig->getConfig('carriers/' . $arr[0] . '/free_method', $storeId); - return $freeMethod == $arr[1]; - } } diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php index 1b8ee38f32d..cc19e0b10d0 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php @@ -18,16 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Shipping * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - - namespace Magento\Shipping\Model\Carrier; -abstract class AbstractCarrier extends \Magento\Object +use Magento\Object; +use Magento\Sales\Model\Quote\Address\AbstractCarrierInterface; + +abstract class AbstractCarrier extends Object implements AbstractCarrierInterface { /** * Carrier's code @@ -96,24 +95,24 @@ abstract class AbstractCarrier extends \Magento\Object protected $_coreStoreConfig; /** - * @var \Magento\Shipping\Model\Rate\Result\ErrorFactory + * @var \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory */ protected $_rateErrorFactory; /** - * @var \Magento\Shipping\Model\Rate\Result\ErrorFactory + * @var \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory */ protected $_logAdapterFactory; /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param array $data */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, array $data = array() ) { @@ -157,21 +156,21 @@ abstract class AbstractCarrier extends \Magento\Object * Collect and get rates * * @abstract - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Shipping\Model\Rate\Result|bool|null */ - abstract public function collectRates(\Magento\Shipping\Model\Rate\Request $request); + abstract public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request); /** * Do request to shipment * Implementation must be in overridden method * * @param \Magento\Shipping\Model\Shipment\Request $request - * @return \Magento\Object + * @return Object */ - public function requestToShipment(\Magento\Shipping\Model\Shipment\Request $request) + public function requestToShipment($request) { - return new \Magento\Object(); + return new Object(); } /** @@ -179,20 +178,20 @@ abstract class AbstractCarrier extends \Magento\Object * Implementation must be in overridden method * * @param $request - * @return \Magento\Object + * @return Object */ public function returnOfShipment($request) { - return new \Magento\Object(); + return new Object(); } /** * Return container types of carrier * - * @param \Magento\Object|null $params + * @param Object|null $params * @return array */ - public function getContainerTypes(\Magento\Object $params = null) + public function getContainerTypes(Object $params = null) { return array(); } @@ -200,10 +199,10 @@ abstract class AbstractCarrier extends \Magento\Object /** * Get allowed containers of carrier * - * @param \Magento\Object|null $params + * @param Object|null $params * @return array|bool */ - protected function _getAllowedContainers(\Magento\Object $params = null) + protected function _getAllowedContainers(Object $params = null) { $containersAll = $this->getContainerTypesAll(); if (empty($containersAll)) { @@ -263,19 +262,19 @@ abstract class AbstractCarrier extends \Magento\Object /** * Return delivery confirmation types of carrier * - * @param \Magento\Object|null $params + * @param Object|null $params * @return array */ - public function getDeliveryConfirmationTypes(\Magento\Object $params = null) + public function getDeliveryConfirmationTypes(Object $params = null) { return array(); } /** - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return $this|bool|false|\Magento\Core\Model\AbstractModel */ - public function checkAvailableShipCountries(\Magento\Shipping\Model\Rate\Request $request) + public function checkAvailableShipCountries(\Magento\Sales\Model\Quote\Address\RateRequest $request) { $speCountriesAllow = $this->getConfigData('sallowspecific'); /* @@ -292,7 +291,7 @@ abstract class AbstractCarrier extends \Magento\Object } elseif ($showMethod && (!$availableCountries || ($availableCountries && !in_array($request->getDestCountryId(), $availableCountries))) ){ - /** @var \Magento\Shipping\Model\Rate\Result\Error $error */ + /** @var \Magento\Sales\Model\Quote\Address\RateResult\Error $error */ $error = $this->_rateErrorFactory->create(); $error->setCarrier($this->_code); $error->setCarrierTitle($this->getConfigData('title')); @@ -313,10 +312,10 @@ abstract class AbstractCarrier extends \Magento\Object /** * Processing additional validation to check is carrier applicable. * - * @param \Magento\Shipping\Model\Rate\Request $request - * @return \Magento\Shipping\Model\Carrier\AbstractCarrier|\Magento\Shipping\Model\Rate\Result\Error|boolean + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request + * @return \Magento\Shipping\Model\Carrier\AbstractCarrier|\Magento\Sales\Model\Quote\Address\RateResult\Error|boolean */ - public function proccessAdditionalValidation(\Magento\Shipping\Model\Rate\Request $request) + public function proccessAdditionalValidation(\Magento\Sales\Model\Quote\Address\RateRequest $request) { return $this; } @@ -373,7 +372,7 @@ abstract class AbstractCarrier extends \Magento\Object } /** - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return null */ protected function _updateFreeMethodQuote($request) @@ -406,12 +405,12 @@ abstract class AbstractCarrier extends \Magento\Object $result = $this->_getQuotes(); if ($result && ($rates = $result->getAllRates()) && count($rates)>0) { - if ((count($rates) == 1) && ($rates[0] instanceof \Magento\Shipping\Model\Rate\Result\Method)) { + if ((count($rates) == 1) && ($rates[0] instanceof \Magento\Sales\Model\Quote\Address\RateResult\Method)) { $price = $rates[0]->getPrice(); } if (count($rates) > 1) { foreach ($rates as $rate) { - if ($rate instanceof \Magento\Shipping\Model\Rate\Result\Method + if ($rate instanceof \Magento\Sales\Model\Quote\Address\RateResult\Method && $rate->getMethod() == $freeMethod ) { $price = $rate->getPrice(); @@ -617,10 +616,10 @@ abstract class AbstractCarrier extends \Magento\Object /** * Return content types of package * - * @param \Magento\Object $params + * @param Object $params * @return array */ - public function getContentTypes(\Magento\Object $params) + public function getContentTypes(Object $params) { return array(); } diff --git a/app/code/Magento/Shipping/Model/Carrier/Flatrate.php b/app/code/Magento/Shipping/Model/Carrier/Flatrate.php index 13443382716..7f547ee65df 100644 --- a/app/code/Magento/Shipping/Model/Carrier/Flatrate.php +++ b/app/code/Magento/Shipping/Model/Carrier/Flatrate.php @@ -54,24 +54,24 @@ class Flatrate protected $_rateResultFactory; /** - * @var \Magento\Shipping\Model\Rate\Result\MethodFactory + * @var \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory */ protected $_rateMethodFactory; /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory * @param array $data */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, array $data = array() ) { $this->_rateResultFactory = $rateResultFactory; @@ -80,10 +80,10 @@ class Flatrate } /** - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Shipping\Model\Rate\Result */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { if (!$this->getConfigFlag('active')) { return false; @@ -123,7 +123,7 @@ class Flatrate $shippingPrice = $this->getFinalPriceWithHandlingFee($shippingPrice); if ($shippingPrice !== false) { - /** @var \Magento\Shipping\Model\Rate\Result\Method $method */ + /** @var \Magento\Sales\Model\Quote\Address\RateResult\Method $method */ $method = $this->_rateMethodFactory->create(); $method->setCarrier('flatrate'); diff --git a/app/code/Magento/Shipping/Model/Carrier/Freeshipping.php b/app/code/Magento/Shipping/Model/Carrier/Freeshipping.php index 7c922edd935..f1efd09042d 100644 --- a/app/code/Magento/Shipping/Model/Carrier/Freeshipping.php +++ b/app/code/Magento/Shipping/Model/Carrier/Freeshipping.php @@ -55,24 +55,24 @@ class Freeshipping protected $_rateResultFactory; /** - * @var \Magento\Shipping\Model\Rate\Result\MethodFactory + * @var \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory */ protected $_rateMethodFactory; /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory * @param array $data */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, array $data = array() ) { $this->_rateResultFactory = $rateResultFactory; @@ -83,10 +83,10 @@ class Freeshipping /** * FreeShipping Rates Collector * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Shipping\Model\Rate\Result */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { if (!$this->getConfigFlag('active')) { return false; @@ -100,7 +100,7 @@ class Freeshipping if (($request->getFreeShipping()) || ($request->getBaseSubtotalInclTax() >= $this->getConfigData('free_shipping_subtotal')) ) { - /** @var \Magento\Shipping\Model\Rate\Result\Method $method */ + /** @var \Magento\Sales\Model\Quote\Address\RateResult\Method $method */ $method = $this->_rateMethodFactory->create(); $method->setCarrier('freeshipping'); @@ -121,7 +121,7 @@ class Freeshipping /** * Allows free shipping when all product items have free shipping (promotions etc.) * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return void */ protected function _updateFreeMethodQuote($request) diff --git a/app/code/Magento/Shipping/Model/Carrier/Pickup.php b/app/code/Magento/Shipping/Model/Carrier/Pickup.php index 3f8a9dee0b5..167b01edc50 100644 --- a/app/code/Magento/Shipping/Model/Carrier/Pickup.php +++ b/app/code/Magento/Shipping/Model/Carrier/Pickup.php @@ -48,24 +48,24 @@ class Pickup protected $_rateResultFactory; /** - * @var \Magento\Shipping\Model\Rate\Result\MethodFactory + * @var \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory */ protected $_rateMethodFactory; /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory * @param array $data */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, array $data = array() ) { $this->_rateResultFactory = $rateResultFactory; @@ -74,10 +74,10 @@ class Pickup } /** - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Shipping\Model\Rate\Result */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { if (!$this->getConfigFlag('active')) { return false; @@ -87,7 +87,7 @@ class Pickup $result = $this->_rateResultFactory->create(); if (!empty($rate)) { - /** @var \Magento\Shipping\Model\Rate\Result\Method $method */ + /** @var \Magento\Sales\Model\Quote\Address\RateResult\Method $method */ $method = $this->_rateMethodFactory->create(); $method->setCarrier('pickup'); diff --git a/app/code/Magento/Shipping/Model/Carrier/Tablerate.php b/app/code/Magento/Shipping/Model/Carrier/Tablerate.php index f9661d04999..c9f9463d034 100644 --- a/app/code/Magento/Shipping/Model/Carrier/Tablerate.php +++ b/app/code/Magento/Shipping/Model/Carrier/Tablerate.php @@ -58,7 +58,7 @@ class Tablerate protected $_rateResultFactory; /** - * @var \Magento\Shipping\Model\Rate\Result\MethodFactory + * @var \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory */ protected $_resultMethodFactory; @@ -70,18 +70,18 @@ class Tablerate /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $resultMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $resultMethodFactory * @param \Magento\Shipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory * @param array $data */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $resultMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $resultMethodFactory, \Magento\Shipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory, array $data = array() ) { @@ -95,10 +95,10 @@ class Tablerate } /** - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Shipping\Model\Rate\Result */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { if (!$this->getConfigFlag('active')) { return false; @@ -168,7 +168,7 @@ class Tablerate $request->setPackageQty($oldQty); if (!empty($rate) && $rate['price'] >= 0) { - /** @var \Magento\Shipping\Model\Rate\Result\Method $method */ + /** @var \Magento\Sales\Model\Quote\Address\RateResult\Method $method */ $method = $this->_resultMethodFactory->create(); $method->setCarrier('tablerate'); @@ -188,7 +188,7 @@ class Tablerate $result->append($method); } else { - /** @var \Magento\Shipping\Model\Rate\Result\Error $error */ + /** @var \Magento\Sales\Model\Quote\Address\RateResult\Error $error */ $error = $this->_rateErrorFactory->create(array('data' => array( 'carrier' => $this->_code, 'carrier_title' => $this->getConfigData('title'), @@ -201,10 +201,10 @@ class Tablerate } /** - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return array|bool */ - public function getRate(\Magento\Shipping\Model\Rate\Request $request) + public function getRate(\Magento\Sales\Model\Quote\Address\RateRequest $request) { return $this->_tablerateFactory->create()->getRate($request); } diff --git a/app/code/Magento/Shipping/Model/Carrier/Factory.php b/app/code/Magento/Shipping/Model/CarrierFactory.php similarity index 57% rename from app/code/Magento/Shipping/Model/Carrier/Factory.php rename to app/code/Magento/Shipping/Model/CarrierFactory.php index 8a9dc52cfe9..255594d4e50 100644 --- a/app/code/Magento/Shipping/Model/Carrier/Factory.php +++ b/app/code/Magento/Shipping/Model/CarrierFactory.php @@ -18,15 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Shipping * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Shipping\Model; -namespace Magento\Shipping\Model\Carrier; +use Magento\Sales\Model\Quote\Address\CarrierFactoryInterface; -class Factory +class CarrierFactory implements CarrierFactoryInterface { /** * Core store config @@ -35,11 +34,6 @@ class Factory */ protected $_coreStoreConfig; - /** - * @var \Magento\Logger - */ - protected $_logger; - /** * @var \Magento\ObjectManager */ @@ -47,46 +41,78 @@ class Factory /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Logger $logger * @param \Magento\ObjectManager $objectManager */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Logger $logger, \Magento\ObjectManager $objectManager ) { $this->_coreStoreConfig = $coreStoreConfig; - $this->_logger = $logger; $this->_objectManager = $objectManager; } /** + * Get carrier instance + * * @param string $carrierCode - * @param int|null $storeId - * @return bool|\Magento\Shipping\Model\Carrier\AbstractCarrier + * @return bool|Carrier\AbstractCarrier */ - public function create($carrierCode, $storeId = null) + public function get($carrierCode) { - $className = $this->_coreStoreConfig->getConfig('carriers/' . $carrierCode . '/model', $storeId); + $className = $this->_coreStoreConfig->getConfig('carriers/' . $carrierCode . '/model'); if (!$className) { return false; } + $carrier = $this->_objectManager->get($className); + $carrier->setId($carrierCode); + return $carrier; + } - /** - * Added protection from not existing models usage. - * Related with module uninstall process - */ - try { - $carrier = $this->_objectManager->create($className); - } catch (\Exception $e) { - $this->_logger->logException($e); + /** + * Create carrier instance + * + * @param string $carrierCode + * @param int|null $storeId + * @return bool|Carrier\AbstractCarrier + */ + public function create($carrierCode, $storeId = null) + { + $className = $this->_coreStoreConfig->getConfig('carriers/' . $carrierCode . '/model', $storeId); + if (!$className) { return false; } - + $carrier = $this->_objectManager->create($className); $carrier->setId($carrierCode); if ($storeId) { $carrier->setStore($storeId); } return $carrier; } + + /** + * Get carrier by its code if it is active + * + * @param string $carrierCode + * @return bool|Carrier\AbstractCarrier + */ + public function getIfActive($carrierCode) + { + return $this->_coreStoreConfig->getConfigFlag('carriers/' . $carrierCode . '/active') + ? $this->get($carrierCode) + : false; + } + + /** + * Create carrier by its code if it is active + * + * @param $carrierCode + * @param null|int $storeId + * @return bool|Carrier\AbstractCarrier + */ + public function createIfActive($carrierCode, $storeId = null) + { + return $this->_coreStoreConfig->getConfigFlag('carriers/' . $carrierCode . '/active') + ? $this->create($carrierCode, $storeId) + : false; + } } diff --git a/app/code/Magento/Shipping/Model/Config.php b/app/code/Magento/Shipping/Model/Config.php index 9023a6988bf..007b7339e6b 100644 --- a/app/code/Magento/Shipping/Model/Config.php +++ b/app/code/Magento/Shipping/Model/Config.php @@ -37,8 +37,6 @@ class Config extends \Magento\Object const XML_PATH_ORIGIN_CITY = 'shipping/origin/city'; const XML_PATH_ORIGIN_POSTCODE = 'shipping/origin/postcode'; - protected static $_carriers; - /** * Core store config * @@ -47,7 +45,7 @@ class Config extends \Magento\Object protected $_coreStoreConfig; /** - * @var \Magento\Shipping\Model\Carrier\Factory + * @var \Magento\Shipping\Model\CarrierFactory */ protected $_carrierFactory; @@ -55,12 +53,12 @@ class Config extends \Magento\Object * Constructor * * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Carrier\Factory $carrierFactory + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param array $data */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Carrier\Factory $carrierFactory, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, array $data = array() ) { $this->_coreStoreConfig = $coreStoreConfig; @@ -80,7 +78,7 @@ class Config extends \Magento\Object $config = $this->_coreStoreConfig->getConfig('carriers', $store); foreach (array_keys($config) as $carrierCode) { if ($this->_coreStoreConfig->getConfigFlag('carriers/' . $carrierCode . '/active', $store)) { - $carrierModel = $this->_getCarrier($carrierCode, $store); + $carrierModel = $this->_carrierFactory->create($carrierCode, $store); if ($carrierModel) { $carriers[$carrierCode] = $carrierModel; } @@ -100,37 +98,11 @@ class Config extends \Magento\Object $carriers = array(); $config = $this->_coreStoreConfig->getConfig('carriers', $store); foreach (array_keys($config) as $carrierCode) { - $model = $this->_getCarrier($carrierCode, $store); + $model = $this->_carrierFactory->create($carrierCode, $store); if ($model) { $carriers[$carrierCode] = $model; } } return $carriers; } - - /** - * Retrieve carrier model instance by carrier code - * - * @param string $carrierCode - * @param mixed $store - * @return \Magento\Usa\Model\Shipping\Carrier\AbstractCarrier - */ - public function getCarrierInstance($carrierCode, $store = null) - { - return $this->_getCarrier($carrierCode, $store); - } - - /** - * Get carrier model object - * - * @param $carrierCode - * @param mixed $store - * @return \Magento\Shipping\Model\Carrier\AbstractCarrier - */ - protected function _getCarrier($carrierCode, $store = null) - { - $carrier = $this->_carrierFactory->create($carrierCode, $store); - self::$_carriers[$carrierCode] = $carrier; - return self::$_carriers[$carrierCode]; - } } diff --git a/app/code/Magento/Shipping/Model/Info.php b/app/code/Magento/Shipping/Model/Info.php index f54f13b62aa..4ddf213fc77 100644 --- a/app/code/Magento/Shipping/Model/Info.php +++ b/app/code/Magento/Shipping/Model/Info.php @@ -54,28 +54,36 @@ class Info extends \Magento\Object protected $_shipmentFactory; /** - * @var \Magento\Sales\Model\Order\Shipment\TrackFactory + * @var \Magento\Shipping\Model\Order\TrackFactory */ protected $_trackFactory; + /** + * @var \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory + */ + protected $_trackCollectionFactory; + /** * @param \Magento\Shipping\Helper\Data $shippingData * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory - * @param \Magento\Sales\Model\Order\Shipment\TrackFactory $trackFactory + * @param \Magento\Shipping\Model\Order\TrackFactory $trackFactory + * @param \Magento\Shipping\Model\Resource\Order\Track\CollectionFactory $trackCollectionFactory * @param array $data */ public function __construct( \Magento\Shipping\Helper\Data $shippingData, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, - \Magento\Sales\Model\Order\Shipment\TrackFactory $trackFactory, + \Magento\Shipping\Model\Order\TrackFactory $trackFactory, + \Magento\Shipping\Model\Resource\Order\Track\CollectionFactory $trackCollectionFactory, array $data = array() ) { $this->_shippingData = $shippingData; $this->_orderFactory = $orderFactory; $this->_shipmentFactory = $shipmentFactory; $this->_trackFactory = $trackFactory; + $this->_trackCollectionFactory = $trackCollectionFactory; parent::__construct($data); } @@ -162,7 +170,7 @@ class Info extends \Magento\Object $shipments = $order->getShipmentsCollection(); foreach ($shipments as $shipment){ $increment_id = $shipment->getIncrementId(); - $tracks = $shipment->getTracksCollection(); + $tracks = $this->_getTracksCollection($shipment); $trackingInfos=array(); foreach ($tracks as $track){ @@ -186,7 +194,7 @@ class Info extends \Magento\Object $shipment = $this->_initShipment(); if ($shipment) { $increment_id = $shipment->getIncrementId(); - $tracks = $shipment->getTracksCollection(); + $tracks = $this->_getTracksCollection($shipment); $trackingInfos=array(); foreach ($tracks as $track){ @@ -206,11 +214,27 @@ class Info extends \Magento\Object */ public function getTrackingInfoByTrackId() { - /** @var \Magento\Sales\Model\Order\Shipment\Track $track */ + /** @var \Magento\Shipping\Model\Order\Track $track */ $track = $this->_trackFactory->create()->load($this->getTrackId()); if ($track->getId() && $this->getProtectCode() == $track->getProtectCode()) { $this->_trackingInfo = array(array($track->getNumberDetail())); } return $this->_trackingInfo; } + + /** + * @param $shipment \Magento\Sales\Model\Order\Shipment + * @return \Magento\Shipping\Model\Resource\Order\Track\Collection + */ + protected function _getTracksCollection(\Magento\Sales\Model\Order\Shipment $shipment) + { + $tracks = $this->_trackCollectionFactory->create()->setShipmentFilter($shipment->getId()); + + if ($shipment->getId()) { + foreach ($tracks as $track) { + $track->setShipment($shipment); + } + } + return $tracks; + } } diff --git a/app/code/Magento/Shipping/Model/Observer.php b/app/code/Magento/Shipping/Model/Observer.php new file mode 100644 index 00000000000..2e17e7a0c94 --- /dev/null +++ b/app/code/Magento/Shipping/Model/Observer.php @@ -0,0 +1,61 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Shipping\Model; + +class Observer +{ + /** + * @var \Magento\Core\Model\LocaleInterface + */ + protected $_coreLocale; + + /** + * @var \Magento\Sales\Model\Resource\Report\ShippingFactory + */ + protected $_shippingFactory; + + public function __construct( + \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Sales\Model\Resource\Report\ShippingFactory $shippingFactory + ) { + $this->_coreLocale = $coreLocale; + $this->_shippingFactory = $shippingFactory; + } + + /** + * Refresh sales shipment report statistics for last day + * + * @return $this + */ + public function aggregateSalesReportShipmentData() + { + $this->_coreLocale->emulate(0); + $currentDate = $this->_coreLocale->date(); + $date = $currentDate->subHour(25); + $this->_shippingFactory->create()->aggregate($date); + $this->_coreLocale->revert(); + return $this; + } +} diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php similarity index 90% rename from app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php rename to app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php index a46e877bc2c..15ccc014ca0 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment/Packaging.php +++ b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php @@ -18,16 +18,11 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Sales * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Sales Order Shipment PDF model - */ -namespace Magento\Sales\Model\Order\Pdf\Shipment; +namespace Magento\Shipping\Model\Order\Pdf; class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf { @@ -53,8 +48,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\Translate $translate - * @param \Magento\Filesystem $filesystem - * @param \Magento\Shipping\Model\Config $shippingConfig + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory @@ -71,8 +65,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Translate $translate, - \Magento\Filesystem $filesystem, - \Magento\Shipping\Model\Config $shippingConfig, + \Magento\App\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, @@ -92,7 +85,6 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $coreStoreConfig, $translate, $filesystem, - $shippingConfig, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, @@ -139,9 +131,10 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * Draw header block * * @param \Zend_Pdf_Page $page - * @return \Magento\Sales\Model\Order\Pdf\Shipment\Packaging + * @return \Magento\Shipping\Model\Order\Pdf\Packaging */ - protected function _drawHeaderBlock(\Zend_Pdf_Page $page) { + protected function _drawHeaderBlock(\Zend_Pdf_Page $page) + { $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0.5)); $page->setLineColor(new \Zend_Pdf_Color_GrayScale(0.5)); $page->setLineWidth(0.5); @@ -157,14 +150,14 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * Draw packages block * * @param \Zend_Pdf_Page $page - * @return \Magento\Sales\Model\Order\Pdf\Shipment\Packaging + * @return \Magento\Shipping\Model\Order\Pdf\Packaging */ protected function _drawPackageBlock(\Zend_Pdf_Page $page) { if ($this->getPackageShippingBlock()) { $packaging = $this->getPackageShippingBlock(); } else { - $packaging = $this->_layout->getBlockSingleton('Magento\Sales\Block\Adminhtml\Order\Shipment\Packaging'); + $packaging = $this->_layout->getBlockSingleton('Magento\Shipping\Block\Adminhtml\Order\Packaging'); } $packages = $packaging->getPackages(); @@ -180,7 +173,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $page->setFillColor(new \Zend_Pdf_Color_GrayScale(0)); $packageText = __('Package') . ' ' . $packageNum; - $page->drawText($packageText, 525, $this->y , 'UTF-8'); + $page->drawText($packageText, 525, $this->y, 'UTF-8'); $packageNum++; $package = new \Magento\Object($package); @@ -189,7 +182,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $typeText = __('Type') . ' : ' . $packaging->getContainerTypeByCode($params->getContainer()); - $page->drawText($typeText, 35, $this->y , 'UTF-8'); + $page->drawText($typeText, 35, $this->y, 'UTF-8'); if ($params->getLength() != null) { $lengthText = $params->getLength() .' '. $dimensionUnits; @@ -197,13 +190,13 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $lengthText = '--'; } $lengthText = __('Length') . ' : ' . $lengthText; - $page->drawText($lengthText, 200, $this->y , 'UTF-8'); + $page->drawText($lengthText, 200, $this->y, 'UTF-8'); if ($params->getDeliveryConfirmation() != null) { $confirmationText = __('Signature Confirmation') . ' : ' . $packaging->getDeliveryConfirmationTypeByCode($params->getDeliveryConfirmation()); - $page->drawText($confirmationText, 355, $this->y , 'UTF-8'); + $page->drawText($confirmationText, 355, $this->y, 'UTF-8'); } $this->y = $this->y - 10; @@ -212,7 +205,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $customsValueText = __('Customs Value') . ' : ' . $packaging->displayPrice($params->getCustomsValue()); - $page->drawText($customsValueText, 35, $this->y , 'UTF-8'); + $page->drawText($customsValueText, 35, $this->y, 'UTF-8'); } if ($params->getWidth() != null) { $widthText = $params->getWidth() .' '. $dimensionUnits; @@ -220,7 +213,7 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $widthText = '--'; } $widthText = __('Width') . ' : ' . $widthText; - $page->drawText($widthText, 200, $this->y , 'UTF-8'); + $page->drawText($widthText, 200, $this->y, 'UTF-8'); if ($params->getContentType() != null) { if ($params->getContentType() == 'OTHER') { @@ -229,14 +222,14 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $contentsValue = $packaging->getContentTypeByCode($params->getContentType()); } $contentsText = __('Contents') . ' : ' . $contentsValue; - $page->drawText($contentsText, 355, $this->y , 'UTF-8'); + $page->drawText($contentsText, 355, $this->y, 'UTF-8'); } $this->y = $this->y - 10; $weightText = __('Total Weight') . ' : ' . $params->getWeight() .' ' . $this->_usaData->getMeasureWeightName($params->getWeightUnits()); - $page->drawText($weightText, 35, $this->y , 'UTF-8'); + $page->drawText($weightText, 35, $this->y, 'UTF-8'); if ($params->getHeight() != null) { $heightText = $params->getHeight() .' '. $dimensionUnits; @@ -244,19 +237,19 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $heightText = '--'; } $heightText = __('Height') . ' : ' . $heightText; - $page->drawText($heightText, 200, $this->y , 'UTF-8'); + $page->drawText($heightText, 200, $this->y, 'UTF-8'); $this->y = $this->y - 10; if ($params->getSize()) { $sizeText = __('Size') . ' : ' . ucfirst(strtolower($params->getSize())); - $page->drawText($sizeText, 35, $this->y , 'UTF-8'); + $page->drawText($sizeText, 35, $this->y, 'UTF-8'); } if ($params->getGirth() != null) { $dimensionGirthUnits = $this->_usaData->getMeasureDimensionName($params->getGirthDimensionUnits()); $girthText = __('Girth') . ' : ' . $params->getGirth() . ' ' . $dimensionGirthUnits; - $page->drawText($girthText, 200, $this->y , 'UTF-8'); + $page->drawText($girthText, 200, $this->y, 'UTF-8'); } $this->y = $this->y - 5; diff --git a/app/code/Magento/Shipping/Model/Order/Track.php b/app/code/Magento/Shipping/Model/Order/Track.php new file mode 100644 index 00000000000..414d8020286 --- /dev/null +++ b/app/code/Magento/Shipping/Model/Order/Track.php @@ -0,0 +1,121 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/** + * @method \Magento\Sales\Model\Resource\Order\Shipment\Track _getResource() + * @method \Magento\Sales\Model\Resource\Order\Shipment\Track getResource() + * @method int getParentId() + * @method \Magento\Sales\Model\Order\Shipment\Track setParentId(int $value) + * @method float getWeight() + * @method \Magento\Sales\Model\Order\Shipment\Track setWeight(float $value) + * @method float getQty() + * @method \Magento\Sales\Model\Order\Shipment\Track setQty(float $value) + * @method int getOrderId() + * @method \Magento\Sales\Model\Order\Shipment\Track setOrderId(int $value) + * @method string getDescription() + * @method \Magento\Sales\Model\Order\Shipment\Track setDescription(string $value) + * @method string getTitle() + * @method \Magento\Sales\Model\Order\Shipment\Track setTitle(string $value) + * @method string getCarrierCode() + * @method \Magento\Sales\Model\Order\Shipment\Track setCarrierCode(string $value) + * @method string getCreatedAt() + * @method \Magento\Sales\Model\Order\Shipment\Track setCreatedAt(string $value) + * @method string getUpdatedAt() + * @method \Magento\Sales\Model\Order\Shipment\Track setUpdatedAt(string $value) + * + */ +namespace Magento\Shipping\Model\Order; + +class Track extends \Magento\Sales\Model\Order\Shipment\Track +{ + /** + * @var \Magento\Shipping\Model\CarrierFactory + */ + protected $_carrierFactory; + + /** + * @param \Magento\Core\Model\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Core\Model\LocaleInterface $coreLocale + * @param \Magento\Stdlib\DateTime $dateTime + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory + * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Data\Collection\Db $resourceCollection + * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ + public function __construct( + \Magento\Core\Model\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Core\Model\LocaleInterface $coreLocale, + \Magento\Stdlib\DateTime $dateTime, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, + \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Data\Collection\Db $resourceCollection = null, + array $data = array() + ) { + parent::__construct( + $context, + $registry, + $coreLocale, + $dateTime, + $storeManager, + $shipmentFactory, + $resource, + $resourceCollection, + $data + ); + $this->_carrierFactory = $carrierFactory; + } + + /** + * Retrieve detail for shipment track + * + * @return string + */ + public function getNumberDetail() + { + $carrierInstance = $this->_carrierFactory->create($this->getCarrierCode()); + if (!$carrierInstance) { + $custom = array(); + $custom['title'] = $this->getTitle(); + $custom['number'] = $this->getTrackNumber(); + return $custom; + } else { + $carrierInstance->setStore($this->getStore()); + } + + $trackingInfo = $carrierInstance->getTrackingInfo($this->getNumber()); + if (!$trackingInfo) { + return __('No detail for number "%1"', $this->getNumber()); + } + + return $trackingInfo; + } +} diff --git a/app/code/Magento/Shipping/Model/Rate/AbstractRate.php b/app/code/Magento/Shipping/Model/Rate/AbstractRate.php deleted file mode 100644 index 585175ff8ca..00000000000 --- a/app/code/Magento/Shipping/Model/Rate/AbstractRate.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Shipping - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -namespace Magento\Shipping\Model\Rate; - -abstract class AbstractRate extends \Magento\Core\Model\AbstractModel -{ - /** - * @var array - */ - static protected $_instances; - - /** - * @var \Magento\Shipping\Model\Config - */ - protected $_shippingConfig; - - /** - * @param \Magento\Core\Model\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Shipping\Model\Config $shippingConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Core\Model\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Shipping\Model\Config $shippingConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, - \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - $this->_shippingConfig = $shippingConfig; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); - } - - public function getCarrierInstance() - { - $code = $this->getCarrier(); - if (!isset(self::$_instances[$code])) { - self::$_instances[$code] = $this->_shippingConfig->getCarrierInstance($code); - } - return self::$_instances[$code]; - } -} diff --git a/app/code/Magento/Shipping/Model/Rate/Request.php b/app/code/Magento/Shipping/Model/Rate/Request.php deleted file mode 100644 index 8f74ba43c7f..00000000000 --- a/app/code/Magento/Shipping/Model/Rate/Request.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Shipping - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Fields: - * - orig: - * - country_id: UK - * - region_id: 1 - * - postcode: 90034 - * - dest: - * - country_id: UK - * - region_id: 2 - * - postcode: 01005 - * - package: - * - value: $100 - * - weight: 1.5 lb - * - height: 10" - * - width: 10" - * - depth: 10" - * - order: - * - total_qty: 10 - * - subtotal: $100 - * - option - * - insurance: true - * - handling: $1 - * - table (shiptable) - * - condition_name: package_weight - * - limit - * - carrier: ups - * - method: 3dp - * - ups - * - pickup: CC - * - container: CP - * - address: RES - * - * @method int getStoreId() - * @method \Magento\Shipping\Model\Rate\Request setStoreId(int $value) - * @method int getWebsiteId() - * @method \Magento\Shipping\Model\Rate\Request setWebsiteId(int $value) - * @method string getBaseCurrency() - * @method \Magento\Shipping\Model\Rate\Request setBaseCurrency(string $value) - * - * @method \Magento\Shipping\Model\Rate\Request setAllItems(array $items) - * @method array getAllItems() - * - * @method \Magento\Shipping\Model\Rate\Request setOrigCountryId(string $value) - * @method string getOrigCountryId() - * @method \Magento\Shipping\Model\Rate\Request setOrigRegionId(int $value) - * @method int getOrigRegionId() - * @method \Magento\Shipping\Model\Rate\Request setOrigPostcode(string $value) - * @method string getOrigPostcode() - * @method \Magento\Shipping\Model\Rate\Request setOrigCity(string $value) - * @method string getOrigCity() - * - * @method \Magento\Shipping\Model\Rate\Request setDestCountryId(string $value) - * @method string getDestCountryId() - * @method \Magento\Shipping\Model\Rate\Request setDestRegionId(int $value) - * @method int getDestRegionId() - * @method \Magento\Shipping\Model\Rate\Request setDestRegionCode(string $value) - * @method string getDestRegionCode() - * @method \Magento\Shipping\Model\Rate\Request setDestPostcode(string $value) - * @method string getDestPostcode() - * @method \Magento\Shipping\Model\Rate\Request setDestCity(string $value) - * @method string getDestCity() - * @method \Magento\Shipping\Model\Rate\Request setDestStreet(string $value) - * @method string getDestStreet() - * - * @method \Magento\Shipping\Model\Rate\Request setPackageValue(float $value) - * @method float getPackageValue() - * @method \Magento\Shipping\Model\Rate\Request setPackageValueWithDiscount(float $value) - * @method float getPackageValueWithDiscount() - * @method \Magento\Shipping\Model\Rate\Request setPackagePhysicalValue(float $value) - * @method float getPackagePhysicalValue() - * @method \Magento\Shipping\Model\Rate\Request setPackageQty(float $value) - * @method float getPackageQty() - * @method \Magento\Shipping\Model\Rate\Request setPackageWeight(float $value) - * @method float getPackageWeight() - * @method \Magento\Shipping\Model\Rate\Request setPackageHeight(int $value) - * @method int getPackageHeight() - * @method \Magento\Shipping\Model\Rate\Request setPackageWidth(int $value) - * @method int getPackageWidth() - * @method \Magento\Shipping\Model\Rate\Request setPackageDepth(int $value) - * @method int getPackageDepth() - * @method \Magento\Shipping\Model\Rate\Request setPackageCurrency(string $value) - * @method string getPackageCurrency() - * - * @method \Magento\Shipping\Model\Rate\Request setOrderTotalQty(float $value) - * @method float getOrderTotalQty() - * @method \Magento\Shipping\Model\Rate\Request setOrderSubtotal(float $value) - * @method float getOrderSubtotal() - * - * @method boolean getFreeShipping() - * @method \Magento\Shipping\Model\Rate\Request setFreeShipping(boolean $flag) - * @method float getFreeMethodWeight() - * @method \Magento\Shipping\Model\Rate\Request setFreeMethodWeight(float $value) - * - * @method \Magento\Shipping\Model\Rate\Request setOptionInsurance(boolean $value) - * @method boolean getOptionInsurance() - * @method \Magento\Shipping\Model\Rate\Request setOptionHandling(float $flag) - * @method float getOptionHandling() - * - * @method \Magento\Shipping\Model\Rate\Request setConditionName(array $value) - * @method \Magento\Shipping\Model\Rate\Request setConditionName(string $value) - * @method string getConditionName() - * @method array getConditionName() - * - * @method \Magento\Shipping\Model\Rate\Request setLimitCarrier(string $value) - * @method string getLimitCarrier() - * @method \Magento\Shipping\Model\Rate\Request setLimitMethod(string $value) - * @method string getLimitMethod() - * - * @category Magento - * @package Magento_Shipping - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Shipping\Model\Rate; - -class Request extends \Magento\Object -{} diff --git a/app/code/Magento/Shipping/Model/Rate/Result.php b/app/code/Magento/Shipping/Model/Rate/Result.php index 12d8eabb760..cb38af05f69 100644 --- a/app/code/Magento/Shipping/Model/Rate/Result.php +++ b/app/code/Magento/Shipping/Model/Rate/Result.php @@ -92,15 +92,15 @@ class Result /** * Add a rate to the result * - * @param \Magento\Shipping\Model\Rate\Result\AbstractResult|\Magento\Shipping\Model\Rate\Result $result + * @param \Magento\Sales\Model\Quote\Address\RateResult\AbstractResult|\Magento\Shipping\Model\Rate\Result $result * @return \Magento\Shipping\Model\Rate\Result */ public function append($result) { - if ($result instanceof \Magento\Shipping\Model\Rate\Result\Error) { + if ($result instanceof \Magento\Sales\Model\Quote\Address\RateResult\Error) { $this->setError(true); } - if ($result instanceof \Magento\Shipping\Model\Rate\Result\AbstractResult) { + if ($result instanceof \Magento\Sales\Model\Quote\Address\RateResult\AbstractResult) { $this->_rates[] = $result; } elseif ($result instanceof \Magento\Shipping\Model\Rate\Result) { @@ -126,7 +126,7 @@ class Result * Return rate by id in array * * @param int $id - * @return \Magento\Shipping\Model\Rate\Result\Method|null + * @return \Magento\Sales\Model\Quote\Address\RateResult\Method|null */ public function getRateById($id) { @@ -174,7 +174,7 @@ class Result /** * Get cheapest rate * - * @return null|\Magento\Shipping\Model\Rate\Result\Method + * @return null|\Magento\Sales\Model\Quote\Address\RateResult\Method */ public function getCheapestRate() { @@ -199,7 +199,7 @@ class Result if (!is_array($this->_rates) || !count($this->_rates)) { return $this; } - /* @var $rate \Magento\Shipping\Model\Rate\Result\Method */ + /* @var $rate \Magento\Sales\Model\Quote\Address\RateResult\Method */ foreach ($this->_rates as $i => $rate) { $tmp[$i] = $rate->getPrice(); } diff --git a/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php b/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php index bc55f631cee..4d7365b57d3 100644 --- a/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php +++ b/app/code/Magento/Shipping/Model/Resource/Carrier/Tablerate.php @@ -122,17 +122,17 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb /** * @var \Magento\Directory\Model\Resource\Country\CollectionFactory */ - protected $_countryCollFactory; + protected $_countryCollectionFactory; /** * @var \Magento\Directory\Model\Resource\Region\CollectionFactory */ - protected $_regionCollFactory; + protected $_regionCollectionFactory; /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -142,9 +142,9 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Shipping\Model\Carrier\Tablerate $carrierTablerate - * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory - * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory + * @param \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\App\Resource $resource, @@ -152,17 +152,17 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb \Magento\Core\Model\Config $coreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Shipping\Model\Carrier\Tablerate $carrierTablerate, - \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollFactory, - \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollFactory, - \Magento\Filesystem $filesystem + \Magento\Directory\Model\Resource\Country\CollectionFactory $countryCollectionFactory, + \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, + \Magento\App\Filesystem $filesystem ) { parent::__construct($resource); $this->_coreConfig = $coreConfig; $this->_logger = $logger; $this->_storeManager = $storeManager; $this->_carrierTablerate = $carrierTablerate; - $this->_countryCollFactory = $countryCollFactory; - $this->_regionCollFactory = $regionCollFactory; + $this->_countryCollectionFactory = $countryCollectionFactory; + $this->_regionCollectionFactory = $regionCollectionFactory; $this->_filesystem = $filesystem; } @@ -179,10 +179,10 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Return table rate array or false by rate request * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return array|bool */ - public function getRate(\Magento\Shipping\Model\Rate\Request $request) + public function getRate(\Magento\Sales\Model\Quote\Address\RateRequest $request) { $adapter = $this->_getReadAdapter(); $bind = array( @@ -269,7 +269,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_importErrors = array(); $this->_importedRows = 0; - $tmpDirectory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::SYS_TMP); + $tmpDirectory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::SYS_TMP_DIR); $path = $tmpDirectory->getRelativePath($csvFile); $stream = $tmpDirectory->openFile($path); @@ -359,7 +359,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_importIso3Countries = array(); /** @var $collection \Magento\Directory\Model\Resource\Country\Collection */ - $collection = $this->_countryCollFactory->create(); + $collection = $this->_countryCollectionFactory->create(); foreach ($collection->getData() as $row) { $this->_importIso2Countries[$row['iso2_code']] = $row['country_id']; $this->_importIso3Countries[$row['iso3_code']] = $row['country_id']; @@ -382,7 +382,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_importRegions = array(); /** @var $collection \Magento\Directory\Model\Resource\Region\Collection */ - $collection = $this->_regionCollFactory->create(); + $collection = $this->_regionCollectionFactory->create(); foreach ($collection->getData() as $row) { $this->_importRegions[$row['country_id']][$row['code']] = (int)$row['region_id']; } diff --git a/app/code/Magento/PageCache/Model/Control/ControlInterface.php b/app/code/Magento/Shipping/Model/Resource/Order/Track/Collection.php similarity index 71% rename from app/code/Magento/PageCache/Model/Control/ControlInterface.php rename to app/code/Magento/Shipping/Model/Resource/Order/Track/Collection.php index f8cce94deed..4b8c8d8b312 100644 --- a/app/code/Magento/PageCache/Model/Control/ControlInterface.php +++ b/app/code/Magento/Shipping/Model/Resource/Order/Track/Collection.php @@ -18,27 +18,25 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_PageCache * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + /** - * Page cache control interface + * Flat sales order shipment tracks collection * - * @category Magento - * @package Magento_PageCache - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\PageCache\Model\Control; +namespace Magento\Shipping\Model\Resource\Order\Track; -interface ControlInterface +class Collection extends \Magento\Sales\Model\Resource\Order\Shipment\Track\Collection { /** - * Clean external cache + * Model initialization * - * @return void */ - public function clean(); + protected function _construct() + { + $this->_init('Magento\Shipping\Model\Order\Track', 'Magento\Sales\Model\Resource\Order\Shipment\Track'); + } } diff --git a/app/code/Magento/Shipping/Model/Shipping.php b/app/code/Magento/Shipping/Model/Shipping.php index 4e1c8f6c713..3de7b443bcb 100644 --- a/app/code/Magento/Shipping/Model/Shipping.php +++ b/app/code/Magento/Shipping/Model/Shipping.php @@ -27,18 +27,11 @@ namespace Magento\Shipping\Model; -class Shipping -{ - /** - * Store address - */ - const XML_PATH_STORE_ADDRESS1 = 'shipping/origin/street_line1'; - const XML_PATH_STORE_ADDRESS2 = 'shipping/origin/street_line2'; - const XML_PATH_STORE_CITY = 'shipping/origin/city'; - const XML_PATH_STORE_REGION_ID = 'shipping/origin/region_id'; - const XML_PATH_STORE_ZIP = 'shipping/origin/postcode'; - const XML_PATH_STORE_COUNTRY_ID = 'shipping/origin/country_id'; +use Magento\Sales\Model\Order\Shipment; +use Magento\Sales\Model\Quote\Address\RateCollectorInterface; +class Shipping implements RateCollectorInterface +{ /** * Default shipping orig for requests * @@ -78,7 +71,7 @@ class Shipping protected $_shippingConfig; /** - * @var \Magento\Shipping\Model\Carrier\Factory + * @var \Magento\Shipping\Model\CarrierFactory */ protected $_carrierFactory; @@ -88,7 +81,7 @@ class Shipping protected $_rateResultFactory; /** - * @var \Magento\Shipping\Model\Rate\RequestFactory + * @var \Magento\Sales\Model\Quote\Address\RateRequestFactory */ protected $_shipmentRequestFactory; @@ -106,7 +99,7 @@ class Shipping * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Shipping\Model\Carrier\Factory $carrierFactory + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory * @param \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory * @param \Magento\Directory\Model\RegionFactory $regionFactory @@ -116,7 +109,7 @@ class Shipping \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Shipping\Model\Carrier\Factory $carrierFactory, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory, \Magento\Directory\Model\RegionFactory $regionFactory, @@ -181,18 +174,26 @@ class Shipping * Retrieve all methods for supplied shipping data * * @todo make it ordered - * @param \Magento\Shipping\Model\Rate\Request $request - * @return \Magento\Shipping\Model\Shipping + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request + * @return $this */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { $storeId = $request->getStoreId(); if (!$request->getOrig()) { $request - ->setCountryId($this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_COUNTRY_ID, $request->getStore())) - ->setRegionId($this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_REGION_ID, $request->getStore())) - ->setCity($this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_CITY, $request->getStore())) - ->setPostcode($this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_ZIP, $request->getStore())); + ->setCountryId( + $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_COUNTRY_ID, $request->getStore()) + ) + ->setRegionId( + $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_REGION_ID, $request->getStore()) + ) + ->setCity( + $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_CITY, $request->getStore()) + ) + ->setPostcode( + $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_ZIP, $request->getStore()) + ); } $limitCarrier = $request->getLimitCarrier(); @@ -221,28 +222,28 @@ class Shipping /** * Collect rates of given carrier * - * @param string $carrierCode - * @param \Magento\Shipping\Model\Rate\Request $request + * @param string $carrierCode + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Shipping\Model\Shipping */ public function collectCarrierRates($carrierCode, $request) { /* @var $carrier \Magento\Shipping\Model\Carrier\AbstractCarrier */ - $carrier = $this->getCarrierByCode($carrierCode, $request->getStoreId()); + $carrier = $this->_carrierFactory->createIfActive($carrierCode, $request->getStoreId()); if (!$carrier) { return $this; } $carrier->setActiveFlag($this->_availabilityConfigField); $result = $carrier->checkAvailableShipCountries($request); - if (false !== $result && !($result instanceof \Magento\Shipping\Model\Rate\Result\Error)) { + if (false !== $result && !($result instanceof \Magento\Sales\Model\Quote\Address\RateResult\Error)) { $result = $carrier->proccessAdditionalValidation($request); } /* * Result will be false if the admin set not to show the shipping module * if the delivery country is not within specific countries */ - if (false !== $result){ - if (!$result instanceof \Magento\Shipping\Model\Rate\Result\Error) { + if (false !== $result) { + if (!$result instanceof \Magento\Sales\Model\Quote\Address\RateResult\Error) { if ($carrier->getConfigData('shipment_requesttype')) { $packages = $this->composePackagesForCarrier($carrier, $request); if (!empty($packages)) { @@ -301,7 +302,7 @@ class Shipping * Devides order into items and items into parts if it's necessary * * @param \Magento\Shipping\Model\Carrier\AbstractCarrier $carrier - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return array [int, float] */ public function composePackagesForCarrier($carrier, $request) @@ -440,7 +441,7 @@ class Shipping */ public function collectRatesByAddress(\Magento\Object $address, $limitCarrier = null) { - /** @var $request \Magento\Shipping\Model\Rate\Request */ + /** @var $request \Magento\Sales\Model\Quote\Address\RateRequest */ $request = $this->_shipmentRequestFactory->create(); $request->setAllItems($address->getAllItems()); $request->setDestCountryId($address->getCountryId()); @@ -473,22 +474,4 @@ class Shipping $this->_availabilityConfigField = $code; return $this; } - - /** - * Get carrier by its code - * - * @param string $carrierCode - * @param null|int $storeId - * @return bool|\Magento\Core\Model\AbstractModel - */ - public function getCarrierByCode($carrierCode, $storeId = null) - { - $isActive = $this->_coreStoreConfig - ->getConfigFlag('carriers/' . $carrierCode . '/' . $this->_availabilityConfigField, $storeId); - if (!$isActive) { - return false; - } - - return $this->_carrierFactory->create($carrierCode, $storeId); - } } diff --git a/app/code/Magento/Shipping/Model/Shipping/Labels.php b/app/code/Magento/Shipping/Model/Shipping/Labels.php index a195a2dd7de..980a6d63d07 100644 --- a/app/code/Magento/Shipping/Model/Shipping/Labels.php +++ b/app/code/Magento/Shipping/Model/Shipping/Labels.php @@ -27,6 +27,8 @@ namespace Magento\Shipping\Model\Shipping; +use \Magento\Sales\Model\Order\Shipment; + /** * Shipping labels model */ @@ -46,18 +48,19 @@ class Labels extends \Magento\Shipping\Model\Shipping * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Shipping\Model\Carrier\Factory $carrierFactory + * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory * @param \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Math\Division $mathDivision * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Shipping\Model\Shipment\Request $request */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Shipping\Model\Carrier\Factory $carrierFactory, + \Magento\Shipping\Model\CarrierFactory $carrierFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, \Magento\Shipping\Model\Shipment\RequestFactory $shipmentRequestFactory, \Magento\Directory\Model\RegionFactory $regionFactory, @@ -82,37 +85,40 @@ class Labels extends \Magento\Shipping\Model\Shipping /** * Prepare and do request to shipment * - * @param \Magento\Sales\Model\Order\Shipment $orderShipment + * @param Shipment $orderShipment * @return \Magento\Object * @throws \Magento\Core\Exception */ - public function requestToShipment(\Magento\Sales\Model\Order\Shipment $orderShipment) + public function requestToShipment(Shipment $orderShipment) { $admin = $this->_authSession->getUser(); $order = $orderShipment->getOrder(); $address = $order->getShippingAddress(); $shippingMethod = $order->getShippingMethod(true); $shipmentStoreId = $orderShipment->getStoreId(); - $shipmentCarrier = $order->getShippingCarrier(); + $shipmentCarrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); $baseCurrencyCode = $this->_storeManager->getStore($shipmentStoreId)->getBaseCurrencyCode(); if (!$shipmentCarrier) { throw new \Magento\Core\Exception('Invalid carrier: ' . $shippingMethod->getCarrierCode()); } - $shipperRegionCode = $this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_REGION_ID, $shipmentStoreId); + $shipperRegionCode = $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_REGION_ID, $shipmentStoreId); if (is_numeric($shipperRegionCode)) { $shipperRegionCode = $this->_regionFactory->create()->load($shipperRegionCode)->getCode(); } $recipientRegionCode = $this->_regionFactory->create()->load($address->getRegionId())->getCode(); - $originStreet1 = $this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_ADDRESS1, $shipmentStoreId); - $originStreet2 = $this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_ADDRESS2, $shipmentStoreId); - $storeInfo = new \Magento\Object((array)$this->_coreStoreConfig->getConfig('general/store_information', $shipmentStoreId)); + $originStreet1 = $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_ADDRESS1, $shipmentStoreId); + $originStreet2 = $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_ADDRESS2, $shipmentStoreId); + $storeInfo = new \Magento\Object( + (array)$this->_coreStoreConfig->getConfig('general/store_information', $shipmentStoreId) + ); if (!$admin->getFirstname() || !$admin->getLastname() || !$storeInfo->getName() || !$storeInfo->getPhone() - || !$originStreet1 || !$this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId) - || !$shipperRegionCode || !$this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_ZIP, $shipmentStoreId) - || !$this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId) + || !$originStreet1 || !$shipperRegionCode + || !$this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_CITY, $shipmentStoreId) + || !$this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_ZIP, $shipmentStoreId) + || !$this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId) ) { throw new \Magento\Core\Exception( __('We don\'t have enough information to create shipping labels. Please make sure your store information and settings are complete.') @@ -131,10 +137,16 @@ class Labels extends \Magento\Shipping\Model\Shipping $request->setShipperAddressStreet(trim($originStreet1 . ' ' . $originStreet2)); $request->setShipperAddressStreet1($originStreet1); $request->setShipperAddressStreet2($originStreet2); - $request->setShipperAddressCity($this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId)); + $request->setShipperAddressCity( + $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_CITY, $shipmentStoreId) + ); $request->setShipperAddressStateOrProvinceCode($shipperRegionCode); - $request->setShipperAddressPostalCode($this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_ZIP, $shipmentStoreId)); - $request->setShipperAddressCountryCode($this->_coreStoreConfig->getConfig(self::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId)); + $request->setShipperAddressPostalCode( + $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_ZIP, $shipmentStoreId) + ); + $request->setShipperAddressCountryCode( + $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId) + ); $request->setRecipientContactPersonName(trim($address->getFirstname() . ' ' . $address->getLastname())); $request->setRecipientContactPersonFirstName($address->getFirstname()); $request->setRecipientContactPersonLastName($address->getLastname()); diff --git a/app/code/Magento/Paygate/etc/adminhtml/routes.xml b/app/code/Magento/Shipping/etc/adminhtml/routes.xml similarity index 93% rename from app/code/Magento/Paygate/etc/adminhtml/routes.xml rename to app/code/Magento/Shipping/etc/adminhtml/routes.xml index 6878a6cb974..5fced11e7fa 100644 --- a/app/code/Magento/Paygate/etc/adminhtml/routes.xml +++ b/app/code/Magento/Shipping/etc/adminhtml/routes.xml @@ -26,7 +26,7 @@ <config> <router id="admin"> <route id="adminhtml"> - <module name="Magento_Paygate" before="Magento_Adminhtml" /> + <module name="Magento_Shipping" before="Magento_Adminhtml" /> </route> </router> </config> diff --git a/app/code/Magento/PageCache/etc/frontend/events.xml b/app/code/Magento/Shipping/etc/crontab.xml similarity index 83% rename from app/code/Magento/PageCache/etc/frontend/events.xml rename to app/code/Magento/Shipping/etc/crontab.xml index 2c474560ee1..4bd12111cd0 100644 --- a/app/code/Magento/PageCache/etc/frontend/events.xml +++ b/app/code/Magento/Shipping/etc/crontab.xml @@ -24,7 +24,7 @@ */ --> <config> - <event name="controller_action_predispatch"> - <observer name="pagecache" instance="Magento\PageCache\Model\Observer" method="processPreDispatch" /> - </event> + <job name="aggregate_sales_report_shipment_data" instance="Magento\Shipping\Model\Observer" method="aggregateSalesReportShipmentData"> + <schedule>0 0 * * *</schedule> + </job> </config> diff --git a/app/code/Magento/Shipping/etc/di.xml b/app/code/Magento/Shipping/etc/di.xml new file mode 100644 index 00000000000..795ff8c46ed --- /dev/null +++ b/app/code/Magento/Shipping/etc/di.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config> + <preference for="Magento\Sales\Model\Quote\Address\RateCollectorInterface" type="Magento\Shipping\Model\Shipping" /> + <preference for="Magento\Sales\Model\Quote\Address\CarrierFactoryInterface" type="Magento\Shipping\Model\CarrierFactory" /> +</config> diff --git a/app/code/Magento/Shipping/etc/module.xml b/app/code/Magento/Shipping/etc/module.xml index 3543b311a9a..e323b9968e2 100755 --- a/app/code/Magento/Shipping/etc/module.xml +++ b/app/code/Magento/Shipping/etc/module.xml @@ -33,9 +33,14 @@ <module name="Magento_Core"/> <module name="Magento_Catalog"/> <module name="Magento_Sales"/> - <module name="Magento_Customer"/> <module name="Magento_Backend"/> - <module name="Magento_Directory"/> + <module name="Magento_Directory"/> + <module name="Magento_Contacts"/> + <module name="Magento_Usa"/> + <module name="Magento_Customer"/> + <module name="Magento_Payment"/> + <module name="Magento_Theme"/> + <module name="Magento_Tax"/> </depends> </module> </config> diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/create/form.phtml b/app/code/Magento/Shipping/view/adminhtml/create/form.phtml similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/create/form.phtml rename to app/code/Magento/Shipping/view/adminhtml/create/form.phtml diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/create/items.phtml b/app/code/Magento/Shipping/view/adminhtml/create/items.phtml similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/create/items.phtml rename to app/code/Magento/Shipping/view/adminhtml/create/items.phtml diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/create/items/renderer/configurable.phtml b/app/code/Magento/Shipping/view/adminhtml/create/items/renderer/configurable.phtml similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/create/items/renderer/configurable.phtml rename to app/code/Magento/Shipping/view/adminhtml/create/items/renderer/configurable.phtml diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/create/items/renderer/default.phtml b/app/code/Magento/Shipping/view/adminhtml/create/items/renderer/default.phtml similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/create/items/renderer/default.phtml rename to app/code/Magento/Shipping/view/adminhtml/create/items/renderer/default.phtml diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_addcomment.xml b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_addcomment.xml similarity index 91% rename from app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_addcomment.xml rename to app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_addcomment.xml index e0a1b85d2b2..8962ec0604b 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_addcomment.xml +++ b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_addcomment.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\View\Comments" name="shipment_comments"> + <block class="Magento\Shipping\Block\Adminhtml\View\Comments" name="shipment_comments"> <block class="Magento\Sales\Block\Adminhtml\Order\Comments\View" name="order_comments" template="order/comments/view.phtml"/> </block> </layout> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_removetrack.xml b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_addtrack.xml similarity index 87% rename from app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_removetrack.xml rename to app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_addtrack.xml index 42ad5977ac8..501c9a10603 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_removetrack.xml +++ b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_addtrack.xml @@ -24,5 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\View\Tracking" name="shipment_tracking" template="order/shipment/view/tracking.phtml"/> + <block class="Magento\Shipping\Block\Adminhtml\Order\Tracking\View" name="shipment_tracking" template="order/tracking/view.phtml"/> </layout> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_new.xml b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_new.xml similarity index 61% rename from app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_new.xml rename to app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_new.xml index 64592d9a8a4..444b85f604d 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_new.xml +++ b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_new.xml @@ -25,25 +25,25 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="head"> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-sales-order-shipment-packaging-js"> + <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-order-shipment-packaging-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Sales::order/shipment/packaging.js</argument> + <argument name="file" xsi:type="string">Magento_Shipping::order/packaging.js</argument> </arguments> </block> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\Create" name="sales_shipment_create"> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\Create\Form" name="form" template="order/shipment/create/form.phtml"> - <block class="Magento\Sales\Block\Adminhtml\Order\View\Info" name="order_info" template="order/view/info.phtml"/> + <block class="Magento\Shipping\Block\Adminhtml\Create" name="sales_shipment_create"> + <block class="Magento\Shipping\Block\Adminhtml\Create\Form" name="form" template="create/form.phtml"> + <block class="Magento\Sales\Block\Adminhtml\Order\View\Info" name="order_info" template="Magento_Sales::order/view/info.phtml"/> <block class="Magento\Sales\Block\Adminhtml\Order\Payment" name="order_payment"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\Create\Tracking" name="shipment_tracking" template="order/shipment/create/tracking.phtml"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\Create\Items" name="order_items" template="order/shipment/create/items.phtml"> - <block class="Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRenderer" as="default" template="order/shipment/create/items/renderer/default.phtml"/> - <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="items/column/qty.phtml" group="column"/> - <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="items/column/name.phtml" group="column"/> + <block class="Magento\Shipping\Block\Adminhtml\Create\Items" name="order_items" template="create/items.phtml"> + <block class="Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRenderer" as="default" template="Magento_Shipping::create/items/renderer/default.phtml"/> + <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="Magento_Sales::items/column/qty.phtml" group="column"/> + <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="Magento_Sales::items/column/name.phtml" group="column"/> <block class="Magento\View\Element\Text\ListText" name="order_item_extra_info"/> </block> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\Packaging" name="shipment_packaging" template="order/shipment/packaging/popup.phtml"/> + <block class="Magento\Shipping\Block\Adminhtml\Order\Tracking" name="shipment_tracking" template="order/tracking.phtml"/> + <block class="Magento\Shipping\Block\Adminhtml\Order\Packaging" name="shipment_packaging" template="Magento_Shipping::order/packaging/popup.phtml"/> </block> </block> </referenceContainer> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_addtrack.xml b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_removetrack.xml similarity index 87% rename from app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_addtrack.xml rename to app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_removetrack.xml index 42ad5977ac8..501c9a10603 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_addtrack.xml +++ b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_removetrack.xml @@ -24,5 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\View\Tracking" name="shipment_tracking" template="order/shipment/view/tracking.phtml"/> + <block class="Magento\Shipping\Block\Adminhtml\Order\Tracking\View" name="shipment_tracking" template="order/tracking/view.phtml"/> </layout> diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_view.xml b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_view.xml similarity index 53% rename from app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_view.xml rename to app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_view.xml index efe5ee5139a..b7fc259c26f 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_shipment_view.xml +++ b/app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order_shipment_view.xml @@ -25,32 +25,27 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceBlock name="head"> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-sales-order-shipment-packaging-js"> + <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-order-shipment-packaging-js"> <arguments> - <argument name="file" xsi:type="string">Magento_Sales::order/shipment/packaging.js</argument> + <argument name="file" xsi:type="string">Magento_Shipping::order/packaging.js</argument> </arguments> </block> </referenceBlock> <referenceContainer name="content"> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\View" name="sales_shipment_view"> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\View\Form" name="form" template="order/shipment/view/form.phtml"> - <block class="Magento\Sales\Block\Adminhtml\Order\View\Info" name="order_info" template="order/view/info.phtml"/> + <block class="Magento\Shipping\Block\Adminhtml\View" name="sales_shipment_view"> + <block class="Magento\Shipping\Block\Adminhtml\View\Form" name="form" template="view/form.phtml"> + <block class="Magento\Sales\Block\Adminhtml\Order\View\Info" name="order_info" template="Magento_Sales::order/view/info.phtml"/> <block class="Magento\Sales\Block\Adminhtml\Order\Payment" name="order_payment"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\View\Tracking" name="shipment_tracking" template="order/shipment/view/tracking.phtml"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\View\Items" name="shipment_items" template="order/shipment/view/items.phtml"> - <block class="Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRenderer" as="default" template="order/shipment/view/items/renderer/default.phtml"/> - <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="items/column/qty.phtml" group="column"/> - <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="items/column/name.phtml" group="column"/> + <block class="Magento\Shipping\Block\Adminhtml\View\Items" name="shipment_items" template="view/items.phtml"> + <block class="Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRenderer" as="default" template="Magento_Shipping::view/items/renderer/default.phtml"/> + <block class="Magento\Sales\Block\Adminhtml\Items\Column\Qty" name="column_qty" template="Magento_Sales::items/column/qty.phtml" group="column"/> + <block class="Magento\Sales\Block\Adminhtml\Items\Column\Name" name="column_name" template="Magento_Sales::items/column/name.phtml" group="column"/> <block class="Magento\View\Element\Text\ListText" name="order_item_extra_info"/> </block> - <block class="Magento\Sales\Block\Adminhtml\Order\Invoice\Create\Tracking" name="invoice_tracking" template="order/shipment/create/tracking.phtml"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Comments\View" name="order_comments" template="order/comments/view.phtml"> - <action method="setParentType"> - <argument name="type" xsi:type="string">shipment</argument> - </action> - </block> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\Packaging" name="shipment_packaging" template="order/shipment/packaging/popup.phtml"/> - <block class="Magento\Sales\Block\Adminhtml\Order\Shipment\Packaging" name="shipment_packed" template="order/shipment/packaging/packed.phtml"/> + <block class="Magento\Sales\Block\Adminhtml\Order\Comments\View" name="order_comments" template="order/comments/view.phtml"/> + <block class="Magento\Shipping\Block\Adminhtml\Order\Tracking\View" name="shipment_tracking" template="order/tracking/view.phtml"/> + <block class="Magento\Shipping\Block\Adminhtml\Order\Packaging" name="shipment_packaging" template="order/packaging/popup.phtml"/> + <block class="Magento\Shipping\Block\Adminhtml\Order\Packaging" name="shipment_packed" template="order/packaging/packed.phtml"/> </block> </block> </referenceContainer> diff --git a/app/code/Magento/PageCache/view/adminhtml/layout/adminhtml_cache_index.xml b/app/code/Magento/Shipping/view/adminhtml/layout/sales_order_invoice_new.xml similarity index 84% rename from app/code/Magento/PageCache/view/adminhtml/layout/adminhtml_cache_index.xml rename to app/code/Magento/Shipping/view/adminhtml/layout/sales_order_invoice_new.xml index f9ac286713b..8fcc195d013 100644 --- a/app/code/Magento/PageCache/view/adminhtml/layout/adminhtml_cache_index.xml +++ b/app/code/Magento/Shipping/view/adminhtml/layout/sales_order_invoice_new.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="cache.additional"> - <block class="Magento\PageCache\Block\Adminhtml\Cache\Additional" name="page.cache.additional" template="cache/additional.phtml"/> + <referenceBlock name="form"> + <block class="Magento\Shipping\Block\Adminhtml\Order\Tracking\Invoice" name="tracking" template="order/tracking.phtml"/> </referenceBlock> </layout> diff --git a/app/code/Magento/Shipping/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/Shipping/view/adminhtml/layout/sales_order_view.xml new file mode 100644 index 00000000000..1ed3678bcc2 --- /dev/null +++ b/app/code/Magento/Shipping/view/adminhtml/layout/sales_order_view.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="order_tab_info"> + <block class="Magento\Sales\Block\Adminhtml\Order\AbstractOrder" name="order_shipping_view" template="Magento_Shipping::order/view/info.phtml"/> + </referenceBlock> +</layout> diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/view/tracking.phtml b/app/code/Magento/Shipping/view/adminhtml/order/Tracking/view.phtml similarity index 97% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/view/tracking.phtml rename to app/code/Magento/Shipping/view/adminhtml/order/Tracking/view.phtml index 5b6ef9d6351..bb97129a95f 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/shipment/view/tracking.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/order/Tracking/view.phtml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php /** @var $this \Magento\Sales\Block\Adminhtml\Order\Shipment\View\Tracking */ ?> +<?php /** @var $this Magento\Shipping\Block\Adminhtml\Order\Tracking\View */ ?> <table cellspacing="0" class="data-table" id="shipment_tracking_info"> <thead> <tr class="headings"> diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js b/app/code/Magento/Shipping/view/adminhtml/order/packaging.js similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js rename to app/code/Magento/Shipping/view/adminhtml/order/packaging.js diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging/grid.phtml b/app/code/Magento/Shipping/view/adminhtml/order/packaging/grid.phtml similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/packaging/grid.phtml rename to app/code/Magento/Shipping/view/adminhtml/order/packaging/grid.phtml diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging/packed.phtml b/app/code/Magento/Shipping/view/adminhtml/order/packaging/packed.phtml similarity index 99% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/packaging/packed.phtml rename to app/code/Magento/Shipping/view/adminhtml/order/packaging/packed.phtml index 645a715b47a..61e72415657 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging/packed.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/order/packaging/packed.phtml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> - +<div id="popup-window-mask" style="display:none;"></div> <div id="packed_window" style="display:none;" class="packed-window"> <div class="popup-window-wrapper"> <div class="popup-window-title"> diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging/popup.phtml b/app/code/Magento/Shipping/view/adminhtml/order/packaging/popup.phtml similarity index 99% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/packaging/popup.phtml rename to app/code/Magento/Shipping/view/adminhtml/order/packaging/popup.phtml index 759e3f9c258..0dab463f895 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/shipment/packaging/popup.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/order/packaging/popup.phtml @@ -24,7 +24,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<?php /** @var $this \Magento\Sales\Block\Adminhtml\Order\Shipment\Packaging */ ?> +<?php /** @var $this \Magento\Shipping\Block\Adminhtml\Order\Packaging */ ?> <?php $shippingMethod = $this->getShipment()->getOrder()->getShippingMethod(); $sizeSource = $this->getSourceSizeModel()->toOptionArray(); diff --git a/app/code/Magento/Shipping/view/adminhtml/order/tracking.phtml b/app/code/Magento/Shipping/view/adminhtml/order/tracking.phtml new file mode 100644 index 00000000000..907fd1ade04 --- /dev/null +++ b/app/code/Magento/Shipping/view/adminhtml/order/tracking.phtml @@ -0,0 +1,102 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +?> +<?php /** @var $this Magento\Shipping\Block\Adminhtml\Order\Tracking */?> +<script type="text/javascript"> + //<![CDATA[ + var trackingControl; + trackingControl = { + index : 0, + add : function () { + this.index++; + var data = {index:this.index}; + Element.insert($('track_row_container'), {bottom: this.template.evaluate(data)}); + $('trackingC' + this.index).disabled = false; + $('trackingT' + this.index).disabled = false; + $('trackingN' + this.index).disabled = false; + this.bindCurrierOnchange(); + }, + deleteRow : function(event) { + var row = Event.findElement(event, 'tr'); + if (row) { + row.parentNode.removeChild(row) + } + }, + bindCurrierOnchange : function() { + var elems = $('tracking_numbers_table').select('.select'); + elems.each(function (elem) { + if (!elem.onchangeBound) { + elem.onchangeBound = true; + elem.valueInput = $(elem.parentNode.parentNode).select('.number-title')[0]; + elem.observe('change', this.currierOnchange); + } + }.bind(this)); + }, + currierOnchange : function(event) { + var elem = Event.element(event); + var option = elem.options[elem.selectedIndex]; + if (option.value && option.value != 'custom') { + elem.valueInput.value = option.text; + } + else { + elem.valueInput.value = ''; + } + } + } + //]]> +</script> +<table cellspacing="0" class="data-table" id="tracking_numbers_table"> + <thead> + <tr class="headings"> + <th class="col-carrier"><?php echo __('Carrier') ?></th> + <th class="col-title"><?php echo __('Title') ?></th> + <th class="col-number"><?php echo __('Number') ?></th> + <th class="col-delete last"><?php echo __('Action') ?></th> + </tr> + </thead> + <tfoot> + <tr> + <td colspan="4" class="last"><?php echo $this->getChildHtml('add_button') ?></td> + </tr> + </tfoot> + <tbody id="track_row_container"> + <tr id="track_row_template" class="template no-display"> + <td class="col-carrier"> + <select name="tracking[__index__][carrier_code]" id="trackingC__index__" class="select carrier" disabled="disabled"> + <?php foreach ($this->getCarriers() as $_code=>$_name): ?> + <option value="<?php echo $_code ?>"><?php echo $this->escapeHtml($_name) ?></option> + <?php endforeach; ?> + </select> + </td> + <td class="col-title"><input class="input-text number-title" type="text" name="tracking[__index__][title]" id="trackingT__index__" value="" disabled="disabled" /></td> + <td class="col-number"><input class="input-text required-entry" type="text" name="tracking[__index__][number]" id="trackingN__index__" value="" disabled="disabled" /></td> + <td class="col-delete last"><a href="#" class="action- delete" onclick="trackingControl.deleteRow(event);return false"><span><?php echo __('Delete') ?></span></a></td> + </tr> + </tbody> +</table> +<script type="text/javascript"> + //<![CDATA[ + trackingControl.template = new Template('<tr>' + $('track_row_template').innerHTML.replace(/__index__/g, '#{index}') + '<\/tr>'); + //]]> +</script> diff --git a/app/code/Magento/Shipping/view/adminhtml/order/view/info.phtml b/app/code/Magento/Shipping/view/adminhtml/order/view/info.phtml new file mode 100644 index 00000000000..d5acef0479a --- /dev/null +++ b/app/code/Magento/Shipping/view/adminhtml/order/view/info.phtml @@ -0,0 +1,59 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category design + * @package default_default + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +?> +<?php /** @var $this \Magento\Shipping\Block\Adminhtml\View */ ?> +<?php $order = $this->getOrder() ?> +<?php if ($order->getIsVirtual()) : return '';endif; ?> +<div class="order-shipping-method"> + <!--Shipping Method--> + <div class="fieldset-wrapper"> + <div class="fieldset-wrapper-title"> + <span class="title"><?php echo __('Shipping & Handling Information') ?></span> + </div> + <div class="shipping-description-wrapper"> + <?php if ($order->getTracksCollection()->count()) : ?> + <p><a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('Magento\Shipping\Helper\Data')->getTrackingPopupUrlBySalesModel($order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo __('Track Order') ?>"><?php echo __('Track Order') ?></a></p> + <?php endif; ?> + <?php if ($order->getShippingDescription()): ?> + <strong><?php echo $this->escapeHtml($order->getShippingDescription()) ?></strong> + + <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingPriceIncludingTax()): ?> + <?php $_excl = $this->displayShippingPriceInclTax($order); ?> + <?php else: ?> + <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?> + <?php endif; ?> + <?php $_incl = $this->displayShippingPriceInclTax($order); ?> + + <?php echo $_excl; ?> + <?php if ($this->helper('Magento\Tax\Helper\Data')->displayShippingBothPrices() && $_incl != $_excl): ?> + (<?php echo __('Incl. Tax'); ?> <?php echo $_incl; ?>) + <?php endif; ?> + <?php else: ?> + <?php echo __('No shipping information available'); ?> + <?php endif; ?> + </div> + </div> +</div> \ No newline at end of file diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/view/form.phtml b/app/code/Magento/Shipping/view/adminhtml/view/form.phtml similarity index 98% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/view/form.phtml rename to app/code/Magento/Shipping/view/adminhtml/view/form.phtml index a7a8ae92972..f2e3f03a26b 100644 --- a/app/code/Magento/Sales/view/adminhtml/order/shipment/view/form.phtml +++ b/app/code/Magento/Shipping/view/adminhtml/view/form.phtml @@ -86,7 +86,7 @@ }); packaging.setLabelCreatedCallback(function(response){ setLocation("<?php echo $this->getUrl( - 'sales/order_shipment/view', + 'adminhtml/order_shipment/view', array('shipment_id' => $this->getShipment()->getId()) ); ?>"); }); diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/view/items.phtml b/app/code/Magento/Shipping/view/adminhtml/view/items.phtml similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/view/items.phtml rename to app/code/Magento/Shipping/view/adminhtml/view/items.phtml diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/view/items/renderer/configurable.phtml b/app/code/Magento/Shipping/view/adminhtml/view/items/renderer/configurable.phtml similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/view/items/renderer/configurable.phtml rename to app/code/Magento/Shipping/view/adminhtml/view/items/renderer/configurable.phtml diff --git a/app/code/Magento/Sales/view/adminhtml/order/shipment/view/items/renderer/default.phtml b/app/code/Magento/Shipping/view/adminhtml/view/items/renderer/default.phtml similarity index 100% rename from app/code/Magento/Sales/view/adminhtml/order/shipment/view/items/renderer/default.phtml rename to app/code/Magento/Shipping/view/adminhtml/view/items/renderer/default.phtml diff --git a/app/code/Magento/Sales/view/frontend/order/shipment/items.phtml b/app/code/Magento/Shipping/view/frontend/items.phtml similarity index 90% rename from app/code/Magento/Sales/view/frontend/order/shipment/items.phtml rename to app/code/Magento/Shipping/view/frontend/items.phtml index 24cddce4b5d..5ae077024d8 100644 --- a/app/code/Magento/Sales/view/frontend/order/shipment/items.phtml +++ b/app/code/Magento/Shipping/view/frontend/items.phtml @@ -23,15 +23,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> +<?php /** @var $this \Magento\Shipping\Block\Items */ ?> <?php $_order = $this->getOrder() ?> <div class="order toolbar"> <div class="actions"> <?php if ($_order->getTracksCollection()->count()) : ?> - <a href="#" - data-mage-init="{popupWindow: {windowURL:'<?php echo $this->helper('Magento\Shipping\Helper\Data')->getTrackingPopupUrlBySalesModel($_order) ?>',windowName:'trackorder',width:800,height:600,top:0,left:0,resizable:1,scrollbars:1}}" title="<?php echo __('Track all shipment(s)') ?>" - class="action track"> - <span><?php echo __('Track all shipments') ?></span> - </a> + <?php echo $this->getChildHtml('track-all-link') ?> <?php endif; ?> <a href="<?php echo $this->getPrintAllShipmentsUrl($_order) ?>" onclick="this.target='_blank'" diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_guest_reorder.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_reorder.xml new file mode 100644 index 00000000000..36dd2282f99 --- /dev/null +++ b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_reorder.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="sales.order.view"> + <block class="Magento\Shipping\Block\Tracking\Link" name="tracking-info-link" template="tracking/link.phtml"> + <arguments> + <argument name="label" xsi:type="string">Track your order</argument> + </arguments> + </block> + </referenceBlock> +</layout> \ No newline at end of file diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_guest_shipment.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_shipment.xml new file mode 100644 index 00000000000..514bfcc9d82 --- /dev/null +++ b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_shipment.xml @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceContainer name="content"> + <block class="Magento\Shipping\Block\Order\Shipment" name="sales.order.shipment" after="sales.order.info" cacheable="false"> + <block class="Magento\Shipping\Block\Items" name="shipment_items" template="items.phtml"> + <block class="Magento\Shipping\Block\Tracking\Link" name="track-all-link" template="tracking/link.phtml"> + <arguments> + <argument name="label" xsi:type="string">Track All Shipments</argument> + </arguments> + </block> + <block class="Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer" as="default" template="Magento_Sales::order/shipment/items/renderer/default.phtml"/> + <block class="Magento\Sales\Block\Order\Comments" name="shipment_comments" template="order/comments.phtml"/> + </block> + </block> + </referenceContainer> +</layout> \ No newline at end of file diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_guest_view.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_view.xml new file mode 100644 index 00000000000..36dd2282f99 --- /dev/null +++ b/app/code/Magento/Shipping/view/frontend/layout/sales_guest_view.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="sales.order.view"> + <block class="Magento\Shipping\Block\Tracking\Link" name="tracking-info-link" template="tracking/link.phtml"> + <arguments> + <argument name="label" xsi:type="string">Track your order</argument> + </arguments> + </block> + </referenceBlock> +</layout> \ No newline at end of file diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_order_reorder.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_order_reorder.xml new file mode 100644 index 00000000000..36dd2282f99 --- /dev/null +++ b/app/code/Magento/Shipping/view/frontend/layout/sales_order_reorder.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="sales.order.view"> + <block class="Magento\Shipping\Block\Tracking\Link" name="tracking-info-link" template="tracking/link.phtml"> + <arguments> + <argument name="label" xsi:type="string">Track your order</argument> + </arguments> + </block> + </referenceBlock> +</layout> \ No newline at end of file diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_order_shipment.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_order_shipment.xml new file mode 100644 index 00000000000..514bfcc9d82 --- /dev/null +++ b/app/code/Magento/Shipping/view/frontend/layout/sales_order_shipment.xml @@ -0,0 +1,40 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceContainer name="content"> + <block class="Magento\Shipping\Block\Order\Shipment" name="sales.order.shipment" after="sales.order.info" cacheable="false"> + <block class="Magento\Shipping\Block\Items" name="shipment_items" template="items.phtml"> + <block class="Magento\Shipping\Block\Tracking\Link" name="track-all-link" template="tracking/link.phtml"> + <arguments> + <argument name="label" xsi:type="string">Track All Shipments</argument> + </arguments> + </block> + <block class="Magento\Sales\Block\Order\Item\Renderer\DefaultRenderer" as="default" template="Magento_Sales::order/shipment/items/renderer/default.phtml"/> + <block class="Magento\Sales\Block\Order\Comments" name="shipment_comments" template="order/comments.phtml"/> + </block> + </block> + </referenceContainer> +</layout> \ No newline at end of file diff --git a/app/code/Magento/Shipping/view/frontend/layout/sales_order_view.xml b/app/code/Magento/Shipping/view/frontend/layout/sales_order_view.xml new file mode 100644 index 00000000000..36dd2282f99 --- /dev/null +++ b/app/code/Magento/Shipping/view/frontend/layout/sales_order_view.xml @@ -0,0 +1,34 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="sales.order.view"> + <block class="Magento\Shipping\Block\Tracking\Link" name="tracking-info-link" template="tracking/link.phtml"> + <arguments> + <argument name="label" xsi:type="string">Track your order</argument> + </arguments> + </block> + </referenceBlock> +</layout> \ No newline at end of file diff --git a/app/code/Magento/Sales/view/frontend/order/shipment.phtml b/app/code/Magento/Shipping/view/frontend/order/shipment.phtml similarity index 100% rename from app/code/Magento/Sales/view/frontend/order/shipment.phtml rename to app/code/Magento/Shipping/view/frontend/order/shipment.phtml diff --git a/app/code/Magento/Shipping/view/frontend/tracking/link.phtml b/app/code/Magento/Shipping/view/frontend/tracking/link.phtml new file mode 100644 index 00000000000..2eb73dab6b6 --- /dev/null +++ b/app/code/Magento/Shipping/view/frontend/tracking/link.phtml @@ -0,0 +1,30 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +?> +<?php /** @var $this \Magento\Shipping\Block\Tracking\Link */ ?> +<?php $order = $this->getOrder() ?> +<a href="#" class="action track" title="<?php echo $this->getLabel() ?>" + data-mage-init="{popupWindow: {windowURL:'<?php echo $this->getWindowUrl($order) ?>',windowName:'trackorder',width:800,height:600,left:0,top:0,resizable:1,scrollbars:1}}"> + <span><?php echo $this->getLabel()?></span> +</a> \ No newline at end of file diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php index 26ed1174907..2c5faf4ebb8 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Grid/Renderer/Link.php @@ -35,7 +35,7 @@ namespace Magento\Sitemap\Block\Adminhtml\Grid\Renderer; class Link extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** - * @var \Magento\Filesystem $filesystem + * @var \Magento\App\Filesystem $filesystem */ protected $_filesystem; @@ -47,13 +47,13 @@ class Link extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Sitemap\Model\SitemapFactory $sitemapFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, \Magento\Sitemap\Model\SitemapFactory $sitemapFactory, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, array $data = array() ) { $this->_sitemapFactory = $sitemapFactory; @@ -74,7 +74,7 @@ class Link extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRe $url = $this->escapeHtml($sitemap->getSitemapUrl($row->getSitemapPath(), $row->getSitemapFilename())); $fileName = preg_replace('/^\//', '', $row->getSitemapPath() . $row->getSitemapFilename()); - $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $directory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); if ($directory->isFile($fileName)) { return sprintf('<a href="%1$s">%1$s</a>', $url); } diff --git a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php index 8fe99b33a60..33d212ce034 100644 --- a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php +++ b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php @@ -169,8 +169,8 @@ class Sitemap extends \Magento\Backend\App\Action } /** @var \Magento\Filesystem\Directory\Write $directory */ - $directory = $this->_objectManager->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::ROOT); + $directory = $this->_objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); if ($this->getRequest()->getParam('sitemap_id')) { $model->load($this->getRequest()->getParam('sitemap_id')); @@ -228,8 +228,8 @@ class Sitemap extends \Magento\Backend\App\Action public function deleteAction() { /** @var \Magento\Filesystem\Directory\Write $directory */ - $directory = $this->_objectManager->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::ROOT); + $directory = $this->_objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); // check if we know what should be deleted $id = $this->getRequest()->getParam('sitemap_id'); diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index f360b5e6d4e..83ac6d0b323 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -161,7 +161,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\Registry $registry * @param \Magento\Escaper $escaper * @param \Magento\Sitemap\Helper\Data $sitemapData - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Sitemap\Model\Resource\Catalog\CategoryFactory $categoryFactory * @param \Magento\Sitemap\Model\Resource\Catalog\ProductFactory $productFactory * @param \Magento\Sitemap\Model\Resource\Cms\PageFactory $cmsFactory @@ -178,7 +178,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\Registry $registry, \Magento\Escaper $escaper, \Magento\Sitemap\Helper\Data $sitemapData, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Sitemap\Model\Resource\Catalog\CategoryFactory $categoryFactory, \Magento\Sitemap\Model\Resource\Catalog\ProductFactory $productFactory, \Magento\Sitemap\Model\Resource\Cms\PageFactory $cmsFactory, @@ -192,7 +192,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel ) { $this->_escaper = $escaper; $this->_sitemapData = $sitemapData; - $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $this->_categoryFactory = $categoryFactory; $this->_productFactory = $productFactory; $this->_cmsFactory = $cmsFactory; diff --git a/app/code/Magento/Sitemap/etc/module.xml b/app/code/Magento/Sitemap/etc/module.xml index 729467a2115..689b8c319fa 100755 --- a/app/code/Magento/Sitemap/etc/module.xml +++ b/app/code/Magento/Sitemap/etc/module.xml @@ -34,6 +34,7 @@ <module name="Magento_Eav"/> <module name="Magento_Cms"/> <module name="Magento_Backend"/> + <module name="Magento_Email"/> </depends> </module> </config> diff --git a/app/code/Magento/Tax/Block/Checkout/Discount.php b/app/code/Magento/Tax/Block/Checkout/Discount.php index 589c06e3ca1..acba8d8eedc 100644 --- a/app/code/Magento/Tax/Block/Checkout/Discount.php +++ b/app/code/Magento/Tax/Block/Checkout/Discount.php @@ -56,6 +56,7 @@ class Discount extends \Magento\Checkout\Block\Total\DefaultTotal ) { $this->_taxConfig = $taxConfig; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $salesConfig, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Tax/Block/Checkout/Grandtotal.php b/app/code/Magento/Tax/Block/Checkout/Grandtotal.php index 4efa0f943b3..d2433573443 100644 --- a/app/code/Magento/Tax/Block/Checkout/Grandtotal.php +++ b/app/code/Magento/Tax/Block/Checkout/Grandtotal.php @@ -63,6 +63,7 @@ class Grandtotal extends \Magento\Checkout\Block\Total\DefaultTotal ) { $this->_taxConfig = $taxConfig; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $salesConfig, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Tax/Block/Checkout/Shipping.php b/app/code/Magento/Tax/Block/Checkout/Shipping.php index 497abc917b3..b46ac8987a0 100644 --- a/app/code/Magento/Tax/Block/Checkout/Shipping.php +++ b/app/code/Magento/Tax/Block/Checkout/Shipping.php @@ -63,6 +63,7 @@ class Shipping extends \Magento\Checkout\Block\Total\DefaultTotal ) { $this->_taxConfig = $taxConfig; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $salesConfig, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Tax/Block/Checkout/Subtotal.php b/app/code/Magento/Tax/Block/Checkout/Subtotal.php index 4de7b204235..88b025cf1b2 100644 --- a/app/code/Magento/Tax/Block/Checkout/Subtotal.php +++ b/app/code/Magento/Tax/Block/Checkout/Subtotal.php @@ -63,6 +63,7 @@ class Subtotal extends \Magento\Checkout\Block\Total\DefaultTotal ) { $this->_taxConfig = $taxConfig; parent::__construct($context, $catalogData, $customerSession, $checkoutSession, $salesConfig, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php index 74976baf893..923c7ab15d3 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php @@ -300,7 +300,7 @@ class Rate extends \Magento\Backend\App\Action { $this->_view->loadLayout(false); $content = $this->_view->getLayout()->getChildBlock('adminhtml.tax.rate.grid', 'grid.export'); - return $this->_fileFactory->create('rates.csv', $content->getCsvFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create('rates.csv', $content->getCsvFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -310,7 +310,7 @@ class Rate extends \Magento\Backend\App\Action { $this->_view->loadLayout(false); $content = $this->_view->getLayout()->getChildBlock('adminhtml.tax.rate.grid', 'grid.export'); - return $this->_fileFactory->create('rates.xml', $content->getExcelFile(), \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create('rates.xml', $content->getExcelFile(), \Magento\App\Filesystem::VAR_DIR); } /** @@ -431,7 +431,7 @@ class Rate extends \Magento\Backend\App\Action $content .= $rate->toString($template) . "\n"; } $this->_view->loadLayout(); - return $this->_fileFactory->create('tax_rates.csv', $content, \Magento\Filesystem::VAR_DIR); + return $this->_fileFactory->create('tax_rates.csv', $content, \Magento\App\Filesystem::VAR_DIR); } protected function _isAllowed() diff --git a/app/code/Magento/Tax/Model/Resource/Setup.php b/app/code/Magento/Tax/Model/Resource/Setup.php index 08abca33639..03a4c417797 100644 --- a/app/code/Magento/Tax/Model/Resource/Setup.php +++ b/app/code/Magento/Tax/Model/Resource/Setup.php @@ -40,7 +40,7 @@ class Setup extends \Magento\Sales\Model\Resource\Setup * @param \Magento\Core\Model\Resource\Setup\Context $context * @param string $resourceName * @param \Magento\App\CacheInterface $cache - * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory * @param \Magento\Core\Model\Config $config * @param \Magento\Catalog\Model\Resource\SetupFactory $setupFactory * @param string $moduleName @@ -50,14 +50,14 @@ class Setup extends \Magento\Sales\Model\Resource\Setup \Magento\Core\Model\Resource\Setup\Context $context, $resourceName, \Magento\App\CacheInterface $cache, - \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGrCollFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $attrGroupCollectionFactory, \Magento\Core\Model\Config $config, \Magento\Catalog\Model\Resource\SetupFactory $setupFactory, $moduleName = 'Magento_Tax', $connectionName = '' ) { $this->_setupFactory = $setupFactory; - parent::__construct($context, $resourceName, $cache, $attrGrCollFactory, $config, $moduleName, $connectionName); + parent::__construct($context, $resourceName, $cache, $attrGroupCollectionFactory, $config, $moduleName, $connectionName); } /** diff --git a/app/code/Magento/Tax/etc/module.xml b/app/code/Magento/Tax/etc/module.xml index 39aa92d3edc..cb40c19e62c 100755 --- a/app/code/Magento/Tax/etc/module.xml +++ b/app/code/Magento/Tax/etc/module.xml @@ -41,6 +41,7 @@ <module name="Magento_Eav"/> <module name="Magento_Sales"/> <module name="Magento_Reports"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php index 0df09c9d812..7dde52893f8 100644 --- a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php +++ b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php @@ -297,7 +297,7 @@ class Theme extends \Magento\Backend\App\Action 'type' => 'filename', 'value' => $customCssFile->getFullPath() ), - \Magento\Filesystem::ROOT + \Magento\App\Filesystem::ROOT_DIR ); } } catch (\Exception $e) { @@ -338,7 +338,7 @@ class Theme extends \Magento\Backend\App\Action 'type' => 'filename', 'value' => $themeCss[$fileName]['path'] ), - \Magento\Filesystem::ROOT + \Magento\App\Filesystem::ROOT_DIR ); } catch (\Exception $e) { $this->messageManager->addException($e, __('We cannot find file "%1".', $fileName)); diff --git a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php index c8999ca2272..a2dfef884c6 100644 --- a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php +++ b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php @@ -153,7 +153,7 @@ class Files extends \Magento\Backend\App\Action 'type' => 'filename', 'value' => $helper->getThumbnailPath($file) ), - \Magento\Filesystem::MEDIA + \Magento\App\Filesystem::MEDIA_DIR ); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); diff --git a/app/code/Magento/Theme/Helper/Storage.php b/app/code/Magento/Theme/Helper/Storage.php index c1da5305e61..bdfed246db6 100644 --- a/app/code/Magento/Theme/Helper/Storage.php +++ b/app/code/Magento/Theme/Helper/Storage.php @@ -83,7 +83,7 @@ class Storage extends \Magento\App\Helper\AbstractHelper /** * Magento filesystem * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -104,13 +104,13 @@ class Storage extends \Magento\App\Helper\AbstractHelper /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Backend\Model\Session $session * @param \Magento\View\Design\Theme\FlyweightFactory $themeFactory */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Backend\Model\Session $session, \Magento\View\Design\Theme\FlyweightFactory $themeFactory ) { @@ -118,7 +118,7 @@ class Storage extends \Magento\App\Helper\AbstractHelper $this->filesystem = $filesystem; $this->_session = $session; $this->_themeFactory = $themeFactory; - $this->mediaDirectoryWrite = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->mediaDirectoryWrite = $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->mediaDirectoryWrite->create($this->getStorageRoot()); } diff --git a/app/code/Magento/Theme/Model/CopyService.php b/app/code/Magento/Theme/Model/CopyService.php index 766f6b78ef3..be261bfb0ad 100644 --- a/app/code/Magento/Theme/Model/CopyService.php +++ b/app/code/Magento/Theme/Model/CopyService.php @@ -62,7 +62,7 @@ class CopyService protected $_customizationPath; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Design\Theme\FileFactory $fileFactory * @param \Magento\Core\Model\Layout\Link $link * @param \Magento\Core\Model\Layout\UpdateFactory $updateFactory @@ -70,14 +70,14 @@ class CopyService * @param \Magento\View\Design\Theme\Customization\Path $customization */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\Design\Theme\FileFactory $fileFactory, \Magento\Core\Model\Layout\Link $link, \Magento\Core\Model\Layout\UpdateFactory $updateFactory, \Magento\Event\ManagerInterface $eventManager, \Magento\View\Design\Theme\Customization\Path $customization ) { - $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_fileFactory = $fileFactory; $this->_link = $link; $this->_updateFactory = $updateFactory; diff --git a/app/code/Magento/Theme/Model/Uploader/Service.php b/app/code/Magento/Theme/Model/Uploader/Service.php index 01669bac70b..74c649c84d9 100644 --- a/app/code/Magento/Theme/Model/Uploader/Service.php +++ b/app/code/Magento/Theme/Model/Uploader/Service.php @@ -74,18 +74,18 @@ class Service /** * Constructor * - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\File\Size $fileSize * @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory * @param array $uploadLimits keys are 'css' and 'js' for file type, values defines maximum file size, example: 2M */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\File\Size $fileSize, \Magento\Core\Model\File\UploaderFactory $uploaderFactory, array $uploadLimits = array() ) { - $this->_tmpDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::SYS_TMP); + $this->_tmpDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::SYS_TMP_DIR); $this->_fileSize = $fileSize; $this->_uploaderFactory = $uploaderFactory; if (isset($uploadLimits['css'])) { diff --git a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php index 68a9faea7b4..a031c74136b 100644 --- a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php +++ b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php @@ -86,18 +86,18 @@ class Storage /** * Initialize dependencies * - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Theme\Helper\Storage $helper * @param \Magento\ObjectManager $objectManager * @param \Magento\Image\AdapterFactory $imageFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Theme\Helper\Storage $helper, \Magento\ObjectManager $objectManager, \Magento\Image\AdapterFactory $imageFactory ) { - $this->mediaWriteDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->mediaWriteDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_helper = $helper; $this->_objectManager = $objectManager; $this->_imageFactory = $imageFactory; diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 5f553e70450..ba181c8ea99 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -108,6 +108,11 @@ <argument name="file" xsi:type="string">mage/loader.js</argument> </arguments> </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="magento-dataPost-js"> + <arguments> + <argument name="file" xsi:type="string">mage/dataPost.js</argument> + </arguments> + </block> <!-- Preload resources for widgets --> <block class="Magento\View\Element\Js\Components" name="head.components" as="components" template="Magento_Theme::js/components.phtml"/> </referenceBlock> diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php index d8ebc043c44..a7fd426cec7 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php @@ -64,7 +64,7 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC protected $_rateFactory; /** - * @var \Magento\Shipping\Model\Rate\Result\MethodFactory + * @var \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory */ protected $_rateMethodFactory; @@ -101,11 +101,11 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory * @param \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory * @param \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory * @param \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory @@ -119,11 +119,11 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory, \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory, \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory, @@ -234,10 +234,10 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC * bundle itself, otherwise we may not get a rate at all (e.g. when total weight of a bundle exceeds max weight * despite each item by itself is not) * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return array */ - public function getAllItems(\Magento\Shipping\Model\Rate\Request $request) + public function getAllItems(\Magento\Sales\Model\Quote\Address\RateRequest $request) { $items = array(); if ($request->getAllItems()) { @@ -266,10 +266,10 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC /** * Processing additional validation to check if carrier applicable. * - * @param \Magento\Shipping\Model\Rate\Request $request - * @return \Magento\Shipping\Model\Carrier\AbstractCarrier|\Magento\Shipping\Model\Rate\Result\Error|boolean + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request + * @return \Magento\Shipping\Model\Carrier\AbstractCarrier|\Magento\Sales\Model\Quote\Address\RateResult\Error|boolean */ - public function proccessAdditionalValidation(\Magento\Shipping\Model\Rate\Request $request) + public function proccessAdditionalValidation(\Magento\Sales\Model\Quote\Address\RateRequest $request) { //Skip by item validation if there is no items in request if(!count($this->getAllItems($request))) { @@ -406,7 +406,7 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC * @param \Magento\Shipping\Model\Shipment\Request $request * @return array */ - public function requestToShipment(\Magento\Shipping\Model\Shipment\Request $request) + public function requestToShipment($request) { $packages = $request->getPackages(); if (!is_array($packages) || !$packages) { diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php index c5602f3bda0..dde3b5f1f90 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php @@ -51,7 +51,7 @@ class Dhl /** * Rate request data * - * @var \Magento\Shipping\Model\Rate\Request|null + * @var \Magento\Sales\Model\Quote\Address\RateRequest|null */ protected $_request = null; @@ -188,11 +188,11 @@ class Dhl /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory * @param \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory * @param \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory * @param \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory @@ -209,11 +209,11 @@ class Dhl */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory, \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory, \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory, @@ -250,10 +250,10 @@ class Dhl /** * Collect and get rates * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return bool|\Magento\Shipping\Model\Rate\Result|null */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -271,21 +271,21 @@ class Dhl $origCountryId = $requestDhl->getOrigCountryId(); if (!$origCountryId) { $origCountryId = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $requestDhl->getStoreId() ); } $origState = $requestDhl->getOrigState(); if (!$origState) { $origState = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_REGION_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_REGION_ID, $requestDhl->getStoreId() ); } $origCity = $requestDhl->getOrigCity(); if (!$origCity) { $origCity = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_CITY, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_CITY, $requestDhl->getStoreId() ); } @@ -293,7 +293,7 @@ class Dhl $origPostcode = $requestDhl->getOrigPostcode(); if (!$origPostcode) { $origPostcode = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_ZIP, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP, $requestDhl->getStoreId() ); } @@ -405,7 +405,7 @@ class Dhl $origCountry = $request->getOrigCountry(); } else { $origCountry = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $r->getStoreId() ); } @@ -415,7 +415,7 @@ class Dhl $origCountryId = $request->getOrigCountryId(); } else { $origCountryId = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $r->getStoreId() ); } @@ -474,9 +474,9 @@ class Dhl $r->setOrigCity($request->getOrigCity()); $r->setOrigPostal($request->getOrigPostal()); $originStreet1 = $this->_coreStoreConfig - ->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_ADDRESS1, $r->getStoreId()); + ->getConfig(\Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ADDRESS1, $r->getStoreId()); $originStreet2 = $this->_coreStoreConfig - ->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_ADDRESS2, $r->getStoreId()); + ->getConfig(\Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ADDRESS2, $r->getStoreId()); $r->setOrigStreet($request->getOrigStreet() ? $request->getOrigStreet() : $originStreet2); $r->setOrigStreetLine2($request->getOrigStreetLine2()); $r->setDestPhoneNumber($request->getDestPhoneNumber()); diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php index f6ecedb7a13..a900f13e50c 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php @@ -60,7 +60,7 @@ class International /** * Rate request data * - * @var \Magento\Shipping\Model\Rate\Request|null + * @var \Magento\Sales\Model\Quote\Address\RateRequest|null */ protected $_request = null; @@ -204,11 +204,11 @@ class International /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory * @param \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory * @param \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory * @param \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory @@ -229,11 +229,11 @@ class International */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory, \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory, \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory, @@ -247,12 +247,12 @@ class International \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\String $string, \Magento\Math\Division $mathDivision, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Stdlib\DateTime $dateTime, \Zend_Http_ClientFactory $httpClientFactory, array $data = array() ) { - $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $this->_usaData = $usaData; $this->_coreDate = $coreDate; $this->_storeManager = $storeManager; @@ -304,10 +304,10 @@ class International /** * Collect and get rates * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return bool|\Magento\Shipping\Model\Rate\Result|null */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -322,19 +322,19 @@ class International ); $origCountryId = $this->_getDefaultValue( $requestDhl->getOrigCountryId(), - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID ); $origState = $this->_getDefaultValue( $requestDhl->getOrigState(), - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_REGION_ID + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_REGION_ID ); $origCity = $this->_getDefaultValue( $requestDhl->getOrigCity(), - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_CITY + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_CITY ); $origPostcode = $this->_getDefaultValue( $requestDhl->getOrigPostcode(), - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_ZIP + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP ); $requestDhl->setOrigCompanyName($origCompanyName) @@ -426,11 +426,11 @@ class International $requestObject->setOrigCountry( $this->_getDefaultValue( - $request->getOrigCountry(), \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID) + $request->getOrigCountry(), \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID) ) ->setOrigCountryId( $this->_getDefaultValue( - $request->getOrigCountryId(), \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID) + $request->getOrigCountryId(), \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID) ); $shippingWeight = $request->getPackageWeight(); @@ -454,7 +454,7 @@ class International ->setDestCompanyName($request->getDestCompanyName()); $originStreet2 = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_ADDRESS2, $requestObject->getStoreId()); + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ADDRESS2, $requestObject->getStoreId()); $requestObject->setOrigStreet($request->getOrigStreet() ? $request->getOrigStreet() : $originStreet2); @@ -1041,7 +1041,7 @@ class International * Parse response from DHL web service * * @param string $response - * @return bool|\Magento\Object|\Magento\Shipping\Model\Rate\Result|\Magento\Shipping\Model\Rate\Result\Error + * @return bool|\Magento\Object|\Magento\Shipping\Model\Rate\Result|\Magento\Sales\Model\Quote\Address\RateResult\Error * @throws \Magento\Core\Exception */ protected function _parseResponse($response) @@ -1102,7 +1102,7 @@ class International foreach ($this->_rates as $rate) { $method = $rate['service']; $data = $rate['data']; - /* @var $rate \Magento\Shipping\Model\Rate\Result\Method */ + /* @var $rate \Magento\Sales\Model\Quote\Address\RateResult\Method */ $rate = $this->_rateMethodFactory->create(); $rate->setCarrier(self::CODE); $rate->setCarrierTitle($this->getConfigData('title')); @@ -1265,10 +1265,10 @@ class International /** * Processing additional validation to check is carrier applicable. * - * @param \Magento\Shipping\Model\Rate\Request $request - * @return \Magento\Shipping\Model\Carrier\AbstractCarrier|\Magento\Shipping\Model\Rate\Result\Error|boolean + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request + * @return \Magento\Shipping\Model\Carrier\AbstractCarrier|\Magento\Sales\Model\Quote\Address\RateResult\Error|boolean */ - public function proccessAdditionalValidation(\Magento\Shipping\Model\Rate\Request $request) + public function proccessAdditionalValidation(\Magento\Sales\Model\Quote\Address\RateRequest $request) { //Skip by item validation if there is no items in request if (!count($this->getAllItems($request))) { @@ -1276,7 +1276,7 @@ class International } $countryParams = $this->getCountryParams( - $this->_coreStoreConfig->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId()) + $this->_coreStoreConfig->getConfig(\Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId()) ); if (!$countryParams->getData()) { $this->_errors[] = __('Please, specify origin country'); @@ -1292,14 +1292,14 @@ class International /** * Show default error * - * @return bool|\Magento\Shipping\Model\Rate\Result\Error + * @return bool|\Magento\Sales\Model\Quote\Address\RateResult\Error */ protected function _showError() { $showMethod = $this->getConfigData('showmethod'); if ($showMethod) { - /* @var $error \Magento\Shipping\Model\Rate\Result\Error */ + /* @var $error \Magento\Sales\Model\Quote\Address\RateResult\Error */ $error = $this->_rateErrorFactory->create(); $error->setCarrier(self::CODE); $error->setCarrierTitle($this->getConfigData('title')); @@ -1392,7 +1392,7 @@ class International $rawRequest = $this->_request; $originRegion = $this->getCountryParams( - $this->_coreStoreConfig->getConfig(\Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, $this->getStore()) + $this->_coreStoreConfig->getConfig(\Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $this->getStore()) )->getRegion(); if (!$originRegion) { @@ -1560,7 +1560,7 @@ class International * Generation Shipment Details Node according to origin region * * @param \Magento\Usa\Model\Simplexml\Element $xml - * @param \Magento\Shipping\Model\Rate\Request $rawRequest + * @param \Magento\Sales\Model\Quote\Address\RateRequest $rawRequest * @param string $originRegion * @return void */ @@ -1863,7 +1863,7 @@ class International * @return array|\Magento\Object * @throws \Magento\Core\Exception */ - public function requestToShipment(\Magento\Shipping\Model\Shipment\Request $request) + public function requestToShipment($request) { $packages = $request->getPackages(); if (!is_array($packages) || !$packages) { diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php index 9209bb6d86f..19c977eab9c 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php @@ -69,7 +69,7 @@ class Fedex /** * Rate request data * - * @var \Magento\Shipping\Model\Rate\Request|null + * @var \Magento\Sales\Model\Quote\Address\RateRequest|null */ protected $_request = null; @@ -128,15 +128,15 @@ class Fedex /** * @var \Magento\Catalog\Model\Resource\Product\CollectionFactory */ - protected $_productCollFactory; + protected $_productCollectionFactory; /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory * @param \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory * @param \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory * @param \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory @@ -147,18 +147,18 @@ class Fedex * @param \Magento\Logger $logger * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Module\Dir\Reader $configReader - * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory + * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory, \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory, \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory, @@ -169,11 +169,11 @@ class Fedex \Magento\Logger $logger, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Module\Dir\Reader $configReader, - \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, array $data = array() ) { $this->_storeManager = $storeManager; - $this->_productCollFactory = $productCollFactory; + $this->_productCollectionFactory = $productCollectionFactory; parent::__construct( $coreStoreConfig, $rateErrorFactory, @@ -248,10 +248,10 @@ class Fedex /** * Collect and get rates * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Shipping\Model\Rate\Result|bool|null */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -268,10 +268,10 @@ class Fedex /** * Prepare and set request to this instance * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Usa\Model\Shipping\Carrier\Fedex */ - public function setRequest(\Magento\Shipping\Model\Rate\Request $request) + public function setRequest(\Magento\Sales\Model\Quote\Address\RateRequest $request) { $this->_request = $request; @@ -306,7 +306,7 @@ class Fedex $origCountry = $request->getOrigCountry(); } else { $origCountry = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId() ); } @@ -316,7 +316,7 @@ class Fedex $r->setOrigPostal($request->getOrigPostcode()); } else { $r->setOrigPostal($this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_ZIP, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP, $request->getStoreId() )); } @@ -1310,7 +1310,7 @@ class Fedex } // get countries of manufacture - $productCollection = $this->_productCollFactory + $productCollection = $this->_productCollectionFactory ->create() ->addStoreFilter($request->getStoreId()) ->addFieldToFilter('entity_id', array('in' => $productIds)) @@ -1360,7 +1360,7 @@ class Fedex 'Payor' => array( 'AccountNumber' => $this->getConfigData('account'), 'CountryCode' => $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId() ) ) @@ -1404,7 +1404,7 @@ class Fedex 'Payor' => array( 'AccountNumber' => $this->getConfigData('account'), 'CountryCode' => $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId() ) ) diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php index 799198f4de7..89a7b91c77e 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php @@ -58,7 +58,7 @@ class Ups /** * Rate request data * - * @var \Magento\Shipping\Model\Rate\Request + * @var \Magento\Sales\Model\Quote\Address\RateRequest */ protected $_request; @@ -136,11 +136,11 @@ class Ups /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory * @param \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory * @param \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory * @param \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory @@ -156,11 +156,11 @@ class Ups */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory, \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory, \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory, @@ -196,11 +196,11 @@ class Ups /** * Collect and get rates * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Shipping\Model\Rate\Result|bool|null */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -217,10 +217,10 @@ class Ups /** * Prepare and set request to this instance * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Usa\Model\Shipping\Carrier\Ups */ - public function setRequest(\Magento\Shipping\Model\Rate\Request $request) + public function setRequest(\Magento\Sales\Model\Quote\Address\RateRequest $request) { $this->_request = $request; @@ -259,7 +259,7 @@ class Ups $origCountry = $request->getOrigCountry(); } else { $origCountry = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId() ); } @@ -270,7 +270,7 @@ class Ups $origRegionCode = $request->getOrigRegionCode(); } else { $origRegionCode = $this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_REGION_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_REGION_ID, $request->getStoreId() ); } @@ -283,7 +283,7 @@ class Ups $rowRequest->setOrigPostal($request->getOrigPostcode()); } else { $rowRequest->setOrigPostal($this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_ZIP, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP, $request->getStoreId() )); } @@ -292,7 +292,7 @@ class Ups $rowRequest->setOrigCity($request->getOrigCity()); } else { $rowRequest->setOrigCity($this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_CITY, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_CITY, $request->getStoreId() )); } diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php index 480184cfdd8..93b8b269fa3 100755 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php @@ -91,7 +91,7 @@ class Usps /** * Rate request data * - * @var \Magento\Shipping\Model\Rate\Request|null + * @var \Magento\Sales\Model\Quote\Address\RateRequest|null */ protected $_request = null; @@ -133,7 +133,7 @@ class Usps /** * @var \Magento\Catalog\Model\Resource\Product\CollectionFactory */ - protected $_productCollFactory; + protected $_productCollectionFactory; /** * @var \Zend_Http_ClientFactory @@ -142,11 +142,11 @@ class Usps /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory - * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory + * @param \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory * @param \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory * @param \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory * @param \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory @@ -155,7 +155,7 @@ class Usps * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Directory\Helper\Data $directoryData * @param \Magento\Usa\Helper\Data $usaData - * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory + * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Zend_Http_ClientFactory $httpClientFactory * @param array $data * @@ -163,11 +163,11 @@ class Usps */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Sales\Model\Quote\Address\RateResult\ErrorFactory $rateErrorFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, - \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, + \Magento\Sales\Model\Quote\Address\RateResult\MethodFactory $rateMethodFactory, \Magento\Shipping\Model\Tracking\ResultFactory $trackFactory, \Magento\Shipping\Model\Tracking\Result\ErrorFactory $trackErrorFactory, \Magento\Shipping\Model\Tracking\Result\StatusFactory $trackStatusFactory, @@ -176,12 +176,12 @@ class Usps \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Directory\Helper\Data $directoryData, \Magento\Usa\Helper\Data $usaData, - \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Zend_Http_ClientFactory $httpClientFactory, array $data = array() ) { $this->_usaData = $usaData; - $this->_productCollFactory = $productCollFactory; + $this->_productCollectionFactory = $productCollectionFactory; $this->_httpClientFactory = $httpClientFactory; parent::__construct( $coreStoreConfig, @@ -204,10 +204,10 @@ class Usps /** * Collect and get rates * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Shipping\Model\Rate\Result|bool|null */ - public function collectRates(\Magento\Shipping\Model\Rate\Request $request) + public function collectRates(\Magento\Sales\Model\Quote\Address\RateRequest $request) { if (!$this->getConfigFlag($this->_activeFlag)) { return false; @@ -225,10 +225,10 @@ class Usps /** * Prepare and set request to this instance * - * @param \Magento\Shipping\Model\Rate\Request $request + * @param \Magento\Sales\Model\Quote\Address\RateRequest $request * @return \Magento\Usa\Model\Shipping\Carrier\Usps */ - public function setRequest(\Magento\Shipping\Model\Rate\Request $request) + public function setRequest(\Magento\Sales\Model\Quote\Address\RateRequest $request) { $this->_request = $request; @@ -300,7 +300,7 @@ class Usps $r->setOrigPostal($request->getOrigPostcode()); } else { $r->setOrigPostal($this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_ZIP, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP, $request->getStoreId() )); } @@ -309,7 +309,7 @@ class Usps $r->setOrigCountryId($request->getOrigCountryId()); } else { $r->setOrigCountryId($this->_coreStoreConfig->getConfig( - \Magento\Shipping\Model\Shipping::XML_PATH_STORE_COUNTRY_ID, + \Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId() )); } @@ -1738,7 +1738,7 @@ class Usps $productIds[]= $item->getProductId(); } - $productCollection = $this->_productCollFactory + $productCollection = $this->_productCollectionFactory ->create() ->addStoreFilter($request->getStoreId()) ->addFieldToFilter('entity_id', array('in' => $productIds)) diff --git a/app/code/Magento/Usa/etc/module.xml b/app/code/Magento/Usa/etc/module.xml index c93192c3006..23a9af0b53c 100755 --- a/app/code/Magento/Usa/etc/module.xml +++ b/app/code/Magento/Usa/etc/module.xml @@ -36,6 +36,7 @@ <module name="Magento_Core"/> <module name="Magento_Catalog"/> <module name="Magento_Paypal"/> + <module name="Magento_Sales"/> </depends> </module> </config> diff --git a/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php b/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php index 2ede053f75e..8f506ed93b2 100644 --- a/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php +++ b/app/code/Magento/User/data/user_setup/data-upgrade-1.6.1.1-1.6.1.2.php @@ -117,7 +117,6 @@ $map = array( 'admin/newsletter/subscriber' => 'Magento_Newsletter::subscriber', 'admin/newsletter/template' => 'Magento_Newsletter::template', 'admin/system/config/oauth' => 'Magento_Oauth::oauth', - 'admin/page_cache' => 'Magento_PageCache::page_cache', 'admin/system/config/payment' => 'Magento_Payment::payment', 'admin/system/config/payment_services' => 'Magento_Payment::payment_services', 'admin/report/salesroot/paypal_settlement_reports/fetch' => 'Magento_Paypal::fetch', diff --git a/app/code/Magento/User/etc/module.xml b/app/code/Magento/User/etc/module.xml index cafd12253c2..6a867c9e3ba 100755 --- a/app/code/Magento/User/etc/module.xml +++ b/app/code/Magento/User/etc/module.xml @@ -51,7 +51,6 @@ <module name="Magento_ImportExport"/> <module name="Magento_Index"/> <module name="Magento_Integration"/> - <module name="Magento_PageCache"/> <module name="Magento_Payment"/> <module name="Magento_Paypal"/> <module name="Magento_Persistent"/> @@ -65,6 +64,8 @@ <module name="Magento_Tax"/> <module name="Magento_Widget"/> <module name="Magento_Wishlist"/> + <module name="Magento_Email"/> + <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php index a751a19d9cb..a750b81667f 100644 --- a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php +++ b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php @@ -46,7 +46,7 @@ class Webapi extends \Magento\Backend\Block\Widget\Form\Generic * * @var \Magento\User\Model\Resource\Rules\CollectionFactory */ - protected $_rulesCollFactory; + protected $_rulesCollectionFactory; /** * Acl resource provider @@ -71,7 +71,7 @@ class Webapi extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\Acl\RootResource $rootResource - * @param \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollFactory + * @param \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory * @param \Magento\Acl\Resource\ProviderInterface $aclResourceProvider * @param \Magento\Webapi\Helper\Data $webapiData * @param \Magento\Integration\Helper\Data $integrationData @@ -82,14 +82,14 @@ class Webapi extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\Acl\RootResource $rootResource, - \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollFactory, + \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollectionFactory, \Magento\Acl\Resource\ProviderInterface $aclResourceProvider, \Magento\Webapi\Helper\Data $webapiData, \Magento\Integration\Helper\Data $integrationData, array $data = array() ) { $this->_rootResource = $rootResource; - $this->_rulesCollFactory = $rulesCollFactory; + $this->_rulesCollectionFactory = $rulesCollectionFactory; $this->_aclResourceProvider = $aclResourceProvider; $this->_webapiData = $webapiData; $this->_integrationData = $integrationData; diff --git a/app/code/Magento/Webapi/Controller/ErrorProcessor.php b/app/code/Magento/Webapi/Controller/ErrorProcessor.php index 19eff57391a..352221dec66 100644 --- a/app/code/Magento/Webapi/Controller/ErrorProcessor.php +++ b/app/code/Magento/Webapi/Controller/ErrorProcessor.php @@ -51,7 +51,7 @@ class ErrorProcessor /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -66,19 +66,19 @@ class ErrorProcessor * @param \Magento\Core\Helper\Data $helper * @param \Magento\Core\Model\App $app * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Core\Helper\Data $helper, \Magento\Core\Model\App $app, \Magento\Logger $logger, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_coreHelper = $helper; $this->_app = $app; $this->_logger = $logger; $this->_filesystem = $filesystem; - $this->directoryWrite = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $this->directoryWrite = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $this->registerShutdownFunction(); } diff --git a/app/code/Magento/Webapi/Model/Soap/Config.php b/app/code/Magento/Webapi/Model/Soap/Config.php index 241eb65c162..2cc8a36e6da 100644 --- a/app/code/Magento/Webapi/Model/Soap/Config.php +++ b/app/code/Magento/Webapi/Model/Soap/Config.php @@ -67,16 +67,16 @@ class Config /** * @param \Magento\ObjectManager $objectManager - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Webapi\Model\Config $config */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Webapi\Model\Config $config ) { // TODO: Check if Service specific XSD is already cached - $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $this->_config = $config; $this->_objectManager = $objectManager; } diff --git a/app/code/Magento/Webapi/etc/module.xml b/app/code/Magento/Webapi/etc/module.xml index 3f7484e2e23..3b79d755c30 100755 --- a/app/code/Magento/Webapi/etc/module.xml +++ b/app/code/Magento/Webapi/etc/module.xml @@ -37,6 +37,7 @@ <module name="Magento_Service"/> <module name="Magento_Backend"/> <module name="Magento_User"/> + <module name="Magento_Authz"/> </depends> </module> </config> diff --git a/app/code/Magento/Weee/Model/Observer.php b/app/code/Magento/Weee/Model/Observer.php index 9b74c9952f6..7ddee5c048e 100644 --- a/app/code/Magento/Weee/Model/Observer.php +++ b/app/code/Magento/Weee/Model/Observer.php @@ -159,7 +159,7 @@ class Observer extends \Magento\Core\Model\AbstractModel '_front_fieldset', ), 'disabled_types' => array( - \Magento\Catalog\Model\Product\Type::TYPE_GROUPED, + \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE, ) ); @@ -184,7 +184,7 @@ class Observer extends \Magento\Core\Model\AbstractModel if (!$object->getApplyTo()) { $applyTo = array(); foreach ($this->_productType->getOptions() as $option) { - if ($option['value'] == \Magento\Catalog\Model\Product\Type::TYPE_GROUPED) { + if ($option['value'] == \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) { continue; } $applyTo[] = $option['value']; diff --git a/app/code/Magento/Weee/etc/module.xml b/app/code/Magento/Weee/etc/module.xml index 0f4adb9404d..6d8f60b135c 100644 --- a/app/code/Magento/Weee/etc/module.xml +++ b/app/code/Magento/Weee/etc/module.xml @@ -41,6 +41,7 @@ <module name="Magento_Customer"/> <module name="Magento_Bundle"/> <module name="Magento_Theme"/> + <module name="Magento_GroupedProduct"/> </depends> </module> </config> diff --git a/app/code/Magento/Widget/Model/Config/FileResolver.php b/app/code/Magento/Widget/Model/Config/FileResolver.php index cea2f2f515b..d161adbc593 100644 --- a/app/code/Magento/Widget/Model/Config/FileResolver.php +++ b/app/code/Magento/Widget/Model/Config/FileResolver.php @@ -50,17 +50,17 @@ class FileResolver implements \Magento\Config\FileResolverInterface protected $modulesDirectory; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Module\Dir\Reader $moduleReader * @param \Magento\Config\FileIteratorFactory $iteratorFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Module\Dir\Reader $moduleReader, \Magento\Config\FileIteratorFactory $iteratorFactory ) { - $this->themesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::THEMES); - $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + $this->themesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::THEMES_DIR); + $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $this->iteratorFactory = $iteratorFactory; $this->_moduleReader = $moduleReader; } diff --git a/app/code/Magento/Widget/Model/Widget/Instance.php b/app/code/Magento/Widget/Model/Widget/Instance.php index 50d5cfb4fac..35083273dab 100644 --- a/app/code/Magento/Widget/Model/Widget/Instance.php +++ b/app/code/Magento/Widget/Model/Widget/Instance.php @@ -123,7 +123,7 @@ class Instance extends \Magento\Core\Model\AbstractModel * @param \Magento\Widget\Model\Widget $widgetModel * @param \Magento\Widget\Model\NamespaceResolver $namespaceResolver * @param \Magento\Math\Random $mathRandom - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $relatedCacheTypes @@ -140,7 +140,7 @@ class Instance extends \Magento\Core\Model\AbstractModel \Magento\Widget\Model\Widget $widgetModel, \Magento\Widget\Model\NamespaceResolver $namespaceResolver, \Magento\Math\Random $mathRandom, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $relatedCacheTypes = array(), @@ -154,7 +154,7 @@ class Instance extends \Magento\Core\Model\AbstractModel $this->_reader = $reader; $this->_widgetModel = $widgetModel; $this->mathRandom = $mathRandom; - $this->_directory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->_directory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->_namespaceResolver = $namespaceResolver; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } diff --git a/app/code/Magento/Wishlist/Block/AbstractBlock.php b/app/code/Magento/Wishlist/Block/AbstractBlock.php index 8bfe5c72d61..8cc3a75b58c 100644 --- a/app/code/Magento/Wishlist/Block/AbstractBlock.php +++ b/app/code/Magento/Wishlist/Block/AbstractBlock.php @@ -75,6 +75,7 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -92,7 +93,8 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_customerSession = $customerSession; $this->_productFactory = $productFactory; @@ -108,8 +110,10 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd $compareProduct, $layoutHelper, $imageHelper, - $data + $data, + $priceBlockTypes ); + $this->_isScopePrivate = true; } /** @@ -189,15 +193,15 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd } /** - * Retrieve URL for Removing item from wishlist + * Retrieve params for Removing item from wishlist * * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item * * @return string */ - public function getItemRemoveUrl($item) + public function getItemRemoveParams($item) { - return $this->_getHelper()->getRemoveUrl($item); + return $this->_getHelper()->getRemoveParams($item); } /** @@ -223,14 +227,14 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd } /** - * Retrieve URL for adding Product to wishlist + * Retrieve params for adding Product to wishlist * * @param \Magento\Catalog\Model\Product $product * @return string */ - public function getAddToWishlistUrl($product) + public function getAddToWishlistParams($product) { - return $this->_getHelper()->getAddUrl($product); + return $this->_getHelper()->getAddParams($product); } /** @@ -242,17 +246,9 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd */ public function getItemConfigureUrl($product) { - if ($product instanceof \Magento\Catalog\Model\Product) { - $id = $product->getWishlistItemId(); - } else { - $id = $product->getId(); - } - $params = array('id' => $id); - - return $this->getUrl('wishlist/index/configure/', $params); + return $this->_getHelper()->getConfigureUrl($product); } - /** * Retrieve Escaped Description for Wishlist Item * diff --git a/app/code/Magento/Wishlist/Block/Customer/Sharing.php b/app/code/Magento/Wishlist/Block/Customer/Sharing.php index 25153a7b78e..f7c6aa1ecc9 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Sharing.php +++ b/app/code/Magento/Wishlist/Block/Customer/Sharing.php @@ -70,6 +70,7 @@ class Sharing extends \Magento\View\Element\Template $this->_wishlistConfig = $wishlistConfig; $this->_wishlistSession = $wishlistSession; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php index a45e56fa7cd..89a3ee50018 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php @@ -36,6 +36,11 @@ namespace Magento\Wishlist\Block\Customer; class Wishlist extends \Magento\Wishlist\Block\AbstractBlock { + /* + * List of product options rendering configurations by product type + */ + protected $_optionsCfg = array(); + /** * @var \Magento\Catalog\Helper\Product\ConfigurationPool */ @@ -63,6 +68,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param \Magento\Data\Form\FormKey $formKey * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -82,7 +88,8 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, \Magento\Data\Form\FormKey $formKey, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_formKey = $formKey; $this->_helperPool = $helperPool; @@ -100,7 +107,8 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $imageHelper, $customerSession, $productFactory, - $data + $data, + $priceBlockTypes ); } @@ -226,9 +234,9 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $template = $cfgDefault['template']; } - return $block->setTemplate($template) - ->setOptionList($this->_helperPool($cfg['helper'])->getOptions($item)) - ->toHtml(); + $block->setTemplate($template); + $block->setOptionList($this->_helperPool->get($cfg['helper'])->getOptions($item)); + return $block->toHtml(); } /** diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Button.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Button.php index 5684fa093ae..e1727df8a30 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Button.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Button.php @@ -64,6 +64,7 @@ class Button extends \Magento\View\Element\Template $this->_wishlistData = $wishlistData; $this->_wishlistConfig = $wishlistConfig; parent::__construct($context, $data); + $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php index fc4b5c5d0b3..1e1b7998712 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php @@ -40,6 +40,16 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock */ protected $_helperPool; + /** + * List of product options rendering configurations by product type + * + * @var array + */ + protected $_optionsCfg = array('default' => array( + 'helper' => 'Magento\Catalog\Helper\Product\Configuration', + 'template' => 'Magento_Wishlist::options_list.phtml' + )); + /** * @param \Magento\View\Element\Template\Context $context * @param \Magento\Catalog\Model\Config $catalogConfig @@ -56,6 +66,7 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -74,7 +85,8 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_helperPool = $helperPool; parent::__construct( @@ -91,20 +103,11 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock $imageHelper, $customerSession, $productFactory, - $data + $data, + $priceBlockTypes ); } - /** - * List of product options rendering configurations by product type - * - * @var array - */ - protected $_optionsCfg = array('default' => array( - 'helper' => 'Magento\Catalog\Helper\Product\Configuration', - 'template' => 'Magento_Wishlist::options_list.phtml' - )); - /** * Initialize block */ diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Items.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Items.php index 240f969fb60..c8c09dc9f54 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Items.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Items.php @@ -35,6 +35,18 @@ namespace Magento\Wishlist\Block\Customer\Wishlist; class Items extends \Magento\View\Element\Template { + + /** + * @param \Magento\View\Element\Template\Context $context + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + array $data = array() + ) { + parent::__construct($context, $data); + $this->_isScopePrivate = true; + } /** * Retrieve table column object list * diff --git a/app/code/Magento/Wishlist/Block/Item/Configure.php b/app/code/Magento/Wishlist/Block/Item/Configure.php index 9488bf4a0f4..3caca11ad0d 100644 --- a/app/code/Magento/Wishlist/Block/Item/Configure.php +++ b/app/code/Magento/Wishlist/Block/Item/Configure.php @@ -77,6 +77,16 @@ class Configure extends \Magento\View\Element\Template return $this->_coreRegistry->registry('product'); } + /** + * Get update params for http post + * + * @return bool|string + */ + public function getUpdateParams() + { + return $this->_wishlistData->getUpdateParams($this->getWishlistItem()); + } + /** * Returns wishlist item being configured * diff --git a/app/code/Magento/Wishlist/Block/Share/Wishlist.php b/app/code/Magento/Wishlist/Block/Share/Wishlist.php index 9611badb152..c8a56f5337b 100644 --- a/app/code/Magento/Wishlist/Block/Share/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Share/Wishlist.php @@ -64,6 +64,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param array $data + * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -82,7 +83,8 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, - array $data = array() + array $data = array(), + array $priceBlockTypes = array() ) { $this->_customerFactory = $customerFactory; parent::__construct( @@ -99,7 +101,8 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $imageHelper, $customerSession, $productFactory, - $data + $data, + $priceBlockTypes ); } diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php index 29465301b4e..d281688e482 100644 --- a/app/code/Magento/Wishlist/Controller/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index.php @@ -204,7 +204,15 @@ class Index $session = $this->_objectManager->get('Magento\Customer\Model\Session'); - $productId = (int) $this->getRequest()->getParam('product'); + $requestParams = $this->getRequest()->getParams(); + + if ($session->getBeforeWishlistRequest()) { + $requestParams = $session->getBeforeWishlistRequest(); + $session->unsBeforeWishlistRequest(); + } + + $productId = isset($requestParams['product']) ? (int) $requestParams['product'] : null; + if (!$productId) { $this->_redirect('*/'); return; @@ -218,11 +226,6 @@ class Index } try { - $requestParams = $this->getRequest()->getParams(); - if ($session->getBeforeWishlistRequest()) { - $requestParams = $session->getBeforeWishlistRequest(); - $session->unsBeforeWishlistRequest(); - } $buyRequest = new \Magento\Object($requestParams); $result = $wishlist->addNewItem($product, $buyRequest); @@ -798,7 +801,7 @@ class Index try { $info = unserialize($option->getValue()); - $filePath = $this->_objectManager->get('Magento\Filesystem')->getPath(\Magento\Filesystem::ROOT) + $filePath = $this->_objectManager->get('Magento\App\Filesystem')->getPath(\Magento\App\Filesystem::ROOT_DIR) . $info['quote_path']; $secretKey = $this->getRequest()->getParam('key'); @@ -809,7 +812,7 @@ class Index 'value' => $filePath, 'type' => 'filename' ), - \Magento\Filesystem::ROOT + \Magento\App\Filesystem::ROOT_DIR ); } diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index 95820f212a7..e3db7e1738c 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -110,6 +110,11 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected $_storeManager; + /** + * @var \Magento\Core\Helper\PostData + */ + protected $_postDataHelper; + /** * @param \Magento\App\Helper\Context $context * @param \Magento\Core\Helper\Data $coreData @@ -118,6 +123,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Helper\PostData $postDataHelper */ public function __construct( \Magento\App\Helper\Context $context, @@ -126,7 +132,8 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Customer\Model\Session $customerSession, \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Helper\PostData $postDataHelper ) { $this->_coreRegistry = $coreRegistry; $this->_coreData = $coreData; @@ -134,6 +141,7 @@ class Data extends \Magento\App\Helper\AbstractHelper $this->_customerSession = $customerSession; $this->_wishlistFactory = $wishlistFactory; $this->_storeManager = $storeManager; + $this->_postDataHelper = $postDataHelper; parent::__construct($context); } @@ -274,20 +282,20 @@ class Data extends \Magento\App\Helper\AbstractHelper } /** - * Retrieve URL for removing item from wishlist + * Retrieve params for removing item from wishlist * * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item * @return string */ - public function getRemoveUrl($item) + public function getRemoveParams($item) { - return $this->_getUrl('wishlist/index/remove', - array('item' => $item->getWishlistItemId()) - ); + $url = $this->_getUrl('wishlist/index/remove'); + $params = array('item' => $item->getWishlistItemId()); + return $this->_postDataHelper->getPostData($url, $params); } /** - * Retrieve URL for removing item from wishlist + * Retrieve URL for configuring item from wishlist * * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item * @return string @@ -295,79 +303,75 @@ class Data extends \Magento\App\Helper\AbstractHelper public function getConfigureUrl($item) { return $this->_getUrl('wishlist/index/configure', array( - 'item' => $item->getWishlistItemId() + 'id' => $item->getWishlistItemId() )); } /** - * Retrieve url for adding product to wishlist + * Retrieve params for adding product to wishlist * * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item - * - * @return string|bool + * @param array $params + * @return array */ - public function getAddUrl($item) + public function getAddParams($item, array $params = array()) { - return $this->getAddUrlWithParams($item); + $productId = null; + if ($item instanceof \Magento\Catalog\Model\Product) { + $productId = $item->getEntityId(); + } + if ($item instanceof \Magento\Wishlist\Model\Item) { + $productId = $item->getProductId(); + } + + $url = $this->_getUrlStore($item)->getUrl('wishlist/index/add'); + if ($productId) { + $params['product'] = $productId; + } + + return $this->_postDataHelper->getPostData($url, $params); } /** - * Retrieve url for adding product to wishlist + * Retrieve params for adding product to wishlist * * @param int $itemId * - * @return string + * @return string */ - public function getMoveFromCartUrl($itemId) + public function getMoveFromCartParams($itemId) { - return $this->_getUrl('wishlist/index/fromcart', array('item' => $itemId)); + $url = $this->_getUrl('wishlist/index/fromcart'); + $params = array('item' => $itemId); + return $this->_postDataHelper->getPostData($url, $params); } /** - * Retrieve url for updating product in wishlist + * Retrieve params for updating product in wishlist * * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item * * @return string|bool */ - public function getUpdateUrl($item) + public function getUpdateParams($item) { $itemId = null; if ($item instanceof \Magento\Catalog\Model\Product) { $itemId = $item->getWishlistItemId(); + $productId = $item->getId(); } if ($item instanceof \Magento\Wishlist\Model\Item) { $itemId = $item->getId(); + $productId = $item->getProduct()->getId(); } + $url = $this->_getUrl('wishlist/index/updateItemOptions'); if ($itemId) { - return $this->_getUrl('wishlist/index/updateItemOptions', array('id' => $itemId)); - } - - return false; - } - - /** - * Retrieve url for adding product to wishlist with params - * - * @param \Magento\Catalog\Model\Product|\Magento\Wishlist\Model\Item $item - * @param array $params - * - * @return string|bool - */ - public function getAddUrlWithParams($item, array $params = array()) - { - $productId = null; - if ($item instanceof \Magento\Catalog\Model\Product) { - $productId = $item->getEntityId(); - } - if ($item instanceof \Magento\Wishlist\Model\Item) { - $productId = $item->getProductId(); - } - - if ($productId) { - $params['product'] = $productId; - return $this->_getUrlStore($item)->getUrl('wishlist/index/add', $params); + $params = array( + 'id' => $itemId, + 'product' => $productId + ); + return $this->_postDataHelper->getPostData($url, $params); } return false; diff --git a/app/code/Magento/Wishlist/Model/Item.php b/app/code/Magento/Wishlist/Model/Item.php index ac837f37c69..9725b930f0e 100644 --- a/app/code/Magento/Wishlist/Model/Item.php +++ b/app/code/Magento/Wishlist/Model/Item.php @@ -129,7 +129,7 @@ class Item extends \Magento\Core\Model\AbstractModel /** * @var \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory */ - protected $_wishlOptCollFactory; + protected $_wishlOptionCollectionFactory; /** * @param \Magento\Core\Model\Context $context @@ -139,7 +139,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Resource\Url $catalogUrl * @param \Magento\Wishlist\Model\Item\OptionFactory $wishlistOptFactory - * @param \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $wishlOptCollFactory + * @param \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $wishlOptionCollectionFactory * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -152,7 +152,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Resource\Url $catalogUrl, \Magento\Wishlist\Model\Item\OptionFactory $wishlistOptFactory, - \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $wishlOptCollFactory, + \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $wishlOptionCollectionFactory, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -162,7 +162,7 @@ class Item extends \Magento\Core\Model\AbstractModel $this->_productFactory = $productFactory; $this->_catalogUrl = $catalogUrl; $this->_wishlistOptFactory = $wishlistOptFactory; - $this->_wishlOptCollFactory = $wishlOptCollFactory; + $this->_wishlOptionCollectionFactory = $wishlOptionCollectionFactory; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -724,7 +724,7 @@ class Item extends \Magento\Core\Model\AbstractModel public function canHaveQty() { $product = $this->getProduct(); - return $product->getTypeId() != \Magento\Catalog\Model\Product\Type\Grouped::TYPE_CODE; + return $product->getTypeId() != \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE; } /** @@ -775,7 +775,7 @@ class Item extends \Magento\Core\Model\AbstractModel return $this; } - $options = $this->_wishlOptCollFactory->create()->addItemFilter($this); + $options = $this->_wishlOptionCollectionFactory->create()->addItemFilter($this); if ($optionsFilter) { $options->addFieldToFilter('code', $optionsFilter); } diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php index f4d7ba1a7b8..218f7d8f516 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php @@ -134,12 +134,12 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * @var \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory */ - protected $_optionCollFactory; + protected $_optionCollectionFactory; /** * @var \Magento\Catalog\Model\Resource\Product\CollectionFactory */ - protected $_productCollFactory; + protected $_productCollectionFactory; /** * @var \Magento\Catalog\Model\Resource\ConfigFactory @@ -168,8 +168,8 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\App\Resource $coreResource - * @param \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollFactory - * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory + * @param \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollectionFactory + * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Catalog\Model\Resource\ConfigFactory $catalogConfFactory * @param \Magento\Catalog\Model\Entity\AttributeFactory $catalogAttrFactory * @param \Magento\Wishlist\Model\Resource\Item $resource @@ -190,8 +190,8 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Wishlist\Model\Config $wishlistConfig, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\App\Resource $coreResource, - \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollFactory, - \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, + \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollectionFactory, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Resource\ConfigFactory $catalogConfFactory, \Magento\Catalog\Model\Entity\AttributeFactory $catalogAttrFactory, \Magento\Wishlist\Model\Resource\Item $resource, @@ -205,8 +205,8 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl $this->_wishlistConfig = $wishlistConfig; $this->_productVisibility = $productVisibility; $this->_coreResource = $coreResource; - $this->_optionCollFactory = $optionCollFactory; - $this->_productCollFactory = $productCollFactory; + $this->_optionCollectionFactory = $optionCollectionFactory; + $this->_productCollectionFactory = $productCollectionFactory; $this->_catalogConfFactory = $catalogConfFactory; $this->_catalogAttrFactory = $catalogAttrFactory; $this->_appState = $appState; @@ -254,7 +254,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl { $itemIds = array_keys($this->_items); /* @var $optionCollection \Magento\Wishlist\Model\Resource\Item\Option\Collection */ - $optionCollection = $this->_optionCollFactory->create(); + $optionCollection = $this->_optionCollectionFactory->create(); $optionCollection->addItemFilter($itemIds); /* @var $item \Magento\Wishlist\Model\Item */ @@ -293,7 +293,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl $this->_productIds = array_merge($this->_productIds, array_keys($productIds)); $attributes = $this->_wishlistConfig->getProductAttributes(); /** @var \Magento\Catalog\Model\Resource\Product\Collection $productCollection */ - $productCollection = $this->_productCollFactory->create(); + $productCollection = $this->_productCollectionFactory->create(); foreach ($storeIds as $id) { $productCollection->addStoreFilter($id); } diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php b/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php index dc50e6a2c52..6452dba2f73 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Collection/Grid.php @@ -48,8 +48,8 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\App\Resource $coreResource - * @param \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollFactory - * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory + * @param \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollectionFactory + * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Catalog\Model\Resource\ConfigFactory $catalogConfFactory * @param \Magento\Catalog\Model\Entity\AttributeFactory $catalogAttrFactory * @param \Magento\Wishlist\Model\Resource\Item $resource @@ -71,8 +71,8 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection \Magento\Wishlist\Model\Config $wishlistConfig, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\App\Resource $coreResource, - \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollFactory, - \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, + \Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory $optionCollectionFactory, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Resource\ConfigFactory $catalogConfFactory, \Magento\Catalog\Model\Entity\AttributeFactory $catalogAttrFactory, \Magento\Wishlist\Model\Resource\Item $resource, @@ -93,8 +93,8 @@ class Grid extends \Magento\Wishlist\Model\Resource\Item\Collection $wishlistConfig, $productVisibility, $coreResource, - $optionCollFactory, - $productCollFactory, + $optionCollectionFactory, + $productCollectionFactory, $catalogConfFactory, $catalogAttrFactory, $resource, diff --git a/app/code/Magento/Wishlist/Model/Wishlist.php b/app/code/Magento/Wishlist/Model/Wishlist.php index dacbdfab1f7..56ae6b995f0 100644 --- a/app/code/Magento/Wishlist/Model/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Wishlist.php @@ -99,7 +99,7 @@ class Wishlist extends \Magento\Core\Model\AbstractModel /** * @var \Magento\Wishlist\Model\Resource\Item\CollectionFactory */ - protected $_wishlistCollFactory; + protected $_wishlistCollectionFactory; /** * @var \Magento\Catalog\Model\ProductFactory @@ -131,7 +131,7 @@ class Wishlist extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Date $date * @param ItemFactory $wishlistItemFactory - * @param Resource\Item\CollectionFactory $wishlistCollFactory + * @param Resource\Item\CollectionFactory $wishlistCollectionFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Math\Random $mathRandom * @param \Magento\Stdlib\DateTime $dateTime @@ -148,7 +148,7 @@ class Wishlist extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Date $date, \Magento\Wishlist\Model\ItemFactory $wishlistItemFactory, - \Magento\Wishlist\Model\Resource\Item\CollectionFactory $wishlistCollFactory, + \Magento\Wishlist\Model\Resource\Item\CollectionFactory $wishlistCollectionFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Math\Random $mathRandom, \Magento\Stdlib\DateTime $dateTime, @@ -161,7 +161,7 @@ class Wishlist extends \Magento\Core\Model\AbstractModel $this->_storeManager = $storeManager; $this->_date = $date; $this->_wishlistItemFactory = $wishlistItemFactory; - $this->_wishlistCollFactory = $wishlistCollFactory; + $this->_wishlistCollectionFactory = $wishlistCollectionFactory; $this->_productFactory = $productFactory; $this->mathRandom = $mathRandom; $this->dateTime = $dateTime; @@ -323,7 +323,7 @@ class Wishlist extends \Magento\Core\Model\AbstractModel public function getItemCollection() { if (is_null($this->_itemCollection)) { - $this->_itemCollection = $this->_wishlistCollFactory->create() + $this->_itemCollection = $this->_wishlistCollectionFactory->create() ->addWishlistFilter($this) ->addStoreFilter($this->getSharedStoreIds()) ->setVisibilityFilter(); diff --git a/app/code/Magento/Wishlist/etc/module.xml b/app/code/Magento/Wishlist/etc/module.xml index b1e8a3f5dda..8857673b4a1 100755 --- a/app/code/Magento/Wishlist/etc/module.xml +++ b/app/code/Magento/Wishlist/etc/module.xml @@ -39,6 +39,9 @@ <module name="Magento_Tax"/> <module name="Magento_Backend"/> <module name="Magento_Bundle" type="soft"/> + <module name="Magento_Email"/> + <module name="Magento_Sales"/> + <module name="Magento_GroupedProduct"/> </depends> </module> </config> diff --git a/app/code/Magento/Wishlist/view/frontend/item/column/remove.phtml b/app/code/Magento/Wishlist/view/frontend/item/column/remove.phtml index 8849c01780e..a5b50a11672 100644 --- a/app/code/Magento/Wishlist/view/frontend/item/column/remove.phtml +++ b/app/code/Magento/Wishlist/view/frontend/item/column/remove.phtml @@ -24,6 +24,6 @@ */ ?> -<a href="<?php echo $this->getItemRemoveUrl($this->getItem()); ?>" title="<?php echo __('Remove Item') ?>" class="action delete"> +<a href="#" data-post-remove='<?php echo $this->getItemRemoveParams($this->getItem()); ?>' title="<?php echo __('Remove Item') ?>" class="btn-remove action delete"> <span><?php echo __('Remove item');?></span> </a> diff --git a/app/code/Magento/Wishlist/view/frontend/item/configure/addto.phtml b/app/code/Magento/Wishlist/view/frontend/item/configure/addto.phtml index 4c3e1f6668f..7f0d79b0a73 100644 --- a/app/code/Magento/Wishlist/view/frontend/item/configure/addto.phtml +++ b/app/code/Magento/Wishlist/view/frontend/item/configure/addto.phtml @@ -24,11 +24,9 @@ */ ?> -<?php $_wishlistItem = $this->getWishlistItem(); ?> -<?php $_wishlistSubmitUrl = $this->helper('Magento\Wishlist\Helper\Data')->getUpdateUrl($_wishlistItem); ?> <div class="product addto links" data-role="add-to-links"> <?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> - <a href="<?php echo $_wishlistSubmitUrl ?>" class="action towishlist updated"> + <a href="#" data-post='<?php echo $this->getUpdateParams(); ?>' class="action towishlist updated" data-action="add-to-wishlist"> <span><?php echo __('Update Wish List') ?></span> </a> <?php endif; ?> @@ -40,3 +38,10 @@ </a> <?php endif; ?> </div> +<script type="text/javascript"> + head.js("<?php echo $this->getViewFileUrl('Magento_Wishlist::js/add-to-wishlist.js') ?>", function () { + jQuery('.product.info.main').addToWishlist( + <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode(array('productType' => $_product->getTypeId()))?> + ); + }); +</script> \ No newline at end of file diff --git a/app/code/Magento/Wishlist/view/frontend/js/add-to-wishlist.js b/app/code/Magento/Wishlist/view/frontend/js/add-to-wishlist.js index 39aecb25cd2..17518edf38f 100644 --- a/app/code/Magento/Wishlist/view/frontend/js/add-to-wishlist.js +++ b/app/code/Magento/Wishlist/view/frontend/js/add-to-wishlist.js @@ -31,20 +31,24 @@ customOptionsInfo: '.product-custom-option' }, _create: function () { - this.addToWishlist(); + this._bind(); }, - addToWishlist: function () { - this._on({ - 'click [data-action="add-to-wishlist"]': function (event) { - var url = $(event.target).closest('a').attr('href'), - productInfo = this.options[this.options.productType + 'Info'], - additionalData = $(this.options.customOptionsInfo).serialize(); - if (productInfo !== undefined) { - additionalData += $(productInfo).serialize(); - } - $(event.target).closest('a').attr('href', url + (url.indexOf('?') == -1 ? '?' : '&') + additionalData); - } + _bind: function() { + var changeCustomOption = 'change ' + this.options.customOptionsInfo, + changeProductInfo = 'change ' + this.options[this.options.productType + 'Info'], + events = {}; + events[changeCustomOption] = '_updateWishlistData'; + events[changeProductInfo] = '_updateWishlistData'; + this._on(events); + }, + _updateWishlistData: function(event) { + var dataToAdd = {}; + dataToAdd[$(event.currentTarget).attr('name')] = $(event.currentTarget).val(); + $('[data-action="add-to-wishlist"]').each(function(index, element) { + var params = $(element).data('post'); + params.data = $.extend({}, params.data, dataToAdd); + $(element).data('post', params); }); } }); -})(jQuery); +})(jQuery); \ No newline at end of file diff --git a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_grouped.xml b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_grouped.xml index adf68a42692..1b3d0eb71b2 100644 --- a/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_grouped.xml +++ b/app/code/Magento/Wishlist/view/frontend/layout/wishlist_index_configure_type_grouped.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <referenceContainer name="product.info.form.content"> - <block class="Magento\Catalog\Block\Product\View\Type\Grouped" name="product.info.grouped" before="product.info.addtocart" template="product/view/type/grouped.phtml"/> + <block class="Magento\GroupedProduct\Block\Product\View\Type\Grouped" name="product.info.grouped" before="product.info.addtocart" template="product/view/type/grouped.phtml"/> <container name="product.info.grouped.extra" after="product.info.grouped" before="product.info.grouped" as="product_type_data_extra" label="Product Extra Info"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Wishlist/view/frontend/shared.phtml b/app/code/Magento/Wishlist/view/frontend/shared.phtml index 99f5b6dc5e2..1b541c3171f 100644 --- a/app/code/Magento/Wishlist/view/frontend/shared.phtml +++ b/app/code/Magento/Wishlist/view/frontend/shared.phtml @@ -57,7 +57,7 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im <?php echo $this->getDetailsHtml($item) ?> </td> <td class="col comment"><?php echo $this->getEscapedDescription($item) ?></td> - <td class="col actions"> + <td class="col actions" data-role="add-to-links"> <?php if ($product->isSaleable()): ?> <?php if ($isVisibleProduct): ?> <button type="button" title="<?php echo __('Add to Cart') ?>" onclick="setLocation('<?php echo $this->getSharedItemAddToCartUrl($item) ?>')" class="action tocart"> @@ -65,7 +65,7 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im </button> <?php endif ?> <?php endif; ?> - <a href="<?php echo $this->getAddToWishlistUrl($item) ?>" onclick="setLocation(this.href); return false;" class="action towishlist" data-action="add-to-wishlist"> + <a href="#" data-post='<?php echo $this->getAddToWishlistParams($item); ?>' onclick="setLocation(this.href); return false;" class="action towishlist" data-action="add-to-wishlist"> <span><?php echo __('Add to Wishlist') ?></span> </a> </td> diff --git a/app/code/Magento/Wishlist/view/frontend/sidebar.phtml b/app/code/Magento/Wishlist/view/frontend/sidebar.phtml index 2365b82842e..fec7ad14219 100644 --- a/app/code/Magento/Wishlist/view/frontend/sidebar.phtml +++ b/app/code/Magento/Wishlist/view/frontend/sidebar.phtml @@ -26,8 +26,9 @@ ?> <?php $count = $this->getItemCount(); +$wishlistHelper = $this->helper('Magento\Wishlist\Helper\Data'); ?> -<?php if ($this->helper('Magento\Wishlist\Helper\Data')->isAllow()) : ?> +<?php if ($wishlistHelper->isAllow()) : ?> <?php $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Image');?> <div class="block wishlist"> <div class="title"> @@ -54,10 +55,18 @@ $count = $this->getItemCount(); <?php echo $this->getPriceHtml($product, false, '-wishlist') ?> <div class="product actions"> <?php if ($product->isSaleable() && $product->isVisibleInSiteVisibility()): ?> - <div class="primary"><a href="<?php echo $this->getItemAddToCartUrl($_item) ?>" class="action tocart"><span><?php echo __('Add to Cart') ?></span></a></div> + <?php if ($product->getTypeInstance()->hasRequiredOptions($product)): ?> + <div class="primary"><a href="<?php echo $this->getItemAddToCartUrl($product) ?>" class="action tocart"><span><?php echo __('Add to Cart') ?></span></a></div> + <?php else: ?> + <?php + $postDataHelper = $this->helper('Magento\Core\Helper\PostData'); + $postData = $postDataHelper->getPostData($this->getItemAddToCartUrl($product), ['product' => $product->getEntityId()]) + ?> + <div class="primary"><button type="button" class="action tocart" data-post='<?php echo $postData; ?>'><span><?php echo __('Add to Cart') ?></span></button></div> + <?php endif; ?> <?php endif; ?> <div class="secondary"> - <a href="<?php echo $this->getItemRemoveUrl($_item) ?>" title="<?php echo __('Remove This Item') ?>" onclick="return confirm('<?php echo __('Are you sure you would like to remove this item from the wishlist?') ?>');" class="action delete"> + <a href="#" data-post='<?php echo $this->getItemRemoveParams($_item) ?>' title="<?php echo __('Remove This Item') ?>" class="btn-remove action delete"> <span><?php echo __('Remove This Item') ?></span> </a> </div> diff --git a/app/code/Magento/Wishlist/view/frontend/wishlist.js b/app/code/Magento/Wishlist/view/frontend/wishlist.js index f5973f8c55d..933537f6d0f 100644 --- a/app/code/Magento/Wishlist/view/frontend/wishlist.js +++ b/app/code/Magento/Wishlist/view/frontend/wishlist.js @@ -36,7 +36,8 @@ addToCartSelector: '.btn-cart', addAllToCartSelector: '.btn-add', commentInputType: 'textarea', - infoList: false + infoList: false, + confirmRemoveMessage: 'Are you sure you want to remove this product from your wishlist?' }, /** @@ -52,7 +53,11 @@ .on('addToCart', function(event, context) { $.proxy(_this._addItemsToCart($(context).parents('.cart-cell').find(_this.options.addToCartSelector)), _this); }) - .on('click', this.options.btnRemoveSelector, $.proxy(this._confirmRemoveWishlistItem, this)) + .on('click', this.options.btnRemoveSelector, $.proxy(function(event) { + if (this._confirmRemoveWishlistItem()) { + $.mage.dataPost().postData($(event.currentTarget).data('post-remove')); + } + }, this)) .on('click', this.options.addAllToCartSelector, $.proxy(this._addAllWItemsToCart, this)) .on('focusin focusout', this.options.commentInputType, $.proxy(this._focusComment, this)); } @@ -182,7 +187,7 @@ }); } }); - + // Extension for mage.wishlist - Add Wishlist item to Gift Registry $.widget('mage.wishlist', $.mage.wishlist, { options: { diff --git a/app/design/adminhtml/magento_backend/css/pages.css b/app/design/adminhtml/magento_backend/css/pages.css index ba9d1a2a10c..65783c2bace 100644 --- a/app/design/adminhtml/magento_backend/css/pages.css +++ b/app/design/adminhtml/magento_backend/css/pages.css @@ -1109,11 +1109,11 @@ } .order-billing-address, .order-billing-method, -[class^=" sales-order-"] .order-history, -[class^=" sales-order-"] .order-comments-history, -[class^=" sales-order-"] .order-information, -[class^=" sales-order-"] .order-billing-address, -[class^=" sales-order-"] .order-payment-method, +[class*="-order-"] .order-history, +[class*="-order-"] .order-comments-history, +[class*="-order-"] .order-information, +[class*="-order-"] .order-billing-address, +[class*="-order-"] .order-payment-method, [class^=" adminhtml-rma-"] .order-comments-history, [class^=" adminhtml-rma-"] .order-shipping-address, [class^=" adminhtml-rma-"] .rma-request-details { @@ -1122,11 +1122,11 @@ } .order-shipping-address, .order-shipping-method, -[class^=" sales-order-"] .order-totals, -[class^=" sales-order-"] .order-account-information, -[class^=" sales-order-"] .order-shipping-address, -[class^=" sales-order-"] .order-payment-method-virtual, -[class^=" sales-order-"] .order-shipping-method, +[class*="-order-"] .order-totals, +[class*="-order-"] .order-account-information, +[class*="-order-"] .order-shipping-address, +[class*="-order-"] .order-payment-method-virtual, +[class*="-order-"] .order-shipping-method, [class^=" adminhtml-rma-"] .rma-confirmation, [class^=" adminhtml-rma-"] .order-shipping-method, [class^=" adminhtml-rma-"] .order-return-address { @@ -1239,12 +1239,12 @@ float: none; width: 100%; } -[class^=" sales-order-"] .order-billing-address .actions, -[class^=" sales-order-"] .order-shipping-address .actions { +[class*="-order-"] .order-billing-address .actions, +[class*="-order-"] .order-shipping-address .actions { margin: 17px 0; } -[class^=" sales-order-"] .order-billing-address .control + label, -[class^=" sales-order-"] .order-shipping-address .control + label { +[class*="-order-"] .order-billing-address .control + label, +[class*="-order-"] .order-shipping-address .control + label { margin: 17px 0 0; } .sales-order-create-index .page-actions-inner .cancel, @@ -1509,15 +1509,15 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d /* Order view -------------------------------------- */ -[class^=" sales-order-"] .fieldset-wrapper-title .actions { +[class*="-order-"] .fieldset-wrapper-title .actions { float: right; font-size: 12px; margin: 8px 20px 0 0; } -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:link, -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:visited, -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:hover, -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:active { +[class*="-order-"] .fieldset-wrapper-title .actions a:link, +[class*="-order-"] .fieldset-wrapper-title .actions a:visited, +[class*="-order-"] .fieldset-wrapper-title .actions a:hover, +[class*="-order-"] .fieldset-wrapper-title .actions a:active { color: #a29c94; } .order-comments-history fieldset { @@ -1541,7 +1541,7 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d .order-comments-history .actions { float: right; } -[class^=" sales-order-"] .fieldset-wrapper address { +[class*="-order-"] .fieldset-wrapper address { overflow: auto; } /* @@ -1593,19 +1593,19 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d [class^=" sales-transactions-"] .col-id { width: 35px; } -[class^=" sales-order-shipment-"] .col-ship, +[class^=" adminhtml-order-shipment-"] .col-ship, [class^=" sales-"] .col-return-to-stock, .adminhtml-rma-new .col-select { text-align: center; width: 35px; } -[class^=" sales-order-"] .col-price-original, -[class^=" sales-order-"] .col-tax-amount, -[class^=" sales-order-"] .col-tax-percent, -[class^=" sales-order-"] .col-discont, -[class^=" sales-order-"] .col-total, -[class^=" sales-order-"] .col-discount, -[class^=" sales-order-"] .col-tax, +[class*="-order-"] .col-price-original, +[class*="-order-"] .col-tax-amount, +[class*="-order-"] .col-tax-percent, +[class*="-order-"] .col-discont, +[class*="-order-"] .col-total, +[class*="-order-"] .col-discount, +[class*="-order-"] .col-tax, [class^=" sales-"] .col-refunded, [class^=" adminhtml-rma-"] .col-order, [class^=" adminhtml-rma-"] .col-required, @@ -1617,8 +1617,8 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d white-space: nowrap; width: 50px; } -[class^=" sales-order-"] .col-subtotal, -[class^=" sales-order-"] .col-price, +[class*="-order-"] .col-subtotal, +[class*="-order-"] .col-price, [class^=" adminhtml-rma-"] .col-price { text-align: right; width: 50px; @@ -1637,8 +1637,8 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d width: 60px; } [class^=" sales-"] .col-qty, -[class^=" sales-order-"] .col-qty-invoice, -[class^=" sales-order-"] .col-ordered-qty, +[class*="-order-"] .col-qty-invoice, +[class*="-order-"] .col-ordered-qty, [class^=" adminhtml-rma-"] .col-qty, [class^=" adminhtml-rma-"] .col-condition { width: 70px; @@ -1687,14 +1687,14 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d [class^=" sales-"] tr.headings .col-transaction-type > span, [class^=" sales-"] tr.headings .col-gtbase > span, [class^=" sales-"] tr.headings .col-gtpurchased > span, -[class^=" sales-order-"] tr.headings .col-discont > span { +[class*="-order-"] tr.headings .col-discont > span { white-space: normal; } [class^=" sales-"] .col-period, [class^=" adminhtml-rma-"] .col-period { width: 150px; } -[class^=" sales-order-shipment-"] .col-carrier { +[class^=" adminhtml-order-shipment-"] .col-carrier { width: 190px; } .checkout-agreement-index .col-store-view { @@ -1718,48 +1718,48 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d padding-bottom: 4px; width: 100%; } -[class^=" sales-order-"] .order-totals .actions, +[class*="-order-"] .order-totals .actions, [class^=" adminhtml-rma-"] .col-qty, [class^=" adminhtml-rma-"] .col-qty_ordered, .sales-order-view .col-refunded { text-align: right; } -[class^=" sales-order-"] .col-price .label, -[class^=" sales-order-"] .col-subtotal .label { +[class*="-order-"] .col-price .label, +[class*="-order-"] .col-subtotal .label { display: inline-block; min-width: 60px; white-space: nowrap; } -[class^=" sales-order-"] .col-price .price-excl-tax .price, -[class^=" sales-order-"] .col-price .price-incl-tax .price, -[class^=" sales-order-"] .col-subtotal .price-excl-tax .price, -[class^=" sales-order-"] .col-subtotal .price-incl-tax .price { +[class*="-order-"] .col-price .price-excl-tax .price, +[class*="-order-"] .col-price .price-incl-tax .price, +[class*="-order-"] .col-subtotal .price-excl-tax .price, +[class*="-order-"] .col-subtotal .price-incl-tax .price { font-weight: bold; } -[class^=" sales-order-"] .grid .col-qty table, -[class^=" sales-order-"] .grid .col-qty tbody, -[class^=" sales-order-"] .grid .col-qty tr, -[class^=" sales-order-"] .grid .col-qty td, -[class^=" sales-order-"] .grid .col-ordered-qty table, -[class^=" sales-order-"] .grid .col-ordered-qty tbody, -[class^=" sales-order-"] .grid .col-ordered-qty tr, -[class^=" sales-order-"] .grid .col-ordered-qty td { +[class*="-order-"] .grid .col-qty table, +[class*="-order-"] .grid .col-qty tbody, +[class*="-order-"] .grid .col-qty tr, +[class*="-order-"] .grid .col-qty td, +[class*="-order-"] .grid .col-ordered-qty table, +[class*="-order-"] .grid .col-ordered-qty tbody, +[class*="-order-"] .grid .col-ordered-qty tr, +[class*="-order-"] .grid .col-ordered-qty td { background: none; border: 0; } -[class^=" sales-order-"] .col-ordered-qty td { +[class*="-order-"] .col-ordered-qty td { padding: 0 5px 3px; } -[class^=" sales-order-"] .grid .product-title { +[class*="-order-"] .grid .product-title { font-weight: bold; } -[class^=" sales-order-"] .item-options { +[class*="-order-"] .item-options { margin: 5px 0 5px 10px; } -[class^=" sales-order-"] .item-options dt { +[class*="-order-"] .item-options dt { font-weight: bold; } -[class^=" sales-order-"] .item-options dd { +[class*="-order-"] .item-options dd { margin: 0 0 0 10px; } .adminhtml-rma-item-attribute-edit .col-position input { @@ -1779,7 +1779,7 @@ table.items-to-invoice tbody tr:hover td { border: 0; text-align: center; } -[class^=" sales-order-creditmemo-"] .no-items { +[class~=" -order-creditmemo-"] .no-items { padding-top: 13px; text-align: center; } @@ -1787,17 +1787,17 @@ table.items-to-invoice tbody tr:hover td { color: #19a3d1; font-weight: bold; } -.sales-order-shipment-new .order-totals .fieldset-wrapper { +.adminhtml-order-shipment-new .order-totals .fieldset-wrapper { padding-top: 18px; } -.sales-order-shipment-new .actions { +.adminhtml-order-shipment-new .actions { float: right; } .creditmemo-totals .data-table input[type="text"] { text-align: right; width: 60px; } -[class^=" sales-order-"] .order-subtotal .label { +[class*="-order-"] .order-subtotal .label { width: 80%; } .adminhtml-rma-new .rma-confirmation .actions { @@ -1819,7 +1819,7 @@ table.items-to-invoice tbody tr:hover td { .adminhtml-rma-edit .data-table .col-number { width: 25%; } -[class^=" sales-order-"] .order-shipping-address .price, +[class*="-order-"] .order-shipping-address .price, .order-shipping-address .shipping-description-title { font-weight: bold; } @@ -2147,8 +2147,8 @@ table.items-to-invoice tbody tr:hover td { list-style: none; padding: 0; } -[class^=" sales-order-"] .order-billing-address .packaging-window .actions, -[class^=" sales-order-"] .order-shipping-address .packaging-window .actions { +[class*="-order-"] .order-billing-address .packaging-window .actions, +[class*="-order-"] .order-shipping-address .packaging-window .actions { margin: 0; } /* diff --git a/app/design/adminhtml/magento_backend/css/styles.css b/app/design/adminhtml/magento_backend/css/styles.css index 3387b22a778..8499e03e611 100644 --- a/app/design/adminhtml/magento_backend/css/styles.css +++ b/app/design/adminhtml/magento_backend/css/styles.css @@ -8901,11 +8901,11 @@ table .col-draggable .draggable-handle { } .order-billing-address, .order-billing-method, -[class^=" sales-order-"] .order-history, -[class^=" sales-order-"] .order-comments-history, -[class^=" sales-order-"] .order-information, -[class^=" sales-order-"] .order-billing-address, -[class^=" sales-order-"] .order-payment-method, +[class*="-order-"] .order-history, +[class*="-order-"] .order-comments-history, +[class*="-order-"] .order-information, +[class*="-order-"] .order-billing-address, +[class*="-order-"] .order-payment-method, [class^=" adminhtml-rma-"] .order-comments-history, [class^=" adminhtml-rma-"] .order-shipping-address, [class^=" adminhtml-rma-"] .rma-request-details { @@ -8914,11 +8914,11 @@ table .col-draggable .draggable-handle { } .order-shipping-address, .order-shipping-method, -[class^=" sales-order-"] .order-totals, -[class^=" sales-order-"] .order-account-information, -[class^=" sales-order-"] .order-shipping-address, -[class^=" sales-order-"] .order-payment-method-virtual, -[class^=" sales-order-"] .order-shipping-method, +[class*="-order-"] .order-totals, +[class*="-order-"] .order-account-information, +[class*="-order-"] .order-shipping-address, +[class*="-order-"] .order-payment-method-virtual, +[class*="-order-"] .order-shipping-method, [class^=" adminhtml-rma-"] .rma-confirmation, [class^=" adminhtml-rma-"] .order-shipping-method, [class^=" adminhtml-rma-"] .order-return-address { @@ -9031,12 +9031,12 @@ table .col-draggable .draggable-handle { float: none; width: 100%; } -[class^=" sales-order-"] .order-billing-address .actions, -[class^=" sales-order-"] .order-shipping-address .actions { +[class*="-order-"] .order-billing-address .actions, +[class*="-order-"] .order-shipping-address .actions { margin: 17px 0; } -[class^=" sales-order-"] .order-billing-address .control + label, -[class^=" sales-order-"] .order-shipping-address .control + label { +[class*="-order-"] .order-billing-address .control + label, +[class*="-order-"] .order-shipping-address .control + label { margin: 17px 0 0; } .sales-order-create-index .page-actions-inner .cancel, @@ -9294,15 +9294,15 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d /* Order view -------------------------------------- */ -[class^=" sales-order-"] .fieldset-wrapper-title .actions { +[class*="-order-"] .fieldset-wrapper-title .actions { float: right; font-size: 12px; margin: 8px 20px 0 0; } -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:link, -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:visited, -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:hover, -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:active { +[class*="-order-"] .fieldset-wrapper-title .actions a:link, +[class*="-order-"] .fieldset-wrapper-title .actions a:visited, +[class*="-order-"] .fieldset-wrapper-title .actions a:hover, +[class*="-order-"] .fieldset-wrapper-title .actions a:active { color: #a29c94; } .order-comments-history fieldset { @@ -9326,7 +9326,7 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d .order-comments-history .actions { float: right; } -[class^=" sales-order-"] .fieldset-wrapper address { +[class*="-order-"] .fieldset-wrapper address { overflow: auto; } /* @@ -9378,19 +9378,19 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d [class^=" sales-transactions-"] .col-id { width: 35px; } -[class^=" sales-order-shipment-"] .col-ship, +[class^=" adminhtml-order-shipment-"] .col-ship, [class^=" sales-"] .col-return-to-stock, .adminhtml-rma-new .col-select { text-align: center; width: 35px; } -[class^=" sales-order-"] .col-price-original, -[class^=" sales-order-"] .col-tax-amount, -[class^=" sales-order-"] .col-tax-percent, -[class^=" sales-order-"] .col-discont, -[class^=" sales-order-"] .col-total, -[class^=" sales-order-"] .col-discount, -[class^=" sales-order-"] .col-tax, +[class*="-order-"] .col-price-original, +[class*="-order-"] .col-tax-amount, +[class*="-order-"] .col-tax-percent, +[class*="-order-"] .col-discont, +[class*="-order-"] .col-total, +[class*="-order-"] .col-discount, +[class*="-order-"] .col-tax, [class^=" sales-"] .col-refunded, [class^=" adminhtml-rma-"] .col-order, [class^=" adminhtml-rma-"] .col-required, @@ -9402,8 +9402,8 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d white-space: nowrap; width: 50px; } -[class^=" sales-order-"] .col-subtotal, -[class^=" sales-order-"] .col-price, +[class*="-order-"] .col-subtotal, +[class*="-order-"] .col-price, [class^=" adminhtml-rma-"] .col-price { text-align: right; width: 50px; @@ -9422,8 +9422,8 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d width: 60px; } [class^=" sales-"] .col-qty, -[class^=" sales-order-"] .col-qty-invoice, -[class^=" sales-order-"] .col-ordered-qty, +[class*="-order-"] .col-qty-invoice, +[class*="-order-"] .col-ordered-qty, [class^=" adminhtml-rma-"] .col-qty, [class^=" adminhtml-rma-"] .col-condition { width: 70px; @@ -9472,14 +9472,14 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d [class^=" sales-"] tr.headings .col-transaction-type > span, [class^=" sales-"] tr.headings .col-gtbase > span, [class^=" sales-"] tr.headings .col-gtpurchased > span, -[class^=" sales-order-"] tr.headings .col-discont > span { +[class*="-order-"] tr.headings .col-discont > span { white-space: normal; } [class^=" sales-"] .col-period, [class^=" adminhtml-rma-"] .col-period { width: 150px; } -[class^=" sales-order-shipment-"] .col-carrier { +[class^=" adminhtml-order-shipment-"] .col-carrier { width: 190px; } .checkout-agreement-index .col-store-view { @@ -9507,48 +9507,48 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d padding-bottom: 4px; width: 100%; } -[class^=" sales-order-"] .order-totals .actions, +[class*="-order-"] .order-totals .actions, [class^=" adminhtml-rma-"] .col-qty, [class^=" adminhtml-rma-"] .col-qty_ordered, .sales-order-view .col-refunded { text-align: right; } -[class^=" sales-order-"] .col-price .label, -[class^=" sales-order-"] .col-subtotal .label { +[class*="-order-"] .col-price .label, +[class*="-order-"] .col-subtotal .label { display: inline-block; min-width: 60px; white-space: nowrap; } -[class^=" sales-order-"] .col-price .price-excl-tax .price, -[class^=" sales-order-"] .col-price .price-incl-tax .price, -[class^=" sales-order-"] .col-subtotal .price-excl-tax .price, -[class^=" sales-order-"] .col-subtotal .price-incl-tax .price { +[class*="-order-"] .col-price .price-excl-tax .price, +[class*="-order-"] .col-price .price-incl-tax .price, +[class*="-order-"] .col-subtotal .price-excl-tax .price, +[class*="-order-"] .col-subtotal .price-incl-tax .price { font-weight: bold; } -[class^=" sales-order-"] .grid .col-qty table, -[class^=" sales-order-"] .grid .col-qty tbody, -[class^=" sales-order-"] .grid .col-qty tr, -[class^=" sales-order-"] .grid .col-qty td, -[class^=" sales-order-"] .grid .col-ordered-qty table, -[class^=" sales-order-"] .grid .col-ordered-qty tbody, -[class^=" sales-order-"] .grid .col-ordered-qty tr, -[class^=" sales-order-"] .grid .col-ordered-qty td { +[class*="-order-"] .grid .col-qty table, +[class*="-order-"] .grid .col-qty tbody, +[class*="-order-"] .grid .col-qty tr, +[class*="-order-"] .grid .col-qty td, +[class*="-order-"] .grid .col-ordered-qty table, +[class*="-order-"] .grid .col-ordered-qty tbody, +[class*="-order-"] .grid .col-ordered-qty tr, +[class*="-order-"] .grid .col-ordered-qty td { background: none; border: 0; } -[class^=" sales-order-"] .col-ordered-qty td { +[class*="-order-"] .col-ordered-qty td { padding: 0 5px 3px; } -[class^=" sales-order-"] .grid .product-title { +[class*="-order-"] .grid .product-title { font-weight: bold; } -[class^=" sales-order-"] .item-options { +[class*="-order-"] .item-options { margin: 5px 0 5px 10px; } -[class^=" sales-order-"] .item-options dt { +[class*="-order-"] .item-options dt { font-weight: bold; } -[class^=" sales-order-"] .item-options dd { +[class*="-order-"] .item-options dd { margin: 0 0 0 10px; } .adminhtml-rma-item-attribute-edit .col-position input { @@ -9568,7 +9568,7 @@ table.items-to-invoice tbody tr:hover td { border: 0; text-align: center; } -[class^=" sales-order-creditmemo-"] .no-items { +[class~=" -order-creditmemo-"] .no-items { padding-top: 13px; text-align: center; } @@ -9576,17 +9576,17 @@ table.items-to-invoice tbody tr:hover td { color: #19a3d1; font-weight: bold; } -.sales-order-shipment-new .order-totals .fieldset-wrapper { +.adminhtml-order-shipment-new .order-totals .fieldset-wrapper { padding-top: 18px; } -.sales-order-shipment-new .actions { +.adminhtml-order-shipment-new .actions { float: right; } .creditmemo-totals .data-table input[type="text"] { text-align: right; width: 60px; } -[class^=" sales-order-"] .order-subtotal .label { +[class*="-order-"] .order-subtotal .label { width: 80%; } .adminhtml-rma-new .rma-confirmation .actions { @@ -9608,7 +9608,7 @@ table.items-to-invoice tbody tr:hover td { .adminhtml-rma-edit .data-table .col-number { width: 25%; } -[class^=" sales-order-"] .order-shipping-address .price, +[class*="-order-"] .order-shipping-address .price, .order-shipping-address .shipping-description-title { font-weight: bold; } @@ -9936,8 +9936,8 @@ table.items-to-invoice tbody tr:hover td { list-style: none; padding: 0; } -[class^=" sales-order-"] .order-billing-address .packaging-window .actions, -[class^=" sales-order-"] .order-shipping-address .packaging-window .actions { +[class*="-order-"] .order-billing-address .packaging-window .actions, +[class*="-order-"] .order-shipping-address .packaging-window .actions { margin: 0; } /* diff --git a/app/design/adminhtml/magento_backend/less/styles/pages.less b/app/design/adminhtml/magento_backend/less/styles/pages.less index 06197eccfad..33123cccf53 100644 --- a/app/design/adminhtml/magento_backend/less/styles/pages.less +++ b/app/design/adminhtml/magento_backend/less/styles/pages.less @@ -1323,11 +1323,11 @@ .order-billing-address, .order-billing-method, -[class^=" sales-order-"] .order-history, -[class^=" sales-order-"] .order-comments-history, -[class^=" sales-order-"] .order-information, -[class^=" sales-order-"] .order-billing-address, -[class^=" sales-order-"] .order-payment-method, +[class*="-order-"] .order-history, +[class*="-order-"] .order-comments-history, +[class*="-order-"] .order-information, +[class*="-order-"] .order-billing-address, +[class*="-order-"] .order-payment-method, [class^=" adminhtml-rma-"] .order-comments-history, [class^=" adminhtml-rma-"] .order-shipping-address, [class^=" adminhtml-rma-"] .rma-request-details { @@ -1337,11 +1337,11 @@ .order-shipping-address, .order-shipping-method, -[class^=" sales-order-"] .order-totals, -[class^=" sales-order-"] .order-account-information, -[class^=" sales-order-"] .order-shipping-address, -[class^=" sales-order-"] .order-payment-method-virtual, -[class^=" sales-order-"] .order-shipping-method, +[class*="-order-"] .order-totals, +[class*="-order-"] .order-account-information, +[class*="-order-"] .order-shipping-address, +[class*="-order-"] .order-payment-method-virtual, +[class*="-order-"] .order-shipping-method, [class^=" adminhtml-rma-"] .rma-confirmation, [class^=" adminhtml-rma-"] .order-shipping-method, [class^=" adminhtml-rma-"] .order-return-address { @@ -1484,13 +1484,13 @@ width: 100%; } -[class^=" sales-order-"] .order-billing-address .actions, -[class^=" sales-order-"] .order-shipping-address .actions { +[class*="-order-"] .order-billing-address .actions, +[class*="-order-"] .order-shipping-address .actions { margin: 17px 0; } -[class^=" sales-order-"] .order-billing-address .control + label, -[class^=" sales-order-"] .order-shipping-address .control + label { +[class*="-order-"] .order-billing-address .control + label, +[class*="-order-"] .order-shipping-address .control + label { margin: 17px 0 0; } @@ -1798,16 +1798,16 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d /* Order view -------------------------------------- */ -[class^=" sales-order-"] .fieldset-wrapper-title .actions { +[class*="-order-"] .fieldset-wrapper-title .actions { float: right; font-size: 12px; margin: 8px 20px 0 0; } -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:link, -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:visited, -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:hover, -[class^=" sales-order-"] .fieldset-wrapper-title .actions a:active { +[class*="-order-"] .fieldset-wrapper-title .actions a:link, +[class*="-order-"] .fieldset-wrapper-title .actions a:visited, +[class*="-order-"] .fieldset-wrapper-title .actions a:hover, +[class*="-order-"] .fieldset-wrapper-title .actions a:active { color: #a29c94; } @@ -1837,7 +1837,7 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d float: right; } -[class^=" sales-order-"] .fieldset-wrapper address { +[class*="-order-"] .fieldset-wrapper address { overflow: auto; } @@ -1903,20 +1903,20 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d width: 35px; } -[class^=" sales-order-shipment-"] .col-ship, +[class^=" adminhtml-order-shipment-"] .col-ship, [class^=" sales-"] .col-return-to-stock, .adminhtml-rma-new .col-select { text-align: center; width: 35px; } -[class^=" sales-order-"] .col-price-original, -[class^=" sales-order-"] .col-tax-amount, -[class^=" sales-order-"] .col-tax-percent, -[class^=" sales-order-"] .col-discont, -[class^=" sales-order-"] .col-total, -[class^=" sales-order-"] .col-discount, -[class^=" sales-order-"] .col-tax, +[class*="-order-"] .col-price-original, +[class*="-order-"] .col-tax-amount, +[class*="-order-"] .col-tax-percent, +[class*="-order-"] .col-discont, +[class*="-order-"] .col-total, +[class*="-order-"] .col-discount, +[class*="-order-"] .col-tax, [class^=" sales-"] .col-refunded, [class^=" adminhtml-rma-"] .col-order, [class^=" adminhtml-rma-"] .col-required, @@ -1929,8 +1929,8 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d width: 50px; } -[class^=" sales-order-"] .col-subtotal, -[class^=" sales-order-"] .col-price, +[class*="-order-"] .col-subtotal, +[class*="-order-"] .col-price, [class^=" adminhtml-rma-"] .col-price { text-align: right; width: 50px; @@ -1953,8 +1953,8 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d } [class^=" sales-"] .col-qty, -[class^=" sales-order-"] .col-qty-invoice, -[class^=" sales-order-"] .col-ordered-qty, +[class*="-order-"] .col-qty-invoice, +[class*="-order-"] .col-ordered-qty, [class^=" adminhtml-rma-"] .col-qty, [class^=" adminhtml-rma-"] .col-condition { width: 70px; @@ -2009,7 +2009,7 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d [class^=" sales-"] tr.headings .col-transaction-type > span, [class^=" sales-"] tr.headings .col-gtbase > span, [class^=" sales-"] tr.headings .col-gtpurchased > span, -[class^=" sales-order-"] tr.headings .col-discont > span { +[class*="-order-"] tr.headings .col-discont > span { white-space: normal; } @@ -2018,7 +2018,7 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d width: 150px; } -[class^=" sales-order-shipment-"] .col-carrier { +[class^=" adminhtml-order-shipment-"] .col-carrier { width: 190px; } @@ -2048,56 +2048,56 @@ tr.row-totals:nth-child(odd) + tr.summary-details ~ tr.summary-total:not(.show-d width: 100%; } -[class^=" sales-order-"] .order-totals .actions, +[class*="-order-"] .order-totals .actions, [class^=" adminhtml-rma-"] .col-qty, [class^=" adminhtml-rma-"] .col-qty_ordered, .sales-order-view .col-refunded { text-align: right; } -[class^=" sales-order-"] .col-price .label, -[class^=" sales-order-"] .col-subtotal .label { +[class*="-order-"] .col-price .label, +[class*="-order-"] .col-subtotal .label { display: inline-block; min-width: 60px; white-space: nowrap; } -[class^=" sales-order-"] .col-price .price-excl-tax .price, -[class^=" sales-order-"] .col-price .price-incl-tax .price, -[class^=" sales-order-"] .col-subtotal .price-excl-tax .price, -[class^=" sales-order-"] .col-subtotal .price-incl-tax .price { +[class*="-order-"] .col-price .price-excl-tax .price, +[class*="-order-"] .col-price .price-incl-tax .price, +[class*="-order-"] .col-subtotal .price-excl-tax .price, +[class*="-order-"] .col-subtotal .price-incl-tax .price { font-weight: bold; } -[class^=" sales-order-"] .grid .col-qty table, -[class^=" sales-order-"] .grid .col-qty tbody, -[class^=" sales-order-"] .grid .col-qty tr, -[class^=" sales-order-"] .grid .col-qty td, -[class^=" sales-order-"] .grid .col-ordered-qty table, -[class^=" sales-order-"] .grid .col-ordered-qty tbody, -[class^=" sales-order-"] .grid .col-ordered-qty tr, -[class^=" sales-order-"] .grid .col-ordered-qty td { +[class*="-order-"] .grid .col-qty table, +[class*="-order-"] .grid .col-qty tbody, +[class*="-order-"] .grid .col-qty tr, +[class*="-order-"] .grid .col-qty td, +[class*="-order-"] .grid .col-ordered-qty table, +[class*="-order-"] .grid .col-ordered-qty tbody, +[class*="-order-"] .grid .col-ordered-qty tr, +[class*="-order-"] .grid .col-ordered-qty td { background: none; border: 0; } -[class^=" sales-order-"] .col-ordered-qty td { +[class*="-order-"] .col-ordered-qty td { padding: 0 5px 3px; } -[class^=" sales-order-"] .grid .product-title { +[class*="-order-"] .grid .product-title { font-weight: bold; } -[class^=" sales-order-"] .item-options { +[class*="-order-"] .item-options { margin: 5px 0 5px 10px; } -[class^=" sales-order-"] .item-options dt { +[class*="-order-"] .item-options dt { font-weight: bold; } -[class^=" sales-order-"] .item-options dd { +[class*="-order-"] .item-options dd { margin: 0 0 0 10px; } @@ -2122,7 +2122,7 @@ table.items-to-invoice tbody tr:hover td { text-align: center; } -[class^=" sales-order-creditmemo-"] .no-items { +[class~=" -order-creditmemo-"] .no-items { padding-top: 13px; text-align: center; } @@ -2132,11 +2132,11 @@ table.items-to-invoice tbody tr:hover td { font-weight: bold; } -.sales-order-shipment-new .order-totals .fieldset-wrapper { +.adminhtml-order-shipment-new .order-totals .fieldset-wrapper { padding-top: 18px; } -.sales-order-shipment-new .actions { +.adminhtml-order-shipment-new .actions { float: right; } @@ -2145,7 +2145,7 @@ table.items-to-invoice tbody tr:hover td { width: 60px; } -[class^=" sales-order-"] .order-subtotal .label { +[class*="-order-"] .order-subtotal .label { width: 80%; } @@ -2173,7 +2173,7 @@ table.items-to-invoice tbody tr:hover td { width: 25%; } -[class^=" sales-order-"] .order-shipping-address .price, +[class*="-order-"] .order-shipping-address .price, .order-shipping-address .shipping-description-title { font-weight: bold; } @@ -2578,8 +2578,8 @@ table.items-to-invoice tbody tr:hover td { padding: 0; } -[class^=" sales-order-"] .order-billing-address .packaging-window .actions, -[class^=" sales-order-"] .order-shipping-address .packaging-window .actions { +[class*="-order-"] .order-billing-address .packaging-window .actions, +[class*="-order-"] .order-shipping-address .packaging-window .actions { margin: 0; } diff --git a/app/design/frontend/magento_plushe/css/styles.css b/app/design/frontend/magento_plushe/css/styles.css index e52f0d24738..9c9e203db1f 100644 --- a/app/design/frontend/magento_plushe/css/styles.css +++ b/app/design/frontend/magento_plushe/css/styles.css @@ -11992,7 +11992,7 @@ img[align="right"] { .review-customer-index .wrapper.table, .sales-order-view .wrapper.table, .sales-order-invoice .wrapper.table, - .sales-order-shipment .wrapper.table, + .adminhtml-order-shipment .wrapper.table, .sales-order-creditmemo .wrapper.table, .checkout-onepage-index .order-review .wrapper.table, .downloadable-customer-products .wrapper.table, diff --git a/app/design/frontend/magento_plushe/less/responsive/responsive.less b/app/design/frontend/magento_plushe/less/responsive/responsive.less index 2728ac92fd4..db32ac7dcc8 100644 --- a/app/design/frontend/magento_plushe/less/responsive/responsive.less +++ b/app/design/frontend/magento_plushe/less/responsive/responsive.less @@ -1486,7 +1486,7 @@ and (max-width : @breakPoint1) { .review-customer-index, .sales-order-view, .sales-order-invoice, - .sales-order-shipment, + .adminhtml-order-shipment, .sales-order-creditmemo, .checkout-onepage-index .order-review, .downloadable-customer-products, diff --git a/app/etc/di.xml b/app/etc/di.xml index 7b3b8d57280..741d3dfa0e9 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -173,14 +173,6 @@ </param> </type> <type name="Magento\Data\Structure" shared="false" /> - <type name="Magento\Core\Model\DataService\Path\Composite"> - <param name="items"> - <value> - <data>Magento\Core\Model\DataService\Repository</data> - <request>Magento\Core\Model\DataService\Path\Request</request> - </value> - </param> - </type> <type name="Magento\Core\Model\View\Design"> <param name="storeManager"> <instance type="Magento\Core\Model\StoreManager\Proxy" /> @@ -270,19 +262,19 @@ <value> <urlLib> <key type="const">Magento\Core\Model\Store::URL_TYPE_LIB</key> - <value type="const">Magento\Filesystem::PUB_LIB</value> + <value type="const">Magento\App\Filesystem::PUB_LIB_DIR</value> </urlLib> <urlMedia> <key type="const">Magento\Core\Model\Store::URL_TYPE_MEDIA</key> - <value type="const">Magento\Filesystem::MEDIA</value> + <value type="const">Magento\App\Filesystem::MEDIA_DIR</value> </urlMedia> <urlStatic> <key type="const">Magento\Core\Model\Store::URL_TYPE_STATIC</key> - <value type="const">Magento\Filesystem::STATIC_VIEW</value> + <value type="const">Magento\App\Filesystem::STATIC_VIEW_DIR</value> </urlStatic> <urlCache> <key type="const">Magento\Core\Model\Store::URL_TYPE_CACHE</key> - <value type="const">Magento\Filesystem::PUB_VIEW_CACHE</value> + <value type="const">Magento\App\Filesystem::PUB_VIEW_CACHE_DIR</value> </urlCache> </value> </param> @@ -292,7 +284,7 @@ <value/> </param> </type> - <type name="Magento\Filesystem"> + <type name="Magento\App\Filesystem"> <param name="fileReadFactory"> <instance type="Magento\Filesystem\File\ReadFactory" /> </param> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/Service/TestProduct.php b/dev/tests/integration/framework/Magento/TestFramework/App/Filesystem/DirectoryList.php similarity index 61% rename from dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/Service/TestProduct.php rename to dev/tests/integration/framework/Magento/TestFramework/App/Filesystem/DirectoryList.php index b78d2a282b0..630c2c74e1a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/Service/TestProduct.php +++ b/dev/tests/integration/framework/Magento/TestFramework/App/Filesystem/DirectoryList.php @@ -1,7 +1,5 @@ <?php /** - * Set of tests of layout directives handling behavior - * * Magento * * NOTICE OF LICENSE @@ -23,20 +21,25 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\TestFramework\App\Filesystem; -namespace Magento\Core\Model\DataService\LayoutTest\Magento\Catalog\Service; - -class TestProduct +class DirectoryList extends \Magento\App\Filesystem\DirectoryList { /** - * Provide test product data fixture + * Add directory configuration + * + * @param string $code + * @param array $directoryConfig */ - public function getTestProduct($someArgName) + public function addDirectory($code, array $directoryConfig) { - return array( - 'testProduct' => array( - 'id' => $someArgName - ) - ); + if (!isset($directoryConfig['path'])) { + $directoryConfig['path'] = null; + } + if (!$this->isAbsolute($directoryConfig['path'])) { + $directoryConfig['path'] = $this->makeAbsolute($directoryConfig['path']); + } + + $this->directories[$code] = $directoryConfig; } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index 49151a7d1e9..a8ac17b9701 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -27,7 +27,8 @@ namespace Magento\TestFramework; -use Magento\Filesystem; +use Magento\App\Filesystem, + Magento\App\Filesystem\DirectoryList; /** * Encapsulates application installation, initialization and uninstall @@ -142,12 +143,12 @@ class Application $generationDir = "$installDir/generation"; $this->_initParams = array( Filesystem::PARAM_APP_DIRS => array( - Filesystem::CONFIG => array('path' => $this->_installEtcDir), + Filesystem::CONFIG_DIR => array('path' => $this->_installEtcDir), Filesystem::VAR_DIR => array('path' => $installDir), - Filesystem::MEDIA => array('path' => "$installDir/media"), - Filesystem::STATIC_VIEW => array('path' => "$installDir/pub_static"), - Filesystem::PUB_VIEW_CACHE => array('path' => "$installDir/pub_cache"), - Filesystem::GENERATION => array('path' => $generationDir) + Filesystem::MEDIA_DIR => array('path' => "$installDir/media"), + Filesystem::STATIC_VIEW_DIR => array('path' => "$installDir/pub_static"), + Filesystem::PUB_VIEW_CACHE_DIR => array('path' => "$installDir/pub_cache"), + Filesystem::GENERATION_DIR => array('path' => $generationDir) ), \Magento\App\State::PARAM_MODE => $appMode ); @@ -211,6 +212,16 @@ class Application $objectManager = $this->_factory->restore($objectManager, BP, $overriddenParams); } + $directories = isset($overriddenParams[Filesystem::PARAM_APP_DIRS]) + ? $overriddenParams[Filesystem::PARAM_APP_DIRS] + : array(); + $directoryList = new \Magento\TestFramework\App\Filesystem\DirectoryList(BP, $directories); + + $objectManager->addSharedInstance($directoryList, 'Magento\App\Filesystem\DirectoryList'); + $objectManager->addSharedInstance($directoryList, 'Magento\Filesystem\DirectoryList'); + $objectManager->removeSharedInstance('Magento\App\Filesystem'); + $objectManager->removeSharedInstance('Magento\App\Filesystem\DirectoryList\Verification'); + Helper\Bootstrap::setObjectManager($objectManager); $objectManager->configure(array( @@ -238,16 +249,16 @@ class Application $this->loadArea(\Magento\TestFramework\Application::DEFAULT_APP_AREA); \Magento\Phrase::setRenderer($objectManager->get('Magento\Phrase\Renderer\Placeholder')); - /** @var \Magento\Filesystem\DirectoryList\Verification $verification */ - $verification = $objectManager->get('Magento\Filesystem\DirectoryList\Verification'); + /** @var \Magento\App\Filesystem\DirectoryList\Verification $verification */ + $verification = $objectManager->get('Magento\App\Filesystem\DirectoryList\Verification'); $verification->createAndVerifyDirectories(); - $directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); - $directoryListConfig = $objectManager->get('Magento\Filesystem\DirectoryList\Configuration'); + $directoryList = $objectManager->get('Magento\App\Filesystem\DirectoryList'); + $directoryListConfig = $objectManager->get('Magento\App\Filesystem\DirectoryList\Configuration'); $directoryListConfig->configure($directoryList); - $directories = isset($overriddenParams[\Magento\Filesystem::PARAM_APP_DIRS]) - ? $overriddenParams[\Magento\Filesystem::PARAM_APP_DIRS] + $directories = isset($overriddenParams[\Magento\App\Filesystem::PARAM_APP_DIRS]) + ? $overriddenParams[\Magento\App\Filesystem::PARAM_APP_DIRS] : array(); foreach ($directories as $code => $configOverrides) { $config = array_merge($directoryList->getConfig($code), $configOverrides); @@ -274,7 +285,8 @@ class Application $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\App\Http $app */ $app = $objectManager->get('Magento\App\Http'); - $app->execute(); + $response = $app->execute(); + $response->sendResponse(); } /** diff --git a/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php index 9baa19a3a6e..0b3b92cd05f 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php +++ b/dev/tests/integration/framework/Magento/TestFramework/ObjectManagerFactory.php @@ -66,16 +66,17 @@ class ObjectManagerFactory extends \Magento\App\ObjectManagerFactory */ public function restore(ObjectManager $objectManager, $rootDir, array $arguments) { - $directories = isset($arguments[\Magento\Filesystem::PARAM_APP_DIRS]) - ? $arguments[\Magento\Filesystem::PARAM_APP_DIRS] + $directories = isset($arguments[\Magento\App\Filesystem::PARAM_APP_DIRS]) + ? $arguments[\Magento\App\Filesystem::PARAM_APP_DIRS] : array(); - $directoryList = new \Magento\Filesystem\DirectoryList($rootDir, $directories); + $directoryList = new \Magento\TestFramework\App\Filesystem\DirectoryList($rootDir, $directories); \Magento\TestFramework\ObjectManager::setInstance($objectManager); $this->_pluginList->reset(); $objectManager->configure($this->_primaryConfigData); + $objectManager->addSharedInstance($directoryList, 'Magento\App\Filesystem\DirectoryList'); $objectManager->addSharedInstance($directoryList, 'Magento\Filesystem\DirectoryList'); $objectManager->configure(array( 'Magento\View\Design\FileResolution\Strategy\Fallback\CachingProxy' => array( @@ -87,7 +88,9 @@ class ObjectManagerFactory extends \Magento\App\ObjectManagerFactory 'preferences' => array( 'Magento\Stdlib\Cookie' => 'Magento\TestFramework\Cookie', 'Magento\App\RequestInterface' => 'Magento\TestFramework\Request', + 'Magento\App\Request\Http' => 'Magento\TestFramework\Request', 'Magento\App\ResponseInterface' => 'Magento\TestFramework\Response', + 'Magento\App\Response\Http' => 'Magento\TestFramework\Response', ), )); @@ -147,4 +150,12 @@ class ObjectManagerFactory extends \Magento\App\ObjectManagerFactory return $this->_pluginList; } + /** + * Override method in while running integration tests to prevent getting Exception + * + * @param \Magento\ObjectManager $objectManager + */ + protected function configureDirectories(\Magento\ObjectManager $objectManager) + { + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php index d3fd010c35c..6bc49bb7515 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractConfigFiles.php @@ -72,8 +72,8 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase ) ); - $filesystem = $this->_objectManager->get('Magento\Filesystem'); - $modulesDir = $filesystem->getPath(\Magento\Filesystem::MODULES); + $filesystem = $this->_objectManager->get('Magento\App\Filesystem'); + $modulesDir = $filesystem->getPath(\Magento\App\Filesystem::MODULES_DIR); $this->_schemaFile = $modulesDir . $this->_getXsdPath(); } } @@ -144,7 +144,8 @@ abstract class AbstractConfigFiles extends \PHPUnit_Framework_TestCase public function getXmlConfigFiles() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $directory = $objectManager->get('Magento\Filesystem')->getDirectoryRead(\Magento\Filesystem::MODULES); + $directory = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); return $objectManager->get('\Magento\Config\FileIteratorFactory')->create( $directory, $directory->search($this->_getConfigFilePathGlob()) diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php index b361346bc89..c309db57849 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php @@ -41,8 +41,8 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $dbInstance = $this->getMockForAbstractClass('Magento\TestFramework\Db\AbstractDb', array(), '', false); $installDir = '/install/dir'; $appMode = \Magento\App\State::MODE_DEVELOPER; - $directoryList = new \Magento\Filesystem\DirectoryList(BP); - $filesystem = new \Magento\Filesystem( + $directoryList = new \Magento\App\Filesystem\DirectoryList(BP); + $filesystem = new \Magento\App\Filesystem( $directoryList, new \Magento\Filesystem\Directory\ReadFactory(), new \Magento\Filesystem\Directory\WriteFactory(), @@ -69,7 +69,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase $initParams = $object->getInitParams(); $this->assertInternalType('array', $initParams, 'Wrong initialization parameters type'); - $this->assertArrayHasKey(\Magento\Filesystem::PARAM_APP_DIRS, $initParams, + $this->assertArrayHasKey(\Magento\App\Filesystem::PARAM_APP_DIRS, $initParams, 'Directories are not configured'); $this->assertArrayHasKey(State::PARAM_MODE, $initParams, 'Application mode is not configured'); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Helper/BootstrapTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Helper/BootstrapTest.php index c1044bb9b39..0a39d1a6777 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Helper/BootstrapTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/Helper/BootstrapTest.php @@ -53,9 +53,9 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase * @var array */ protected $_fixtureInitParams = array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::CONFIG => array('path' => __DIR__), - \Magento\Filesystem::VAR_DIR => array('path' => __DIR__) + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::CONFIG_DIR => array('path' => __DIR__), + \Magento\App\Filesystem::VAR_DIR => array('path' => __DIR__) ) ); diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php index f13dd8bc8e7..cf2f33f7940 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ObjectManagerTest.php @@ -46,7 +46,9 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase { $resource = new \stdClass; $instanceConfig = new \Magento\TestFramework\ObjectManager\Config(); - $verification = $this->getMock('Magento\Filesystem\DirectoryList\Verification', array(), array(), '', false); + $verification = $this->getMock( + 'Magento\App\Filesystem\DirectoryList\Verification', array(), array(), '', false + ); $cache = $this->getMock('Magento\App\CacheInterface'); $configLoader = $this->getMock('Magento\App\ObjectManager\ConfigLoader', array(), array(), '', false); $configCache = $this->getMock('Magento\App\ObjectManager\ConfigCache', array(), array(), '', false); @@ -57,7 +59,7 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase $model = new \Magento\TestFramework\ObjectManager( null, $instanceConfig, array( - 'Magento\Filesystem\DirectoryList\Verification' => $verification, + 'Magento\App\Filesystem\DirectoryList\Verification' => $verification, 'Magento\App\Cache\Type\Config' => $cache, 'Magento\App\ObjectManager\ConfigLoader' => $configLoader, 'Magento\App\ObjectManager\ConfigCache' => $configCache, diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php index 088b444d198..47184c017d2 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php @@ -223,9 +223,9 @@ class FormTest extends \PHPUnit_Framework_TestCase $fileResolverMock = $this->getMockBuilder('Magento\Core\Model\Config\FileResolver') ->disableOriginalConstructor() ->getMock(); - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem'); /** @var $directory \Magento\Filesystem\Directory\Read */ - $directory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $directory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $fileIteratorFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Config\FileIteratorFactory'); $fileIterator = $fileIteratorFactory->create($directory, array( diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php index de4709f3339..c0850d3d291 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php @@ -69,8 +69,8 @@ class MassactionTest extends \PHPUnit_Framework_TestCase \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store', - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => __DIR__ . '/../../_files/design') + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => __DIR__ . '/../../_files/design') ), )); } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php index 964676d3c78..7f2fbcd9070 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/GridTest.php @@ -87,10 +87,13 @@ class GridTest extends \PHPUnit_Framework_TestCase protected function _getColumnSetMock() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $directoryList = $objectManager->create('\Magento\Filesystem\DirectoryList', array('root' => __DIR__)); + $directoryList = $objectManager->create('\Magento\App\Filesystem\DirectoryList', array('root' => __DIR__)); return $this->getMock('Magento\Backend\Block\Widget\Grid\ColumnSet', array(), array( $objectManager->create('\Magento\View\Element\Template\Context', array( - 'filesystem' => $objectManager->create('\Magento\Filesystem', array('directoryList' => $directoryList)) + 'filesystem' => $objectManager->create( + '\Magento\App\Filesystem', + array('directoryList' => $directoryList) + ) )), $objectManager->create('Magento\Backend\Model\Widget\Grid\Row\UrlGeneratorFactory'), $objectManager->create('Magento\Backend\Model\Widget\Grid\SubTotals'), diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Admin/RobotsTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Admin/RobotsTest.php index e01b3973fc3..1dc0b3ea7d0 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Admin/RobotsTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Admin/RobotsTest.php @@ -53,7 +53,8 @@ class RobotsTest extends \PHPUnit_Framework_TestCase $this->model = $objectManager->create('Magento\Backend\Model\Config\Backend\Admin\Robots'); $this->model->setPath('design/search_engine_robots/custom_instructions'); $this->model->afterLoad(); - $this->rootDirectory = $objectManager->get('Magento\Filesystem')->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->rootDirectory = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); } /** diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/_files/no_robots_txt.php b/dev/tests/integration/testsuite/Magento/Backend/Model/_files/no_robots_txt.php index 228a48bdf0e..23b79a71a2d 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/_files/no_robots_txt.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/_files/no_robots_txt.php @@ -27,7 +27,7 @@ /** @var \Magento\Filesystem\Directory\Write $rootDirectory */ $rootDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::ROOT); + ->get('Magento\App\Filesystem')->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); if ($rootDirectory->isExist('robots.txt')) { $rootDirectory->delete('robots.txt'); } diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/_files/robots_txt.php b/dev/tests/integration/testsuite/Magento/Backend/Model/_files/robots_txt.php index 7a450108a39..c3d45c67dd7 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/_files/robots_txt.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/_files/robots_txt.php @@ -26,5 +26,5 @@ */ /** @var \Magento\Filesystem\Directory\Write $rootDirectory */ $rootDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::ROOT); + ->get('Magento\App\Filesystem')->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $rootDirectory->copyFile($rootDirectory->getRelativePath(__DIR__ . '/robots.txt'), 'robots.txt'); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php index 64c5282e168..c540bf28be1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/AbstractTest.php @@ -97,19 +97,24 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $this->assertStringEndsWith('catalog/product/view/', $this->_block->getSubmitUrl($this->_product)); } - public function testGetAddToWishlistUrl() + public function testGetAddToWishlistParams() { + $json = $this->_block->getAddToWishlistParams($this->_product); + $params = (array) json_decode($json); + $data = (array) $params['data']; + $this->assertEquals('1', $data['product']); + $this->assertArrayHasKey('uenc', $data); + $this->assertArrayHasKey('form_key', $data); $this->assertStringEndsWith( - 'wishlist/index/add/product/1/', - $this->_block->getAddToWishlistUrl($this->_product) + 'wishlist/index/add/', + $params['action'] ); } public function testGetAddToCompareUrl() { - $this->assertStringMatchesFormat( - '%scatalog/product_compare/add/product/1/%s', - $this->_block->getAddToCompareUrl($this->_product) + $this->assertStringMatchesFormat('%scatalog/product_compare/add/', + $this->_block->getAddToCompareUrl() ); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php index 7a86291a6ba..e9d09e78205 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php @@ -56,7 +56,7 @@ class CrosssellTest extends \PHPUnit_Framework_TestCase $html = $block->toHtml(); $this->assertNotEmpty($html); $this->assertContains('Simple Cross Sell', $html); /* name */ - $this->assertContains('product/1/', $html); /* part of url */ + $this->assertContains('product\/1\/', $html); /* part of url */ $this->assertInstanceOf('Magento\Catalog\Model\Resource\Product\Link\Product\Collection', $block->getItems()); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php index 17c736d5bbb..7bbb9d53287 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php @@ -55,7 +55,7 @@ class RelatedTest extends \PHPUnit_Framework_TestCase $html = $block->toHtml(); $this->assertNotEmpty($html); $this->assertContains('Simple Related Product', $html); /* name */ - $this->assertContains('product/1/', $html); /* part of url */ + $this->assertContains('"product":"1"', $html); /* part of url */ $this->assertInstanceOf('Magento\Catalog\Model\Resource\Product\Link\Product\Collection', $block->getItems()); } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php index fda4144ece1..27bebfbac04 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/ImageTest.php @@ -49,7 +49,8 @@ class ImageTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ - $mediaDirectory = $objectManager->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDirectory = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); // image fixtures $fixtureMediaDir = $mediaDirectory->getAbsolutePath($config->getBaseMediaPath()); @@ -94,7 +95,8 @@ class ImageTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ - $mediaDirectory = $objectManager->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDirectory = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $mediaDirectory->delete($config->getBaseMediaPath()); $mediaDirectory->delete($config->getBaseTmpMediaPath()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php index 4164c4007ee..21300b65342 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompareTest.php @@ -59,9 +59,21 @@ class CompareTest extends \PHPUnit_Framework_TestCase $this->_testGetProductUrl('getAddUrl', '/catalog/product_compare/add/'); } - public function testGetAddToWishlistUrl() + public function testGetAddToWishlistParams() { - $this->_testGetProductUrl('getAddToWishlistUrl', '/wishlist/index/add/'); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); + $product->setId(10); + $json = $this->_helper->getAddToWishlistParams($product); + $params = (array) json_decode($json); + $data = (array) $params['data']; + $this->assertEquals('10', $data['product']); + $this->assertArrayHasKey('uenc', $data); + $this->assertArrayHasKey('form_key', $data); + $this->assertStringEndsWith( + 'wishlist/index/add/', + $params['action'] + ); } public function testGetAddToCartUrl() @@ -71,7 +83,8 @@ class CompareTest extends \PHPUnit_Framework_TestCase public function testGetRemoveUrl() { - $this->_testGetProductUrl('getRemoveUrl', '/catalog/product_compare/remove/'); + $url = $this->_helper->getRemoveUrl(); + $this->assertContains('/catalog/product_compare/remove/', $url); } public function testGetClearListUrl() @@ -130,8 +143,6 @@ class CompareTest extends \PHPUnit_Framework_TestCase $product->setId(10); $url = $this->_helper->$method($product); $this->assertContains($expectedFullAction, $url); - $this->assertContains('/product/10/', $url); - $this->assertContains('/uenc/', $url); } /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php index 9c8f824d787..69d1a642a74 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php @@ -53,7 +53,8 @@ class MediaTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); - $mediaDirectory = $objectManager->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDirectory = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); self::$_mediaTmpDir = $mediaDirectory->getAbsolutePath($config->getBaseTmpMediaPath()); self::$_mediaDir = $mediaDirectory->getAbsolutePath($config->getBaseMediaPath()); @@ -74,8 +75,8 @@ class MediaTest extends \PHPUnit_Framework_TestCase $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ - $mediaDirectory = $objectManager->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDirectory = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); if ($mediaDirectory->isExist($config->getBaseMediaPath())) { $mediaDirectory->delete($config->getBaseMediaPath()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/SkuTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/SkuTest.php index c761cf879c1..d1f4384bad2 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/SkuTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/SkuTest.php @@ -68,7 +68,10 @@ class SkuTest extends \PHPUnit_Framework_TestCase */ public function testGenerateUniqueLongSku($product) { - $product->duplicate(); + /** @var \Magento\Catalog\Model\Product\Copier $copier */ + $copier = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Catalog\Model\Product\Copier'); + $copier->copy($product); $this->assertEquals('0123456789012345678901234567890123456789012345678901234567890123', $product->getSku()); $product->getResource()->getAttribute('sku')->getBackend()->beforeSave($product); $this->assertEquals('01234567890123456789012345678901234567890123456789012345678901-1', $product->getSku()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php index ad7c7998cde..14f7cb622e8 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php @@ -44,7 +44,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $eventManager = $this->getMock('Magento\Event\ManagerInterface', array('dispatch'), array(), '', false); $coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $fileStorageDb = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $registry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $this->_model = $this->getMockForAbstractClass('Magento\Catalog\Model\Product\Type\AbstractType', diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php index 3d38acdb45f..d49ba62dbf1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/TypeTest.php @@ -64,7 +64,6 @@ class TypeTest extends \PHPUnit_Framework_TestCase array(null, 'Magento\Catalog\Model\Product\Type\Simple'), array(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, 'Magento\Catalog\Model\Product\Type\Simple'), array(\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL, 'Magento\Catalog\Model\Product\Type\Virtual'), - array(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED, 'Magento\Catalog\Model\Product\Type\Grouped'), array(\Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE, 'Magento\Catalog\Model\Product\Type\Configurable' ), @@ -100,7 +99,6 @@ class TypeTest extends \PHPUnit_Framework_TestCase array(null), array(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE), array(\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL), - array(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED), array(\Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE), array(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE), array(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE) @@ -124,7 +122,6 @@ class TypeTest extends \PHPUnit_Framework_TestCase array(null, 'Magento\Catalog\Model\Product\Type\Price'), array(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, 'Magento\Catalog\Model\Product\Type\Price'), array(\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL, 'Magento\Catalog\Model\Product\Type\Price'), - array(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED, 'Magento\Catalog\Model\Product\Type\Price'), array(\Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE, 'Magento\Catalog\Model\Product\Type\Configurable\Price' ), @@ -140,7 +137,6 @@ class TypeTest extends \PHPUnit_Framework_TestCase $options = $this->_productType->getOptionArray(); $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, $options); $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL, $options); - $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED, $options); $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE, $options); $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, $options); $this->assertArrayHasKey(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE, $options); @@ -181,7 +177,6 @@ class TypeTest extends \PHPUnit_Framework_TestCase return array( array(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE), array(\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL), - array(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED), array(\Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE), array(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE), array(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE), @@ -193,7 +188,6 @@ class TypeTest extends \PHPUnit_Framework_TestCase $types = $this->_productType->getTypes(); $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, $types); $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL, $types); - $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED, $types); $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE, $types); $this->assertArrayHasKey(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, $types); $this->assertArrayHasKey(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE, $types); @@ -209,7 +203,6 @@ class TypeTest extends \PHPUnit_Framework_TestCase { $types = $this->_productType->getCompositeTypes(); $this->assertInternalType('array', $types); - $this->assertContains(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED, $types); $this->assertContains(\Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE, $types); $this->assertContains(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, $types); } @@ -254,7 +247,6 @@ class TypeTest extends \PHPUnit_Framework_TestCase } $this->assertContains(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE, $types); $this->assertContains(\Magento\Catalog\Model\Product\Type::TYPE_VIRTUAL, $types); - $this->assertContains(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED, $types); $this->assertContains(\Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE, $types); $this->assertContains(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE, $types); $this->assertContains(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE, $types); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php index 6200144e074..e7e1d1b5f3d 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductExternalTest.php @@ -226,13 +226,6 @@ class ProductExternalTest extends \PHPUnit_Framework_TestCase $this->assertSame($this->_model, $linkCollection->getProduct()); } - public function testGetGroupedLinkCollection() - { - $linkCollection = $this->_model->getGroupedLinkCollection(); - $this->assertInstanceOf('Magento\Catalog\Model\Resource\Product\Link\Collection', $linkCollection); - $this->assertSame($this->_model, $linkCollection->getProduct()); - } - /** * @covers \Magento\Catalog\Model\Product::getProductUrl * @covers \Magento\Catalog\Model\Product::getUrlInStore diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php index ff04b3b58a7..dc6aa30cde0 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductGettersTest.php @@ -283,8 +283,8 @@ class ProductGettersTest extends \PHPUnit_Framework_TestCase public static function tearDownAfterClass() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $mediaDirectory = $objectManager->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDirectory = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); $mediaDirectory->delete($config->getBaseMediaPath()); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php index 30eb9cb1418..9b558ec9a13 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php @@ -55,8 +55,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ - $mediaDirectory = $objectManager->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDirectory = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); if ($mediaDirectory->isExist($config->getBaseMediaPath())) { $mediaDirectory->delete($config->getBaseMediaPath()); @@ -130,8 +130,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ - $mediaDirectory = $objectManager->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $mediaDirectory = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $mediaDirectory->create($config->getBaseTmpMediaPath()); $targetFile = $config->getTmpMediaPath(basename($sourceFile)); @@ -147,7 +147,10 @@ class ProductTest extends \PHPUnit_Framework_TestCase public function testDuplicate() { $this->_model->load(1); // fixture - $duplicate = $this->_model->duplicate(); + /** @var \Magento\Catalog\Model\Product\Copier $copier */ + $copier = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Catalog\Model\Product\Copier'); + $duplicate = $copier->copy($this->_model); try { $this->assertNotEmpty($duplicate->getId()); $this->assertNotEquals($duplicate->getId(), $this->_model->getId()); @@ -168,8 +171,11 @@ class ProductTest extends \PHPUnit_Framework_TestCase { $this->_model->load(1); $this->assertEquals('simple', $this->_model->getSku()); - $duplicated = $this->_model->duplicate(); - $this->assertEquals('simple-1', $duplicated->getSku()); + /** @var \Magento\Catalog\Model\Product\Copier $copier */ + $copier = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Catalog\Model\Product\Copier'); + $duplicate = $copier->copy($this->_model); + $this->assertEquals('simple-1', $duplicate->getSku()); } /** @@ -184,36 +190,14 @@ class ProductTest extends \PHPUnit_Framework_TestCase $duplicate->delete(); } - /** - * @covers \Magento\Catalog\Model\Product::isGrouped - * @covers \Magento\Catalog\Model\Product::isSuperGroup - * @covers \Magento\Catalog\Model\Product::isSuper - */ - public function testIsGrouped() - { - $this->assertFalse($this->_model->isGrouped()); - $this->assertFalse($this->_model->isSuperGroup()); - $this->assertFalse($this->_model->isSuper()); - $this->_model->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED); - $this->assertTrue($this->_model->isGrouped()); - $this->assertTrue($this->_model->isSuperGroup()); - $this->assertTrue($this->_model->isSuper()); - } - /** * @covers \Magento\Catalog\Model\Product::isConfigurable - * @covers \Magento\Catalog\Model\Product::isSuperConfig - * @covers \Magento\Catalog\Model\Product::isSuper */ public function testIsConfigurable() { $this->assertFalse($this->_model->isConfigurable()); - $this->assertFalse($this->_model->isSuperConfig()); - $this->assertFalse($this->_model->isSuper()); $this->_model->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_CONFIGURABLE); $this->assertTrue($this->_model->isConfigurable()); - $this->assertTrue($this->_model->isSuperConfig()); - $this->assertTrue($this->_model->isSuper()); } /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image.php index 676618f0db3..227a3dcafb2 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image.php @@ -26,7 +26,7 @@ */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); -$mediaPath = $objectManager->get('Magento\Filesystem')->getPath(\Magento\Filesystem::MEDIA); +$mediaPath = $objectManager->get('Magento\App\Filesystem')->getPath(\Magento\App\Filesystem::MEDIA_DIR); $additionalPath = $objectManager->get('Magento\Catalog\Model\Product\Media\Config')->getBaseMediaPath(); $dir = $mediaPath . '/' . $additionalPath . '/m/a'; if (!is_dir($dir)) { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image_rollback.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image_rollback.php index 71d56870f91..6577f0a629a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_image_rollback.php @@ -31,8 +31,8 @@ $config = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ $mediaDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::MEDIA); + ->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $mediaDirectory->delete($config->getBaseMediaPath()); $mediaDirectory->delete($config->getBaseTmpMediaPath()); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php b/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php index eb26cb35818..d13f3f74d54 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/products.php @@ -31,7 +31,7 @@ $obectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var \Magento\Catalog\Model\Product\Media\Config $config */ $config = $obectManager->get('Magento\Catalog\Model\Product\Media\Config'); /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ -$mediaDirectory = $obectManager->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::MEDIA); +$mediaDirectory = $obectManager->get('Magento\App\Filesystem')->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $baseTmpMediaPath = $config->getBaseTmpMediaPath(); $mediaDirectory->create($baseTmpMediaPath); diff --git a/dev/tests/integration/testsuite/Magento/Cms/Helper/Wysiwyg/ImagesTest.php b/dev/tests/integration/testsuite/Magento/Cms/Helper/Wysiwyg/ImagesTest.php index f3ea59f2fd4..e6e62f4daa2 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Helper/Wysiwyg/ImagesTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Helper/Wysiwyg/ImagesTest.php @@ -27,8 +27,8 @@ class ImagesTest extends \PHPUnit_Framework_TestCase { public function testGetStorageRoot() { - $path = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem')->getPath( - \Magento\Filesystem::MEDIA + $path = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem')->getPath( + \Magento\App\Filesystem::MEDIA_DIR ); $helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Cms\Helper\Wysiwyg\Images'); diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php index ce27d0da5a0..3f79c091d33 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php @@ -83,7 +83,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase public function testGetThumbsPath() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $filesystem = $objectManager->get('Magento\Filesystem'); + $filesystem = $objectManager->get('Magento\App\Filesystem'); $session = $objectManager->get('Magento\Backend\Model\Session'); $backendUrl = $objectManager->get('Magento\Backend\Model\Url'); $imageFactory = $objectManager->get('Magento\Image\AdapterFactory'); @@ -111,7 +111,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase $uploaderFactory ); $this->assertStringStartsWith( - str_replace('\\', '/', $filesystem->getPath(\Magento\Filesystem::MEDIA)), + str_replace('\\', '/', $filesystem->getPath(\Magento\App\Filesystem::MEDIA_DIR)), $model->getThumbsPath() ); } diff --git a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest.php b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest.php index 66df4e223e5..2aa7b0aaf32 100644 --- a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest.php @@ -64,7 +64,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase $this->_includePath = get_include_path(); $this->varDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + ->get('Magento\App\Filesystem')->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $generationDirectory = $this->varDirectory->getAbsolutePath('generation'); \Magento\Autoload\IncludePath::addIncludePath($generationDirectory); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php deleted file mode 100644 index c5b522fd0ac..00000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/ConfigTest.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php -/** - * Include verification of overriding service call alias with different classes. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class ConfigTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\DataService\Config - */ - protected $_config; - - /** - * @var \Magento\Filesystem - */ - protected $filesystem; - - /** - * @var \Magento\ObjectManager - */ - protected $objectManager; - - /** - * Setup test - */ - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $rootPath = $this->objectManager->get('Magento\Filesystem') - ->getDirectoryRead(\Magento\Filesystem::ROOT) - ->getAbsolutePath(); - - $path = str_replace('\\', '/', realpath(__DIR__ . '/../DataService/LayoutTest')); - - $directoryList = new \Magento\Filesystem\DirectoryList( - $rootPath, array( - \Magento\Filesystem::MODULES => array('path' => $path), - \Magento\Filesystem::CONFIG => array('path' => $path) - )); - - $this->filesystem = new \Magento\Filesystem( - $directoryList, - new \Magento\Filesystem\Directory\ReadFactory(), - new \Magento\Filesystem\Directory\WriteFactory() - ); - - $modulesDir = new \Magento\Module\Dir( - $this->filesystem, - $this->objectManager->get('Magento\Stdlib\String') - ); - /** @var \Magento\Module\Dir\Reader $moduleReader */ - - - $moduleList = $this->objectManager->create( - 'Magento\Module\ModuleList', - array( - 'reader' => $this->objectManager->create( - 'Magento\Module\Declaration\Reader\Filesystem', - array( - 'fileResolver' => $this->objectManager->create( - 'Magento\Module\Declaration\FileResolver', - array( - 'filesystem' => $this->filesystem - ) - ) - ) - ), - 'cache' => $this->getMock('Magento\Config\CacheInterface') - ) - ); - - $moduleReader = new \Magento\Module\Dir\Reader( - $modulesDir, - $moduleList, - $this->filesystem, - $this->objectManager->get('Magento\Config\FileIteratorFactory') - ); - - /** @var \Magento\Core\Model\DataService\Config\Reader\Factory $dsCfgReaderFactory */ - $dsCfgReaderFactory = $this->objectManager->create( - 'Magento\Core\Model\DataService\Config\Reader\Factory' - ); - - /** @var \Magento\Core\Model\DataService\Config $config */ - $this->_config = new \Magento\Core\Model\DataService\Config( - $dsCfgReaderFactory, - $moduleReader - ); - - } - - public function testGetClassByAliasOverride() - { - $classInfo = $this->_config->getClassByAlias('alias'); - $this->assertEquals('last_service', $classInfo['class']); - $this->assertEquals('last_method', $classInfo['retrieveMethod']); - $this->assertEquals('last_value', $classInfo['methodArguments']['last_arg']); - $this->assertEquals('last_value_two', $classInfo['methodArguments']['last_arg_two']); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php deleted file mode 100644 index 4140a25fabe..00000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest.php +++ /dev/null @@ -1,154 +0,0 @@ -<?php -/** - * Set of tests of layout directives handling behavior - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class LayoutTest extends \Magento\TestFramework\TestCase\AbstractController -{ - private $_dataServiceGraph; - - /** - * @var \Magento\ObjectManager - */ - protected $objectManager; - - /** - * @var \Magento\Filesystem - */ - protected $filesystem; - - /** - * Setup - */ - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $rootPath = $this->objectManager->get('Magento\Filesystem') - ->getDirectoryRead(\Magento\Filesystem::ROOT) - ->getAbsolutePath(); - - $path = str_replace('\\', '/', realpath(__DIR__ . '/../DataService/LayoutTest')); - $directoryList = new \Magento\Filesystem\DirectoryList( - $rootPath, - array(\Magento\Filesystem::MODULES => array('path' => $path)) - ); - - $this->filesystem = new \Magento\Filesystem( - $directoryList, - new \Magento\Filesystem\Directory\ReadFactory(), - new \Magento\Filesystem\Directory\WriteFactory() - ); - - $config = $this->_loadServiceCallsConfig(); - parent::setUp(); - $this->dispatch("catalog/category/view/foo/bar"); - $fixtureFileName = __DIR__ . '/LayoutTest/Magento/Catalog/Service/TestProduct.php'; - include $fixtureFileName; - $invoker = $this->objectManager->create( - 'Magento\Core\Model\DataService\Invoker', - array('config' => $config) - ); - /** @var \Magento\Core\Model\DataService\Graph $dataServiceGraph */ - $this->_dataServiceGraph = $this->objectManager->create( - 'Magento\Core\Model\DataService\Graph', - array('dataServiceInvoker' => $invoker) - ); - } - - protected function _loadServiceCallsConfig() - { - $modulesDir = new \Magento\Module\Dir( - $this->filesystem, - $this->objectManager->get('Magento\Stdlib\String') - ); - /** @var \Magento\Module\Dir\Reader $moduleReader */ - - $moduleReader = new \Magento\Module\Dir\Reader( - $modulesDir, - $this->objectManager->get('Magento\Module\ModuleListInterface'), - $this->filesystem, - $this->objectManager->get('Magento\Config\FileIteratorFactory') - ); - - /** @var \Magento\Core\Model\DataService\Config\Reader\Factory $dsCfgReaderFactory */ - $dsCfgReaderFactory = $this->objectManager->create( - 'Magento\Core\Model\DataService\Config\Reader\Factory' - ); - - /** @var \Magento\Core\Model\DataService\Config $config */ - $dataServiceConfig = new \Magento\Core\Model\DataService\Config( - $dsCfgReaderFactory, - $moduleReader - ); - return $dataServiceConfig; - } - - /** - * Test Layout initialization of service calls - */ - public function testServiceCalls() - { - /** @var \Magento\View\LayoutInterface $layout */ - $layout = $this->_getLayoutModel('layout_update.xml'); - $serviceCalls = $layout->getServiceCalls(); - $expectedServiceCalls = array( - 'testServiceCall' => array( - 'namespaces' => array( - 'block_with_service_calls' => 'testData' - ) - ) - ); - $this->assertEquals($expectedServiceCalls, $serviceCalls); - $dictionary = $this->_dataServiceGraph->getByNamespace('block_with_service_calls'); - $expectedDictionary = array( - 'testData' => array( - 'testProduct' => array( - 'id' => 'bar' - ) - ) - ); - $this->assertEquals($expectedDictionary, $dictionary); - } - - /** - * Prepare a layout model with pre-loaded fixture of an update XML - * - * @param string $fixtureFile - * - * @return \Magento\View\LayoutInterface - */ - protected function _getLayoutModel($fixtureFile) - { - /** @var $layout \Magento\View\LayoutInterface */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\View\LayoutInterface', - array('dataServiceGraph' => $this->_dataServiceGraph) - ); - $xml = simplexml_load_file(__DIR__ . "/LayoutTest/{$fixtureFile}", 'Magento\View\Layout\Element'); - $layout->setXml($xml); - $layout->generateElements(); - return $layout; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/etc/service_calls.xml b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/etc/service_calls.xml deleted file mode 100644 index a60e7e8b5ee..00000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/etc/service_calls.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<service_calls> - <service_call name="testServiceCall" - service="Magento\Core\Model\DataService\LayoutTest\Magento\Catalog\Service\TestProduct" - method="getTestProduct"> - <arg name="someArgName">{{request.params.foo}}</arg> - </service_call> -</service_calls> \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/First/etc/module.xml b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/First/etc/module.xml deleted file mode 100755 index 004541282a7..00000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/First/etc/module.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <module name="Magento_First" version="1.6.0.0.23" active="true"/> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/First/etc/service_calls.xml b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/First/etc/service_calls.xml deleted file mode 100644 index 81b7133f355..00000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/First/etc/service_calls.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<service_calls> - <service_call name="alias" service="first_service" method="first_method"> - <arg name="first_arg">first_value</arg> - <arg name="first_arg_two">first_value_two</arg> - </service_call> -</service_calls> \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Last/etc/service_calls.xml b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Last/etc/service_calls.xml deleted file mode 100644 index 7d824f73d5b..00000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Last/etc/service_calls.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<service_calls> - <service_call name="alias" service="last_service" method="last_method"> - <arg name="last_arg">last_value</arg> - <arg name="last_arg_two">last_value_two</arg> - </service_call> -</service_calls> \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Test/etc/module.xml b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Test/etc/module.xml deleted file mode 100755 index 4bbcaf82cde..00000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Test/etc/module.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <module name="Magento_Test" version="1.6.0.0.23" active="true"/> -</config> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Test/etc/service_calls.xml b/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Test/etc/service_calls.xml deleted file mode 100644 index e1630f9e180..00000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Test/etc/service_calls.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<service_calls> - <service_call name="alias" service="some_class_name" method="some_method_name"> - <arg name="some_arg_name_one">some_arg_value_one</arg> - <arg name="some_arg_name_two">some_arg_value_two</arg> - </service_call> -</service_calls> \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/File/StorageTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/File/StorageTest.php index 2db25eec833..929187dfe63 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/File/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/File/StorageTest.php @@ -44,7 +44,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase $this->assertArrayHasKey('update_time', $config); $this->assertEquals( \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem')->getPath(\Magento\Filesystem::MEDIA), + ->get('Magento\App\Filesystem')->getPath(\Magento\App\Filesystem::MEDIA_DIR), $config['media_directory'] ); $this->assertInternalType('array', $config['allowed_resources']); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php index 1342496c7ea..e6d1ffd89ea 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php @@ -66,7 +66,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase array( $this->_objectManager->create('Magento\Core\Model\Resource\Theme\CollectionFactory'), $this->_objectManager->create('Magento\Core\Model\Theme\Collection'), - $this->_objectManager->create('Magento\Filesystem') + $this->_objectManager->create('Magento\App\Filesystem') ) ); $themeRegistration->expects($this->once()) diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Session/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Session/ConfigTest.php index 669ff1c9b92..b3a0fa6678e 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Session/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Session/ConfigTest.php @@ -69,7 +69,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testDefaultConfiguration() { $this->assertEquals( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem')->getPath('session'), + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem') + ->getPath('session'), $this->_model->getSavePath() ); $this->assertEquals( diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php index 906eb99fc80..f2cd9f2752e 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php @@ -58,7 +58,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase 'url' => $objectManager->get('Magento\Core\Model\Url'), 'request' => $objectManager->get('Magento\App\RequestInterface'), 'configDataResource' => $objectManager->get('Magento\Core\Model\Resource\Config\Data'), - 'filesystem' => $objectManager->get('Magento\Filesystem'), + 'filesystem' => $objectManager->get('Magento\App\Filesystem'), 'coreStoreConfig' => $objectManager->get('Magento\Core\Model\Store\Config'), 'coreConfig' => $objectManager->get('Magento\Core\Model\Config'), 'resource' => $objectManager->get('Magento\Core\Model\Resource\Store'), @@ -199,7 +199,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase public function testGetBaseUrlInPub() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array(\Magento\Filesystem::PUB => array('uri' => '')) + \Magento\App\Filesystem::PARAM_APP_DIRS => array(\Magento\App\Filesystem::PUB_DIR => array('uri' => '')) )); $this->_model = $this->_getStoreModel(); $this->_model->load('default'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php index 44ab28ab0ab..7aa1bea6afe 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/CollectionTest.php @@ -41,16 +41,16 @@ class CollectionTest extends \PHPUnit_Framework_TestCase { $directoryList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create( - 'Magento\Filesystem\DirectoryList', + 'Magento\App\Filesystem\DirectoryList', array( - 'root' => \Magento\Filesystem::ROOT, + 'root' => \Magento\App\Filesystem::ROOT_DIR, 'directories' => array( - \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/_files/design') + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/_files/design') ), ) ); $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Filesystem', array('directoryList' => $directoryList)); + ->create('Magento\App\Filesystem', array('directoryList' => $directoryList)); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Core\Model\Theme\Collection', array('filesystem' => $filesystem)); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php index b3ef30f63e1..781668f4d0b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php @@ -45,8 +45,8 @@ class RegistrationTest extends \PHPUnit_Framework_TestCase protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/_files/design'), + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/_files/design'), ) )); $this->_theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php index 377c2dc8dc3..8b4d6101297 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php @@ -55,21 +55,21 @@ class DesignTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - $themeDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + $themeDir = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $themeDir->delete('theme/frontend'); $themeDir->delete('theme/_merged'); - $pubLibPath = $filesystem->getPath(\Magento\Filesystem::PUB_LIB); + $pubLibPath = $filesystem->getPath(\Magento\App\Filesystem::PUB_LIB_DIR); copy($pubLibPath . '/prototype/prototype.js', $pubLibPath . '/prototype/prototype.min.js'); } public static function tearDownAfterClass() { - /** @var \Magento\Filesystem $filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); - $pubLibPath = $filesystem->getPath(\Magento\Filesystem::PUB_LIB); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem'); + $pubLibPath = $filesystem->getPath(\Magento\App\Filesystem::PUB_LIB_DIR); unlink($pubLibPath . '/prototype/prototype.min.js'); } @@ -91,8 +91,8 @@ class DesignTest extends \PHPUnit_Framework_TestCase protected function _emulateFixtureTheme($themePath = 'test_default') { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => realpath(__DIR__ . '/../_files/design')), + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__ . '/../_files/design')), ), )); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); @@ -228,9 +228,9 @@ class DesignTest extends \PHPUnit_Framework_TestCase ->get('Magento\View\DesignInterface') ->getDesignTheme(); $customConfigFile = $theme->getCustomization()->getCustomViewConfigPath(); - /** @var $filesystem \Magento\Filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $relativePath = $directory->getRelativePath($customConfigFile); try { $directory->writeFile($relativePath, '<?xml version="1.0" encoding="UTF-8"?> @@ -335,8 +335,8 @@ class DesignTest extends \PHPUnit_Framework_TestCase public function testGetPublicFileUrl() { - $pubLibFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') - ->getPath(\Magento\Filesystem::PUB_LIB) . '/jquery/jquery.js'; + $pubLibFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem') + ->getPath(\Magento\App\Filesystem::PUB_LIB_DIR) . '/jquery/jquery.js'; $actualResult = $this->_viewUrl->getPublicFileUrl($pubLibFile); $this->assertStringEndsWith('/jquery/jquery.js', $actualResult); } @@ -346,8 +346,8 @@ class DesignTest extends \PHPUnit_Framework_TestCase */ public function testGetPublicFileUrlSigned() { - $pubLibFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') - ->getPath(\Magento\Filesystem::PUB_LIB) . '/jquery/jquery.js'; + $pubLibFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem') + ->getPath(\Magento\App\Filesystem::PUB_LIB_DIR) . '/jquery/jquery.js'; $actualResult = $this->_viewUrl->getPublicFileUrl($pubLibFile); $this->assertStringMatchesFormat('%a/jquery/jquery.js?%d', $actualResult); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php index 27f34db42e7..94efdd66113 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php @@ -30,8 +30,8 @@ \Magento\Core\Model\App\Area::PART_CONFIG ); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => realpath(__DIR__)), + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__)), ), )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php b/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php index 9f0eae9ca7a..551a59b649a 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php +++ b/dev/tests/integration/testsuite/Magento/Core/Utility/Layout.php @@ -104,7 +104,6 @@ class Layout 'structure' => $objectManager->create('Magento\Data\Structure', array()), 'argumentProcessor' => $objectManager->create('Magento\Core\Model\Layout\Argument\Processor', array()), 'scheduledStructure' => $objectManager->create('Magento\Core\Model\Layout\ScheduledStructure', array()), - 'dataServiceGraph' => $objectManager->create('Magento\Core\Model\DataService\Graph', array()), 'coreStoreConfig' => $objectManager->create('Magento\Core\Model\Store\Config'), 'appState' => $objectManager->get('Magento\App\State'), 'messageManager' => $objectManager->get('Magento\Message\ManagerInterface'), diff --git a/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php index 41c1e66651d..f79ee54315d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Utility/LayoutTest.php @@ -34,8 +34,8 @@ class LayoutTest extends \PHPUnit_Framework_TestCase protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::APP => array('path' => BP . '/dev/tests/integration'), + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::APP_DIR => array('path' => BP . '/dev/tests/integration'), ) )); $this->_utility = new \Magento\Core\Utility\Layout($this); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change_rollback.php b/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change_rollback.php index 710d7f39c55..f6c9edf8133 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change_rollback.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change_rollback.php @@ -29,12 +29,12 @@ $themeDirectory = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . '/media_for_change'; \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::VAR_DIR => array('path' => $themeDirectory), + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::VAR_DIR => array('path' => $themeDirectory), ), )); /** @var $objectManager \Magento\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $directoryWrite \Magento\Filesystem\Directory\Write */ -$directoryWrite = $objectManager->create('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); +$directoryWrite = $objectManager->create('Magento\App\Filesystem')->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $directoryWrite->delete(); diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php index d2cb4d00ccd..7d93f5e92e0 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Config/QuickStylesTest.php @@ -50,10 +50,10 @@ class QuickStylesTest extends \PHPUnit_Framework_TestCase protected function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Filesystem\DirectoryList $directoryList */ - $directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); + /** @var \Magento\App\Filesystem\DirectoryList $directoryList */ + $directoryList = $objectManager->get('Magento\App\Filesystem\DirectoryList'); $path = str_replace($directoryList->getRoot(), '', str_replace('\\', '/', __DIR__) . '/../_files/design'); - $directoryList->addDirectory(\Magento\Filesystem::THEMES, array('path' => ltrim($path, '/'))); + $directoryList->addDirectory(\Magento\App\Filesystem::THEMES_DIR, array('path' => ltrim($path, '/'))); $this->_design = $objectManager->get('Magento\View\DesignInterface'); $objectManager->get('Magento\App\State')->setAreaCode(\Magento\View\DesignInterface::DEFAULT_AREA); $this->_design->setDesignTheme('vendor_test'); diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Editor/Tools/Controls/ConfigurationTest.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Editor/Tools/Controls/ConfigurationTest.php index 0aa24057245..35a54ca25a2 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Editor/Tools/Controls/ConfigurationTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Editor/Tools/Controls/ConfigurationTest.php @@ -65,13 +65,14 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase public function testLoadConfigurations($type, $controlName, $controlData) { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Filesystem $filesystem */ - $relativePath = $objectManager->get('Magento\Filesystem')->getDirectoryRead(\Magento\Filesystem::ROOT) + /** @var \Magento\App\Filesystem $filesystem */ + $relativePath = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR) ->getRelativePath(__DIR__ . '/../../../_files/design'); - /** @var \Magento\Filesystem\DirectoryList $directoryList */ - $directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); - $directoryList->addDirectory(\Magento\Filesystem::ROOT, array('path' => $relativePath)); - $directoryList->addDirectory(\Magento\Filesystem::THEMES, array('path' => $relativePath)); + /** @var \Magento\App\Filesystem\DirectoryList $directoryList */ + $directoryList = $objectManager->get('Magento\App\Filesystem\DirectoryList'); + $directoryList->addDirectory(\Magento\App\Filesystem::ROOT_DIR, array('path' => $relativePath)); + $directoryList->addDirectory(\Magento\App\Filesystem::THEMES_DIR, array('path' => $relativePath)); $designTheme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\View\DesignInterface') ->getDesignTheme(); diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php index b7a10dd547e..426b36dcc36 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php @@ -26,8 +26,8 @@ */ \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/design') + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/design') ) )); diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Model/ObserverTest.php deleted file mode 100644 index d9c370827ca..00000000000 --- a/dev/tests/integration/testsuite/Magento/Downloadable/Model/ObserverTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Downloadable - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Test class for \Magento\Downloadable\Model\Observer (duplicate downloadable data) - */ -namespace Magento\Downloadable\Model; - -class ObserverTest extends \PHPUnit_Framework_TestCase -{ - /** - * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php - */ - public function testDuplicateProductDownloadableProductWithFilesSuccessfullyDuplicated() - { - $currentProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Catalog\Model\Product'); - $currentProduct->load(1); // fixture for initial product - $currentLinks = $currentProduct->getTypeInstance($currentProduct)->getLinks($currentProduct); - $currentSamples = $currentProduct->getTypeInstance($currentProduct)->getSamples($currentProduct); - - $newProduct = $currentProduct->duplicate(); - - $newLinks = $newProduct->getTypeInstance($newProduct)->getLinks($newProduct); - $newSamples = $newProduct->getTypeInstance($newProduct)->getSamples($newProduct); - - $this->assertEquals($currentLinks, $newLinks); - $this->assertEquals($currentSamples, $newSamples); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php index ed1841c049e..3070f39cf14 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php @@ -111,8 +111,8 @@ class FilterTest extends \PHPUnit_Framework_TestCase public function testLayoutDirective($area, $directiveParams, $expectedOutput) { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/_files/design') + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/_files/design') ) )); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php index 19f87d115b0..97dcaed5a05 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -53,7 +53,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Core\Model\Registry'), $objectManager->get('Magento\Core\Model\App\Emulation'), $objectManager->get('Magento\Core\Model\StoreManager'), - $objectManager->create('Magento\Filesystem'), + $objectManager->create('Magento\App\Filesystem'), $objectManager->create('Magento\View\Url'), $objectManager->create('Magento\View\FileSystem'), $objectManager->create('Magento\Core\Model\Store\Config'), diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php index 233d76053b0..3be9ec8a425 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php @@ -22,8 +22,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/_files/design') + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/_files/design') ) )); $objectManger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php index 37a1b4aa75a..901e7be10d7 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/ReadTest.php @@ -59,6 +59,19 @@ class ReadTest extends \PHPUnit_Framework_TestCase ); } + public function testGetRelativePath() + { + $dir = $this->getDirectoryInstance('foo'); + $this->assertEquals( + '', + $dir->getRelativePath() + ); + $this->assertEquals( + 'bar', + $dir->getRelativePath(__DIR__ . '/../_files/foo/bar') + ); + } + /** * Test for read method * @@ -270,6 +283,32 @@ class ReadTest extends \PHPUnit_Framework_TestCase $this->assertTrue($file instanceof \Magento\Filesystem\File\ReadInterface); } + /** + * Test readFile + * + * @dataProvider readFileProvider + * @param string $path + * @param string $content + */ + public function testReadFile($path, $content) + { + $directory = $this->getDirectoryInstance(''); + $this->assertEquals($content, $directory->readFile($path)); + } + + /** + * Data provider for testReadFile + * + * @return array + */ + public function readFileProvider() + { + return array( + array('popup.csv', 'var myData = 5;'), + array('data.csv', '"field1", "field2"' . PHP_EOL . '"field3", "field4"' . PHP_EOL) + ); + } + /** * Get readable file instance * Get full path for files located in _files directory @@ -286,7 +325,7 @@ class ReadTest extends \PHPUnit_Framework_TestCase $objectManager = Bootstrap::getObjectManager(); $directoryFactory = $objectManager->create('Magento\Filesystem\Directory\ReadFactory'); return $directoryFactory->create($config, - new \Magento\Filesystem\DriverFactory($objectManager->get('Magento\Filesystem\DirectoryList'))); + new \Magento\Filesystem\DriverFactory($objectManager->get('Magento\App\Filesystem\DirectoryList'))); } /** @@ -295,12 +334,14 @@ class ReadTest extends \PHPUnit_Framework_TestCase public function testReadRecursively() { $expected = array( - 'directory/read.txt', - 'directory', - 'directory.txt' + 'bar/baz/file_one.txt', + 'bar', + 'bar/baz', + 'bar/file_two.txt', + 'file_three.txt' ); - $dir = $this->getDirectoryInstance('recursively'); + $dir = $this->getDirectoryInstance('foo'); $actual = $dir->readRecursively(''); $this->assertNotEquals($expected, $actual); sort($expected); diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/WriteTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/WriteTest.php index 4e3b8c968f7..1711b47b674 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Directory/WriteTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/Directory/WriteTest.php @@ -327,6 +327,53 @@ class WriteTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test writeFile + * + * @dataProvider writeFileProvider + * @param string $path + * @param string $content + * @param string $extraContent + */ + public function testWriteFile($path, $content, $extraContent) + { + $directory = $this->getDirectoryInstance('writeFileDir', 0777); + $directory->writeFile($path, $content); + $this->assertEquals($content, $directory->readFile($path)); + $directory->writeFile($path, $extraContent); + $this->assertEquals($extraContent, $directory->readFile($path)); + } + + /** + * Test writeFile for append mode + * + * @dataProvider writeFileProvider + * @param string $path + * @param string $content + * @param string $extraContent + */ + public function testWriteFileAppend($path, $content, $extraContent) + { + $directory = $this->getDirectoryInstance('writeFileDir', 0777); + $directory->writeFile($path, $content, 'a+'); + $this->assertEquals($content, $directory->readFile($path)); + $directory->writeFile($path, $extraContent, 'a+'); + $this->assertEquals($content . $extraContent, $directory->readFile($path)); + } + + /** + * Data provider for testWriteFile and testWriteFileAppend + * + * @return array + */ + public function writeFileProvider() + { + return array( + array('file1', '123', '456'), + array('folder1/file1', '123', '456'), + ); + } + /** * Tear down */ @@ -359,7 +406,7 @@ class WriteTest extends \PHPUnit_Framework_TestCase $objectManager = Bootstrap::getObjectManager(); $directoryFactory = $objectManager->create('Magento\Filesystem\Directory\WriteFactory'); $directory = $directoryFactory->create($config, - new \Magento\Filesystem\DriverFactory($objectManager->get('Magento\Filesystem\DirectoryList'))); + new \Magento\Filesystem\DriverFactory($objectManager->get('Magento\App\Filesystem\DirectoryList'))); $this->testDirectories[] = $directory; return $directory; } diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/Driver/FileTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/Driver/FileTest.php index 6384a1d667a..1c185ce8562 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/Driver/FileTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/Driver/FileTest.php @@ -63,12 +63,15 @@ class FileTest extends \PHPUnit_Framework_TestCase */ public function testReadDirectoryRecursively() { - $expected = array( - $this->getTestPath('recursively/directory'), - $this->getTestPath('recursively/directory.txt'), - $this->getTestPath('recursively/directory/read.txt') + $paths = array( + 'foo/bar', + 'foo/bar/baz', + 'foo/bar/baz/file_one.txt', + 'foo/bar/file_two.txt', + 'foo/file_three.txt' ); - $actual = $this->driver->readDirectoryRecursively($this->getTestPath('recursively')); + $expected = array_map(array('self', 'getTestPath'), $paths); + $actual = $this->driver->readDirectoryRecursively($this->getTestPath('foo')); sort($actual); $this->assertEquals($expected, $actual); } diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/File/ReadTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/File/ReadTest.php index 93b3f1656d8..54e60ee39d5 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/File/ReadTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/File/ReadTest.php @@ -91,6 +91,96 @@ class ReadTest extends \PHPUnit_Framework_TestCase ); } + /** + * Test readAll + * + * @dataProvider readAllProvider + * @param string $path + * @param string $content + */ + public function testReadAll($path, $content) + { + $file = $this->getFileInstance($path); + $this->assertEquals($content, $file->readAll($path)); + } + + /** + * Data provider for testReadFile + * + * @return array + */ + public function readAllProvider() + { + return array( + array('popup.csv', 'var myData = 5;'), + array('data.csv', '"field1", "field2"' . PHP_EOL . '"field3", "field4"' . PHP_EOL) + ); + } + + /** + * Test readLine + * + * @dataProvider readLineProvider + * @param string $path + * @param array $lines + * @param int $length + */ + public function testReadLine($path, $lines, $length) + { + $file = $this->getFileInstance($path); + foreach ($lines as $line) { + $this->assertEquals($line, $file->readLine($length, PHP_EOL)); + } + } + + /** + * Data provider for testReadLine + * + * @return array + */ + public function readLineProvider() + { + return array( + array('popup.csv', array('var myData = 5;'), 999), + array('data.csv', array('"field1", "field2"', '"field3", "field4"'), 999), + array('popup.csv', array('var'), 3), + array('data.csv', array('"f', 'ie', 'ld', '1"'), 2) + ); + } + + /** + * Test for stat method + * + * @dataProvider statProvider + * @param string $path + */ + public function testStat($path) + { + $file = $this->getFileInstance($path); + $expectedInfo = array( + 'dev', 'ino', 'mode', 'nlink', 'uid', + 'gid', 'rdev', 'size', 'atime', + 'mtime', 'ctime', 'blksize', 'blocks' + ); + $result = $file->stat(); + foreach ($expectedInfo as $key) { + $this->assertTrue(array_key_exists($key, $result)); + } + } + + /** + * Data provider for testStat + * + * @return array + */ + public function statProvider() + { + return array( + array('popup.csv'), + array('foo/file_three.txt') + ); + } + /** * Test for readCsv method * diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/FilesystemTest.php b/dev/tests/integration/testsuite/Magento/Filesystem/FilesystemTest.php index 53a22a57927..9cd9b18489c 100644 --- a/dev/tests/integration/testsuite/Magento/Filesystem/FilesystemTest.php +++ b/dev/tests/integration/testsuite/Magento/Filesystem/FilesystemTest.php @@ -36,13 +36,13 @@ use Magento\TestFramework\Helper\Bootstrap; class FilesystemTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; protected function setUp() { - $this->filesystem = Bootstrap::getObjectManager()->create('Magento\Filesystem'); + $this->filesystem = Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); } /** @@ -50,7 +50,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase */ public function testGetDirectoryReadInstance() { - $dir = $this->filesystem->getDirectoryRead(\Magento\Filesystem::VAR_DIR); + $dir = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::VAR_DIR); $this->assertInstanceOf('\Magento\Filesystem\Directory\Read', $dir); } @@ -59,7 +59,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase */ public function testGetDirectoryWriteInstance() { - $dir = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $dir = $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $this->assertInstanceOf('\Magento\Filesystem\Directory\Write', $dir); } @@ -70,7 +70,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase */ public function testGetDirectoryWriteException() { - $this->filesystem->getDirectoryWrite(\Magento\Filesystem::THEMES); + $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::THEMES_DIR); } /** @@ -78,7 +78,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase */ public function testGetPath() { - $this->assertContains('design', $this->filesystem->getPath(\Magento\Filesystem::THEMES)); + $this->assertContains('design', $this->filesystem->getPath(\Magento\App\Filesystem::THEMES_DIR)); } /** @@ -86,6 +86,6 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase */ public function testGetUri() { - $this->assertContains('media', $this->filesystem->getPath(\Magento\Filesystem::MEDIA)); + $this->assertContains('media', $this->filesystem->getPath(\Magento\App\Filesystem::MEDIA_DIR)); } } diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/_files/recursively/directory.txt b/dev/tests/integration/testsuite/Magento/Filesystem/_files/recursively/directory.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/dev/tests/integration/testsuite/Magento/Filesystem/_files/recursively/directory/read.txt b/dev/tests/integration/testsuite/Magento/Filesystem/_files/recursively/directory/read.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php new file mode 100644 index 00000000000..916394f35b8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Catalog + * @subpackage integration_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Model\Product\Type; + +class GroupedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Product\Type + */ + protected $_productType; + + protected function setUp() + { + $this->_productType = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Catalog\Model\Product\Type'); + } + + public function testFactory() + { + $product = new \Magento\Object; + $product->setTypeId(\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE); + $type = $this->_productType->factory($product); + $this->assertInstanceOf('\Magento\GroupedProduct\Model\Product\Type\Grouped', $type); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php similarity index 82% rename from dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php rename to dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php index bda84b7384d..ec54e2dd8ab 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Resource/Product/Type/Grouped/AssociatedProductsCollectionTest.php @@ -22,13 +22,13 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Model\Resource\Product\Type\Grouped; +namespace Magento\GroupedProduct\Model\Resource\Product\Type\Grouped; class AssociatedProductsCollectionTest extends \PHPUnit_Framework_TestCase { /** - * @magentoDataFixture Magento/Catalog/_files/product_grouped.php + * @magentoDataFixture Magento/GroupedProduct/_files/product_grouped.php * @magentoAppIsolation enabled */ public function testGetColumnValues() @@ -41,9 +41,9 @@ class AssociatedProductsCollectionTest $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $objectManager->get('Magento\Core\Model\Registry')->register('current_product', $product); - /** @var \Magento\Catalog\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection $collection */ + /** @var \Magento\GroupedProduct\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection $collection */ $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection' + 'Magento\GroupedProduct\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection' ); $this->assertEquals(array('simple-1', 'virtual-product'), $collection->getColumnValues('sku')); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_grouped.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Catalog/_files/product_grouped.php rename to dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped.php index b666651e749..a3cb6d81ef0 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_grouped.php +++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped.php @@ -22,14 +22,14 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -require __DIR__ . '/product_simple_duplicated.php'; -require __DIR__ . '/product_virtual.php'; +require realpath(__DIR__ . '/../../') . '/Catalog/_files/product_simple_duplicated.php'; +require realpath(__DIR__ . '/../../') . '/Catalog/_files/product_virtual.php'; /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Product'); $product->isObjectNew(true); -$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_GROUPED) +$product->setTypeId(\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE) ->setId(9) ->setAttributeSetId(4) ->setWebsiteIds(array(1)) diff --git a/dev/tests/integration/testsuite/Magento/Image/Adapter/InterfaceTest.php b/dev/tests/integration/testsuite/Magento/Image/Adapter/InterfaceTest.php index 676cb5f3754..5ff85169930 100644 --- a/dev/tests/integration/testsuite/Magento/Image/Adapter/InterfaceTest.php +++ b/dev/tests/integration/testsuite/Magento/Image/Adapter/InterfaceTest.php @@ -586,19 +586,21 @@ class InterfaceTest extends \PHPUnit_Framework_TestCase /** * @dataProvider createPngFromStringDataProvider * - * @param array $pixe1 + * @param array $pixel1 * @param array $expectedColor1 - * @param array $pixe2 + * @param array $pixel2 * @param array $expectedColor2 * @param string $adapterType */ public function testCreatePngFromString($pixel1, $expectedColor1, $pixel2, $expectedColor2, $adapterType) { $adapter = $this->_getAdapter($adapterType); + $path = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem') + ->getPath(\Magento\App\Filesystem::ROOT_DIR) . + '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf'; $adapter->createPngFromString( 'T', - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem')->getPath() - . '/lib/LinLibertineFont/LinLibertine_Re-4.4.1.ttf' + $path ); $adapter->refreshImageDimensions(); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/ProductTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/ProductTest.php index 3f64ada4ba3..18b60d3d0f0 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/Entity/ProductTest.php @@ -88,7 +88,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase */ public function testExportStockItemAttributesAreFilled() { - $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); $filesystemMock->expects($this->once()) diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php index 5ce3d3d4803..506f44b19af 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php @@ -163,9 +163,9 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); // set entity adapter parameters $this->_entityAdapter->setParameters(array('behavior' => $behavior)); - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $this->_objectManager->create('Magento\Filesystem'); - $rootDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = $this->_objectManager->create('Magento\App\Filesystem'); + $rootDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); // set fixture CSV file $result = $this->_entityAdapter diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php index e165134aa2e..cedf1ffa82e 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php @@ -388,9 +388,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $filesystem = $objectManager->create('Magento\Filesystem'); + $filesystem = $objectManager->create('Magento\App\Filesystem'); - $directoryWrite = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $directoryWrite = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $result = $this->_entityAdapter ->setSource(\Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile, $directoryWrite)) @@ -479,8 +479,8 @@ class AddressTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $filesystem = $objectManager->create('Magento\Filesystem'); - $directoryWrite = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $filesystem = $objectManager->create('Magento\App\Filesystem'); + $directoryWrite = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $result = $this->_entityAdapter ->setSource(\Magento\ImportExport\Model\Import\Adapter::findAdapterFor($sourceFile, $directoryWrite)) ->isDataValid(); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php index 517345beada..bcf8b3321e5 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php @@ -51,8 +51,8 @@ class CustomerImportTest extends \PHPUnit_Framework_TestCase $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\ImportExport\Model\Import\Entity\Eav\Customer'); - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $this->directoryWrite = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); + $this->directoryWrite = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); } /** diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/ProductTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/ProductTest.php index 13cd0b251ab..d954db8432c 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/ProductTest.php @@ -101,8 +101,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase $productsBeforeImport[] = $product; } - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $source = new \Magento\ImportExport\Model\Import\Source\Csv( __DIR__ . '/_files/products_to_import.csv', @@ -148,8 +148,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase $stockItems[$productId] = $stockItem; } - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $source = new \Magento\ImportExport\Model\Import\Source\Csv( __DIR__ . '/_files/products_to_import.csv', $directory @@ -192,8 +192,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase // import data from CSV file $pathToFile = __DIR__ . '/_files/product_with_custom_options.csv'; - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $source = new \Magento\ImportExport\Model\Import\Source\Csv($pathToFile, $directory); $this->_model->setSource($source) @@ -254,8 +254,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase $productsBeforeImport[$product->getSku()] = $product; } - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $source = new \Magento\ImportExport\Model\Import\Source\Csv( __DIR__ . '/_files/products_to_import_with_datetime.csv', @@ -524,7 +524,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\Filesystem\Directory\Write $mediaDirectory */ $mediaDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::MEDIA); + ->get('Magento\App\Filesystem')->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $mediaDirectory->create('import'); $dirPath = $mediaDirectory->getAbsolutePath('import'); copy(__DIR__ . '/../../../../../Magento/Catalog/_files/magento_image.jpg', "{$dirPath}/magento_image.jpg"); @@ -537,7 +537,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\Filesystem\Directory\Write $mediaDirectory */ $mediaDirectory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem')->getDirectoryWrite(\Magento\Filesystem::MEDIA); + ->get('Magento\App\Filesystem')->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $mediaDirectory->delete('import'); $mediaDirectory->delete('catalog'); } @@ -584,8 +584,8 @@ class ProductTest extends \PHPUnit_Framework_TestCase { // import data from CSV file $pathToFile = __DIR__ . '/_files/products_to_import_invalid_attribute_set.csv'; - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $source = new \Magento\ImportExport\Model\Import\Source\Csv( $pathToFile, $directory diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php index 49cdd4f0afb..3f191df1fda 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php @@ -37,8 +37,8 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase */ public function testSaveValidatedBunches() { - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); + $directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $source = new \Magento\ImportExport\Model\Import\Source\Csv( __DIR__ . '/Entity/Eav/_files/customers_for_validation_test.csv', $directory diff --git a/dev/tests/integration/testsuite/Magento/Index/Model/Process/FileTest.php b/dev/tests/integration/testsuite/Magento/Index/Model/Process/FileTest.php index 1c1d0acfc15..cd3766b387f 100644 --- a/dev/tests/integration/testsuite/Magento/Index/Model/Process/FileTest.php +++ b/dev/tests/integration/testsuite/Magento/Index/Model/Process/FileTest.php @@ -61,8 +61,8 @@ class FileTest extends \PHPUnit_Framework_TestCase { $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $filesystem = $this->_objectManager->create('Magento\Filesystem'); - $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $filesystem = $this->_objectManager->create('Magento\App\Filesystem'); + $this->_varDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $fullFileName = $this->_varDirectory->getAbsolutePath(self::FILE_PATH); $this->_testFileHandler = fopen($fullFileName, 'w'); diff --git a/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php b/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php index 987c2293406..37c1f2fd424 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Controller/WizardTest.php @@ -41,9 +41,9 @@ class WizardTest extends \Magento\TestFramework\TestCase\AbstractController public static function setUpBeforeClass() { - /** @var \Magento\Filesystem $filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); - $varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem'); + $varDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $tmpDir = 'WizardTest'; $varDirectory->delete($tmpDir); // deliberately create a file instead of directory to emulate broken access to static directory diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php index 2020cfc0f44..0348708a58c 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/ConfigTest.php @@ -53,17 +53,17 @@ class ConfigTest extends \PHPUnit_Framework_TestCase } $cacheState->persist(); - /** @var \Magento\Filesystem $filesystem */ + /** @var \Magento\App\Filesystem $filesystem */ $filesystem = $this->_objectManager->create( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array( 'directoryList' => $this->_objectManager->create( - 'Magento\Filesystem\DirectoryList', + 'Magento\App\Filesystem\DirectoryList', array( 'root' => BP, 'directories' => array( - \Magento\Filesystem::MODULES => array('path' => __DIR__ . '/_files'), - \Magento\Filesystem::CONFIG => array('path' => __DIR__ . '/_files'), + \Magento\App\Filesystem::MODULES_DIR => array('path' => __DIR__ . '/_files'), + \Magento\App\Filesystem::CONFIG_DIR => array('path' => __DIR__ . '/_files'), ) ) ) diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/Installer/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/Installer/ConfigTest.php index 4af84a35642..4cfb00da095 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/Installer/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/Installer/ConfigTest.php @@ -37,9 +37,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { - /** @var \Magento\Filesystem $filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); - self::$_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem'); + self::$_varDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); self::$_tmpDir = self::$_varDirectory->getAbsolutePath('ConfigTest'); self::$_varDirectory->create(self::$_varDirectory->getRelativePath(self::$_tmpDir)); } @@ -69,15 +69,16 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $directoryList = $objectManager->create( - 'Magento\Filesystem\DirectoryList', + 'Magento\App\Filesystem\DirectoryList', array( 'root' => self::$_tmpDir, 'directories' => array( - \Magento\Filesystem::CONFIG => array('path' => self::$_tmpDir) + \Magento\App\Filesystem::CONFIG_DIR => array('path' => self::$_tmpDir) ), ) ); - $filesystem = $objectManager->create('Magento\Filesystem', array('directoryList' => $directoryList)); + $objectManager->get('\Magento\App\Filesystem\DirectoryList\Configuration')->configure($directoryList); + $filesystem = $objectManager->create('Magento\App\Filesystem', array('directoryList' => $directoryList)); $model = $objectManager->create( 'Magento\Install\Model\Installer\Config', array('request' => $request, 'filesystem' => $filesystem) diff --git a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php index 43263afd6be..8fcffa0106b 100644 --- a/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php +++ b/dev/tests/integration/testsuite/Magento/Install/Model/InstallerTest.php @@ -46,9 +46,9 @@ class InstallerTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { - /** @var \Magento\Filesystem $filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); - self::$_varDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem'); + self::$_varDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); self::$_tmpDir = self::$_varDirectory->getAbsolutePath('InstallerTest'); self::$_tmpConfigFile = self::$_tmpDir . '/local.xml'; self::$_varDirectory->create(self::$_varDirectory->getRelativePath(self::$_tmpDir)); @@ -70,15 +70,16 @@ class InstallerTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $directoryList = $objectManager->create( - 'Magento\Filesystem\DirectoryList', - array( - 'root' => __DIR__, - 'directories' => array( - \Magento\Filesystem::CONFIG => array('path' => self::$_tmpDir) - ) - ) - ); - $filesystem = $objectManager->create('Magento\Filesystem', array('directoryList' => $directoryList)); + 'Magento\App\Filesystem\DirectoryList', + array( + 'root' => __DIR__, + 'directories' => array( + \Magento\App\Filesystem::CONFIG_DIR => array('path' => self::$_tmpDir) + ) + ) + ); + $objectManager->get('\Magento\App\Filesystem\DirectoryList\Configuration')->configure($directoryList); + $filesystem = $objectManager->create('Magento\App\Filesystem', array('directoryList' => $directoryList)); if ($emulateConfig) { $installerConfig = new \Magento\Install\Model\Installer\Config( diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Block/Multishipping/OverviewTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php similarity index 92% rename from dev/tests/integration/testsuite/Magento/Checkout/Block/Multishipping/OverviewTest.php rename to dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php index b723ca684b2..8be11c8f187 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Block/Multishipping/OverviewTest.php +++ b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Checkout\Block\Multishipping; +namespace Magento\Multishipping\Block\Checkout; /** * @magentoDataFixture Magento/Catalog/_files/product_simple.php @@ -30,7 +30,7 @@ namespace Magento\Checkout\Block\Multishipping; class OverviewTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Checkout\Block\Multishipping\Overview + * @var \Magento\Multishipping\Block\Checkout\Overview */ protected $_block; @@ -45,7 +45,7 @@ class OverviewTest extends \PHPUnit_Framework_TestCase $this->_objectManager->get('Magento\Core\Model\App') ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->_block = $this->_objectManager->get('Magento\View\LayoutInterface') - ->createBlock('Magento\Checkout\Block\Multishipping\Overview'); + ->createBlock('Magento\Multishipping\Block\Checkout\Overview'); } public function testGetRowItemHtml() diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Controller/MultishippingTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Controller/CheckoutTest.php similarity index 91% rename from dev/tests/integration/testsuite/Magento/Checkout/Controller/MultishippingTest.php rename to dev/tests/integration/testsuite/Magento/Multishipping/Controller/CheckoutTest.php index 599447947e9..0c4325f5bef 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Controller/MultishippingTest.php +++ b/dev/tests/integration/testsuite/Magento/Multishipping/Controller/CheckoutTest.php @@ -25,14 +25,14 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Checkout\Controller; +namespace Magento\Multishipping\Controller; /** - * Test class for \Magento\Checkout\Controller\Multishipping + * Test class for \Magento\Multishipping\Controller\Checkout * * @magentoAppArea frontend */ -class MultishippingTest extends \Magento\TestFramework\TestCase\AbstractController +class CheckoutTest extends \Magento\TestFramework\TestCase\AbstractController { /** * Covers app/code/Magento/Checkout/Block/Multishipping/Payment/Info.php @@ -56,7 +56,7 @@ class MultishippingTest extends \Magento\TestFramework\TestCase\AbstractControll ->create('Magento\Customer\Model\Session', array($logger)); $session->login('customer@example.com', 'password'); $this->getRequest()->setPost('payment', array('method' => 'checkmo')); - $this->dispatch('checkout/multishipping/overview'); + $this->dispatch('multishipping/checkout/overview'); $html = $this->getResponse()->getBody(); $this->assertContains('<div class="box method">', $html); $this->assertContains('<dt class="title">' diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php index 0092af95b9a..098a317fe9b 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php @@ -78,7 +78,7 @@ class QueueTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Core\Model\Registry'), $appEmulation, $objectManager->get('Magento\Core\Model\StoreManagerInterface'), - $objectManager->get('Magento\Filesystem'), + $objectManager->get('Magento\App\Filesystem'), $objectManager->get('Magento\View\Url'), $objectManager->get('Magento\View\FileSystem'), $objectManager->get('Magento\Core\Model\Store\ConfigInterface'), @@ -124,7 +124,7 @@ class QueueTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Core\Model\Registry'), $objectManager->get('Magento\Core\Model\App\Emulation'), $objectManager->get('Magento\Core\Model\StoreManagerInterface'), - $objectManager->get('Magento\Filesystem'), + $objectManager->get('Magento\App\Filesystem'), $objectManager->get('Magento\View\Url'), $objectManager->get('Magento\View\FileSystem'), $objectManager->get('Magento\Core\Model\Store\ConfigInterface'), diff --git a/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php index 8d3dd51cf6b..036810c24e8 100644 --- a/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Object/Copy/Config/ReaderTest.php @@ -38,16 +38,16 @@ class ReaderTest extends \PHPUnit_Framework_TestCase public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Filesystem $filesystem */ + /** @var \Magento\App\Filesystem $filesystem */ $filesystem = $objectManager->create( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('directoryList' => $objectManager->create( - 'Magento\Filesystem\DirectoryList', + 'Magento\App\Filesystem\DirectoryList', array( 'root' => BP, 'directories' => array( - \Magento\Filesystem::MODULES => array('path' => __DIR__ . '/_files'), - \Magento\Filesystem::CONFIG => array('path' => __DIR__ . '/_files'), + \Magento\App\Filesystem::MODULES_DIR => array('path' => __DIR__ . '/_files'), + \Magento\App\Filesystem::CONFIG_DIR => array('path' => __DIR__ . '/_files'), ) ) ) diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Helper/DataTest.php deleted file mode 100644 index cb023da6423..00000000000 --- a/dev/tests/integration/testsuite/Magento/PageCache/Helper/DataTest.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PageCache - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\PageCache\Helper; - -class DataTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\PageCache\Helper\Data - */ - protected $_helper; - - protected function setUp() - { - $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\PageCache\Helper\Data'); - } - - public function testSetNoCacheCookie() - { - /** @var $cookie \Magento\Stdlib\Cookie */ - $cookie = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Stdlib\Cookie'); - $this->assertEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - $this->_helper->setNoCacheCookie(); - $this->assertNotEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - } - - public function testRemoveNoCacheCookie() - { - /** @var $cookie \Magento\Stdlib\Cookie */ - $cookie = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Stdlib\Cookie'); - $this->_helper->setNoCacheCookie(); - $this->_helper->removeNoCacheCookie(); - $this->assertEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - } - - public function testLockUnlockNoCacheCookie() - { - /** @var $cookie \Magento\Stdlib\Cookie */ - $cookie = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Stdlib\Cookie'); - $this->_helper->setNoCacheCookie(); - $this->assertNotEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - - $this->_helper->lockNoCacheCookie(); - $this->_helper->removeNoCacheCookie(); - $this->assertNotEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - - $this->_helper->unlockNoCacheCookie(); - $this->_helper->removeNoCacheCookie(); - $this->assertEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - - $this->_helper->lockNoCacheCookie(); - $this->_helper->setNoCacheCookie(); - $this->assertEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - } -} diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/ObserverTest.php deleted file mode 100644 index a8b48fd34fd..00000000000 --- a/dev/tests/integration/testsuite/Magento/PageCache/Model/ObserverTest.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PageCache - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\PageCache\Model; - -class ObserverTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\PageCache\Model\Observer - */ - protected $_observer; - - protected function setUp() - { - $this->_observer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\PageCache\Model\Observer'); - } - - /** - * @magentoConfigFixture current_store system/external_page_cache/enabled 1 - */ - public function testSetNoCacheCookie() - { - /** @var $cookie \Magento\Stdlib\Cookie */ - $cookie = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Stdlib\Cookie'); - $this->assertEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - $this->_observer->setNoCacheCookie(new \Magento\Event\Observer()); - $this->assertNotEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - } - - /** - * @magentoConfigFixture current_store system/external_page_cache/enabled 1 - */ - public function testDeleteNoCacheCookie() - { - /** @var $cookie \Magento\Stdlib\Cookie */ - $cookie = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Stdlib\Cookie'); - $cookie->set(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE, '1'); - $this->_observer->deleteNoCacheCookie(new \Magento\Event\Observer()); - $this->assertEmpty($cookie->get(\Magento\PageCache\Helper\Data::NO_CACHE_COOKIE)); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php index 0bfd1b8de9c..1717f69c96e 100644 --- a/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php +++ b/dev/tests/integration/testsuite/Magento/Persistent/Model/Persistent/ConfigTest.php @@ -39,16 +39,16 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $directoryList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create( - 'Magento\Filesystem\DirectoryList', + 'Magento\App\Filesystem\DirectoryList', array( - 'root' => \Magento\Filesystem::ROOT, + 'root' => \Magento\App\Filesystem::ROOT_DIR, 'directories' => array( - \Magento\Filesystem::MODULES => array('path' => dirname(__DIR__)) + \Magento\App\Filesystem::MODULES_DIR => array('path' => dirname(__DIR__)) ), ) ); $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Filesystem', array('directoryList' => $directoryList)); + ->create('Magento\App\Filesystem', array('directoryList' => $directoryList)); $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_model = $this->_objectManager->create( diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Shipment/ItemsTest.php b/dev/tests/integration/testsuite/Magento/Shipping/Block/ItemsTest.php similarity index 93% rename from dev/tests/integration/testsuite/Magento/Sales/Block/Order/Shipment/ItemsTest.php rename to dev/tests/integration/testsuite/Magento/Shipping/Block/ItemsTest.php index 88f99435ea3..4e2ff762a29 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/Shipment/ItemsTest.php +++ b/dev/tests/integration/testsuite/Magento/Shipping/Block/ItemsTest.php @@ -25,14 +25,14 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sales\Block\Order\Shipment; +namespace Magento\Shipping\Block; class ItemsTest extends \PHPUnit_Framework_TestCase { public function testGetCommentsHtml() { $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface'); - $block = $layout->createBlock('Magento\Sales\Block\Order\Shipment\Items', 'block'); + $block = $layout->createBlock('Magento\Shipping\Block\Items', 'block'); $childBlock = $layout->addBlock('Magento\View\Element\Text', 'shipment_comments', 'block'); $shipment = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Sales\Model\Order\Shipment'); diff --git a/dev/tests/integration/testsuite/Magento/Sitemap/_files/sitemap_products.php b/dev/tests/integration/testsuite/Magento/Sitemap/_files/sitemap_products.php index 512908daa4c..ced8e7a0928 100644 --- a/dev/tests/integration/testsuite/Magento/Sitemap/_files/sitemap_products.php +++ b/dev/tests/integration/testsuite/Magento/Sitemap/_files/sitemap_products.php @@ -31,9 +31,9 @@ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $config = $objectManager->get('Magento\Catalog\Model\Product\Media\Config'); /** @var \Magento\Filesystem\Directory\WriteInterface $mediaDirectory */ -$filesystem = $objectManager->get('Magento\Filesystem'); -$mediaPath = $filesystem->getPath(\Magento\Filesystem::MEDIA); -$mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); +$filesystem = $objectManager->get('Magento\App\Filesystem'); +$mediaPath = $filesystem->getPath(\Magento\App\Filesystem::MEDIA_DIR); +$mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $baseTmpMediaPath = $config->getBaseTmpMediaPath(); $mediaDirectory->create($baseTmpMediaPath); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/ServiceCallsConfigTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/ServiceCallsConfigTest.php deleted file mode 100644 index 401fdcdf428..00000000000 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/ServiceCallsConfigTest.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Find service_calls definitions and validate that name, service and method are present. - * - * Also validate that service is an existing class and the method exists on the service class. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Test\Integrity\Magento\Core\Model\DataService; - -class ServiceCallsConfigTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider xmlDataProvider - */ - public function testXmlFile($configFile, $dummy = false) - { - if (!$dummy) { - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($configFile)); - $this->assertNotNull($dom); - $serviceCalls = $dom->getElementsByTagName('service_calls')->item(0); - if ($serviceCalls->hasChildNodes()) { - foreach ($serviceCalls->childNodes as $serviceCall) { - /** @var $serviceCall \DOMNode */ - if ($serviceCall->localName == 'service_call') { - $name = $serviceCall->attributes->getNamedItem('name')->nodeValue; - $service = $serviceCall->attributes->getNamedItem('service')->nodeValue; - $method = $serviceCall->attributes->getNamedItem('method')->nodeValue; - try { - $ref = new \ReflectionClass($service); - } catch (\ReflectionException $re) { - $this->fail( - "$configFile has service_call $name with non-existent service class $service: $re" - ); - } - $this->assertTrue( - $ref->hasMethod($method), - "$configFile has service_call $name invalid method $method" - ); - } - } - } - } - } - - public function xmlDataProvider() - { - $files = \Magento\TestFramework\Utility\Files::init()->getConfigFiles('service_calls.xml', array()); - if (empty($files)) { - $files = array( - array('dummy', true) - ); - } - return $files; - } -} - diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php index eae2d99c74e..961095e777e 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/AclConfigFilesTest.php @@ -45,8 +45,8 @@ class AclConfigFilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_schemeFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') - ->getPath(\Magento\Filesystem::LIB) . '/Magento/Acl/etc/acl.xsd'; + $this->_schemeFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem') + ->getPath(\Magento\App\Filesystem::LIB_DIR) . '/Magento/Acl/etc/acl.xsd'; } /** @@ -71,8 +71,8 @@ class AclConfigFilesTest extends \PHPUnit_Framework_TestCase public function aclConfigFileDataProvider() { $fileList = glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') - ->getPath(\Magento\Filesystem::APP) . '/*/*/*/etc/adminhtml/acl.xml' + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem') + ->getPath(\Magento\App\Filesystem::APP_DIR) . '/*/*/*/etc/adminhtml/acl.xml' ); $dataProviderResult = array(); foreach ($fileList as $file) { diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php index 31c1930c55c..317985f82e1 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/DiConfigFilesTest.php @@ -47,9 +47,9 @@ class DiConfigFilesTest extends \PHPUnit_Framework_TestCase { //init primary configs $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $filesystem \Magento\Filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - $configDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + $configDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::CONFIG_DIR); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); self::$_primaryFiles = $fileIteratorFactory->create( $configDirectory, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php index dca405bf4fd..fecdb44c846 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/EavAttributesConfigFilesTest.php @@ -33,9 +33,9 @@ class EavAttributesConfigFilesTest extends \PHPUnit_Framework_TestCase public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $filesystem \Magento\Filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); $xmlFiles = $fileIteratorFactory->create( $modulesDirectory, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php index 913b76b4470..42d9d4c8d63 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ExportConfigFilesTest.php @@ -33,9 +33,9 @@ class ExportConfigFilesTest extends \PHPUnit_Framework_TestCase public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $filesystem \Magento\Filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); $xmlFiles = $fileIteratorFactory->create( $modulesDirectory, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php index 0b81c914b34..19ec1b00b18 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ImportConfigFilesTest.php @@ -33,9 +33,9 @@ class ImportConfigFilesTest extends \PHPUnit_Framework_TestCase public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $filesystem \Magento\Filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); $xmlFiles = $fileIteratorFactory->create( $modulesDirectory, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php index 6f4cf8978d8..1e0e28245af 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/IndexerConfigFilesTest.php @@ -33,9 +33,9 @@ class IndexerConfigFilesTest extends \PHPUnit_Framework_TestCase public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $filesystem \Magento\Filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); $xmlFiles = $fileIteratorFactory->create( $modulesDirectory, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php index b5151936c28..36c7ea13e54 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php @@ -104,7 +104,7 @@ class LayoutFilesTest extends \PHPUnit_Framework_TestCase // ignored objects || isset($argument['value']['object']) && in_array($argument['value']['object'], array( - 'Magento\Catalog\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection', + 'Magento\GroupedProduct\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection', 'Magento\Catalog\Model\Resource\Product\Collection\AssociatedProduct', 'Magento\Search\Model\Resource\Search\Grid\Collection', 'Magento\Wishlist\Model\Resource\Item\Collection\Grid', diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php index c316d25107b..7b03d3d876c 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductOptionsConfigFilesTest.php @@ -34,9 +34,9 @@ class ProductOptionsConfigFilesTest extends \PHPUnit_Framework_TestCase { //init primary configs $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $filesystem \Magento\Filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); $xmlFiles = $fileIteratorFactory->create( $modulesDirectory, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php index 0d2a9bdfe6b..4f041380438 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ProductTypesConfigFilesTest.php @@ -33,9 +33,9 @@ class ProductTypesConfigFilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $filesystem \Magento\Filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); $xmlFiles = $fileIteratorFactory->create( $modulesDirectory, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php index 769d318398d..3bf8f0fe9fd 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ResourcesConfigFilesTest.php @@ -33,9 +33,9 @@ class ResourcesConfigFilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $filesystem \Magento\Filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - $modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + $modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); $fileIteratorFactory = $objectManager->get('Magento\Config\FileIteratorFactory'); $xmlFiles = $fileIteratorFactory->create( $modulesDirectory, diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ServiceCallsConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ServiceCallsConfigFilesTest.php deleted file mode 100644 index a4a66f00679..00000000000 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ServiceCallsConfigFilesTest.php +++ /dev/null @@ -1,117 +0,0 @@ -<?php -/** - * Tests that existing service_calls.xml files are valid to schema. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Test\Integrity\Modular; - -class ServiceCallsConfigFilesTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var string - */ - protected $_schemaFile; - - /** - * @var \Magento\Core\Model\DataService\Config\Reader - */ - protected $_reader; - - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $serviceCallsFiles = $this->getServiceCallsConfigFiles(); - if (!empty($serviceCallsFiles)) { - $this->_reader = $this->_objectManager->create('Magento\Core\Model\DataService\Config\Reader', array( - 'configFiles' => $serviceCallsFiles)); - $this->_schemaFile = $this->_reader->getSchemaFile(); - } - } - - protected function tearDown() - { - $this->_objectManager->removeSharedInstance('Magento\Core\Model\DataService\Config\Reader'); - } - - public function getServiceCallsConfigFiles() - { - return glob( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem') - ->getPath(\Magento\Filesystem::APP) - . '/*/*/*/etc/service_calls.xml' - ); - } - - public function serviceCallsConfigFilesProvider() - { - $fileList = $this->getServiceCallsConfigFiles(); - if (empty($fileList)) { - return array(array(false, true)); - } - - $dataProviderResult = array(); - foreach ($fileList as $file) { - $dataProviderResult[$file] = array($file); - } - return $dataProviderResult; - } - - /** - * @dataProvider serviceCallsConfigFilesProvider - */ - public function testServiceCallsConfigFile($file, $skip = false) - { - if ($skip) { - $this->markTestSkipped('There is no service_calls.xml files in the system'); - } - $domConfig = new \Magento\Config\Dom(file_get_contents($file)); - $result = $domConfig->validate($this->_schemaFile, $errors); - $message = "Invalid XML-file: {$file}\n"; - foreach ($errors as $error) { - $message .= "$error\n"; - } - - $this->assertTrue($result, $message); - } - - public function testMergedConfig() - { - if (is_null($this->_reader)) { - $this->markTestSkipped('There is no service_calls.xml files in the system'); - return; - } - - try { - $this->_reader->validate(); - } catch (\Magento\Exception $e) { - $this->fail($e->getMessage()); - } - } -} diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php index a1dcc6f63ee..271f9666b52 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/SystemConfigFilesTest.php @@ -38,7 +38,7 @@ class SystemConfigFilesTest extends \PHPUnit_Framework_TestCase $cacheState = $objectManager->get('Magento\App\Cache\StateInterface'); $cacheState->setEnabled(\Magento\App\Cache\Type\Config::TYPE_IDENTIFIER, false); - $modulesDir = $objectManager->get('Magento\Filesystem')->getPath(\Magento\Filesystem::MODULES); + $modulesDir = $objectManager->get('Magento\App\Filesystem')->getPath(\Magento\App\Filesystem::MODULES_DIR); $fileList = glob($modulesDir . '/*/*/etc/adminhtml/system.xml'); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php index 4f29b1c7eaf..f4f8d73f072 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewConfigFilesTest.php @@ -38,7 +38,7 @@ class ViewConfigFilesTest extends \PHPUnit_Framework_TestCase $domConfig = new \Magento\Config\Dom($file); $result = $domConfig->validate( \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem')->getPath(\Magento\Filesystem::LIB) + ->get('Magento\App\Filesystem')->getPath(\Magento\App\Filesystem::LIB_DIR) . '/Magento/Config/etc/view.xsd', $errors ); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php index d7549d8961c..0d765ba18a6 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/ViewFilesTest.php @@ -240,7 +240,7 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity { $this->markTestIncomplete('Should be fixed when static when we have static folder jslib implemented'); $this->assertFileExists( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem')->getPath('jslib') + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem')->getPath('jslib') . '/' . $file ); } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php index 069f178e092..53ef9985d6d 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Theme/XmlFilesTest.php @@ -42,7 +42,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase } $this->_validateConfigFile( $file, - $this->getPath(\Magento\Filesystem::LIB) . '/Magento/Config/etc/view.xsd' + $this->getPath(\Magento\App\Filesystem::LIB_DIR) . '/Magento/Config/etc/view.xsd' ); } @@ -53,7 +53,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase { $result = array(); $files = glob( - $this->getPath(\Magento\Filesystem::THEMES) . '/*/*/view.xml' + $this->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/*/*/view.xml' ); foreach ($files as $file) { $result[$file] = array($file); @@ -77,7 +77,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase { $result = array(); $files = glob( - $this->getPath(\Magento\Filesystem::THEMES) . '/*/*', GLOB_ONLYDIR + $this->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/*/*', GLOB_ONLYDIR ); foreach ($files as $themeDir) { $result[$themeDir] = array($themeDir); @@ -93,7 +93,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase { $this->_validateConfigFile( $file, - $this->getPath(\Magento\Filesystem::LIB) . '/Magento/Config/etc/theme.xsd' + $this->getPath(\Magento\App\Filesystem::LIB_DIR) . '/Magento/Config/etc/theme.xsd' ); } @@ -118,7 +118,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase { $result = array(); $files = glob( - $this->getPath(\Magento\Filesystem::THEMES) . '/*/*/theme.xml' + $this->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/*/*/theme.xml' ); foreach ($files as $file) { $result[$file] = array($file); @@ -152,6 +152,7 @@ class XmlFilesTest extends \PHPUnit_Framework_TestCase */ protected function getPath($code) { - return \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem')->getPath($code); + return \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\App\Filesystem')->getPath($code); } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/ProcessorTest.php b/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/ProcessorTest.php index 64ef86bbb3a..a02640baac7 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/ProcessorTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Tools/Layout/Reference/ProcessorTest.php @@ -61,8 +61,8 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase } $this->_testDir = realpath(__DIR__ . '/_files') . '/'; - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); - $this->_varDir = $filesystem->getPath(\Magento\Filesystem::VAR_DIR) . '/references/'; + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem'); + $this->_varDir = $filesystem->getPath(\Magento\App\Filesystem::VAR_DIR) . '/references/'; mkdir($this->_varDir, 0777, true); $this->_formatter = new Formatter(); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeControllerTest.php b/dev/tests/integration/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeControllerTest.php index 4a65c7b2fd7..20ea2b3848e 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeControllerTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeControllerTest.php @@ -32,14 +32,14 @@ namespace Magento\Theme\Controller\Adminhtml\System\Design; */ class ThemeControllerTest extends \Magento\Backend\Utility\Controller { - /** @var \Magento\Filesystem */ + /** @var \Magento\App\Filesystem */ protected $_filesystem; protected function setUp() { parent::setUp(); - $this->_filesystem = $this->_objectManager->get('Magento\Filesystem'); + $this->_filesystem = $this->_objectManager->get('Magento\App\Filesystem'); } /** @@ -58,9 +58,9 @@ class ThemeControllerTest extends \Magento\Backend\Utility\Controller ); $directoryList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem\DirectoryList'); - /** @var $directoryList \Magento\Filesystem\DirectoryList */ - $directoryList->addDirectory(\Magento\Filesystem::SYS_TMP, + ->get('Magento\App\Filesystem\DirectoryList'); + /** @var $directoryList \Magento\App\Filesystem\DirectoryList */ + $directoryList->addDirectory(\Magento\App\Filesystem::SYS_TMP_DIR, array('path' => '/')); $theme = $this->_objectManager->create('Magento\View\Design\ThemeInterface')->getCollection()->getFirstItem(); @@ -84,8 +84,8 @@ class ThemeControllerTest extends \Magento\Backend\Utility\Controller * Uploader can copy(upload) and then remove this temporary file. */ $fileName = __DIR__ . '/_files/simple-js-file.js'; - $varDir = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); - $rootDir = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $varDir = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); + $rootDir = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $destinationFilePath = 'simple-js-file.js'; $rootDir->copyFile($rootDir->getRelativePath($fileName), $destinationFilePath, $varDir); diff --git a/dev/tests/integration/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php b/dev/tests/integration/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php index fa4e5436ae1..93aa117e9ec 100644 --- a/dev/tests/integration/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php @@ -47,7 +47,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase protected $_helperStorage; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -71,22 +71,22 @@ class StorageTest extends \PHPUnit_Framework_TestCase $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $directoryList = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Filesystem\DirectoryList'); + ->get('Magento\App\Filesystem\DirectoryList'); $dirPath = ltrim(str_replace($directoryList->getRoot(), '', str_replace('\\', '/', __DIR__)) . '/_files', '/'); $tmpDirPath = ltrim(str_replace($directoryList->getRoot(), '', str_replace('\\', '/', realpath(__DIR__ . '/../../../../../tmp'))), '/'); - $directoryList->addDirectory(\Magento\Filesystem::VAR_DIR, array('path' => $dirPath)); - $directoryList->addDirectory(\Magento\Filesystem::TMP, array('path' => $tmpDirPath)); - $directoryList->addDirectory(\Magento\Filesystem::MEDIA, array('path' => $tmpDirPath)); + $directoryList->addDirectory(\Magento\App\Filesystem::VAR_DIR, array('path' => $dirPath)); + $directoryList->addDirectory(\Magento\App\Filesystem::TMP_DIR, array('path' => $tmpDirPath)); + $directoryList->addDirectory(\Magento\App\Filesystem::MEDIA_DIR, array('path' => $tmpDirPath)); $this->_filesystem = $this->_objectManager->create( - 'Magento\Filesystem', array('directoryList' => $directoryList) + 'Magento\App\Filesystem', array('directoryList' => $directoryList) ); - $this->directoryVar = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); - $this->directoryTmp = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::TMP); + $this->directoryVar = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); + $this->directoryTmp = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::TMP_DIR); /** @var $theme \Magento\View\Design\ThemeInterface */ $theme = $this->_objectManager->create('Magento\View\Design\ThemeInterface')->getCollection()->getFirstItem(); diff --git a/dev/tests/integration/testsuite/Magento/View/Asset/MergedTest.php b/dev/tests/integration/testsuite/Magento/View/Asset/MergedTest.php index 339c97dd200..1505f3842a0 100644 --- a/dev/tests/integration/testsuite/Magento/View/Asset/MergedTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Asset/MergedTest.php @@ -46,18 +46,18 @@ class MergedTest extends \PHPUnit_Framework_TestCase public static function setUpBeforeClass() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $objectManager->get('Magento\Filesystem'); - self::$_themePublicDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::STATIC_VIEW); - self::$_viewPublicMergedDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB_VIEW_CACHE); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = $objectManager->get('Magento\App\Filesystem'); + self::$_themePublicDir = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::STATIC_VIEW_DIR); + self::$_viewPublicMergedDir = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR); } protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => dirname(dirname(__DIR__)) . '/_files/design'), - \Magento\Filesystem::PUB => array('path' => BP), + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(dirname(__DIR__)) . '/_files/design'), + \Magento\App\Filesystem::PUB_DIR => array('path' => BP), ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); diff --git a/dev/tests/integration/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php b/dev/tests/integration/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php index 0f34894d43f..f3ef55dce76 100644 --- a/dev/tests/integration/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php @@ -63,14 +63,14 @@ class FallbackTest extends \PHPUnit_Framework_TestCase { // Prepare config with directories $filesystem = Bootstrap::getObjectManager()->create( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array( 'directoryList' => Bootstrap::getObjectManager()->create( - 'Magento\Filesystem\DirectoryList', + 'Magento\App\Filesystem\DirectoryList', array( 'root' => $this->_baseDir, 'directories' => array( - \Magento\Filesystem::THEMES => array('path' => $this->_viewDir) + \Magento\App\Filesystem::THEMES_DIR => array('path' => $this->_viewDir) ) ) ) diff --git a/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php b/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php index 3bde1ddd9ef..9bb7de97aee 100644 --- a/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Element/AbstractBlockTest.php @@ -27,7 +27,7 @@ namespace Magento\View\Element; -use Magento\Filesystem\DirectoryList; +use Magento\App\Filesystem\DirectoryList; /** * @magentoAppIsolation enabled @@ -65,12 +65,13 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase public function testCssWithWrongImage() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Filesystem $filesystem */ - $relativePath = $objectManager->get('Magento\Filesystem')->getDirectoryRead(\Magento\Filesystem::ROOT) + /** @var \Magento\App\Filesystem $filesystem */ + $relativePath = $objectManager->get('Magento\App\Filesystem') + ->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR) ->getRelativePath(__DIR__ . '/_files'); - /** @var $directoryList \Magento\Filesystem\DirectoryList */ - $directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); - $directoryList->addDirectory(\Magento\Filesystem::THEMES, array('path' => $relativePath)); + /** @var $directoryList \Magento\App\Filesystem\DirectoryList */ + $directoryList = $objectManager->get('Magento\App\Filesystem\DirectoryList'); + $directoryList->addDirectory(\Magento\App\Filesystem::THEMES_DIR, array('path' => $relativePath)); $cssUrl = $this->_block->getViewFileUrl('css/wrong.css', array( 'area' => 'frontend', diff --git a/dev/tests/integration/testsuite/Magento/View/FileSystemTest.php b/dev/tests/integration/testsuite/Magento/View/FileSystemTest.php index 83638955f29..bc0e8911087 100644 --- a/dev/tests/integration/testsuite/Magento/View/FileSystemTest.php +++ b/dev/tests/integration/testsuite/Magento/View/FileSystemTest.php @@ -39,8 +39,8 @@ class FileSystemTest extends \PHPUnit_Framework_TestCase protected function setUp() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/Core/Model/_files/design') + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/Core/Model/_files/design') ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); diff --git a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php index fc4a86744c5..1ec8929ad5f 100644 --- a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php +++ b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php @@ -60,9 +60,9 @@ class PublicationTest extends \PHPUnit_Framework_TestCase protected function tearDown() { - /** @var \Magento\Filesystem $filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Filesystem'); - $publicDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::STATIC_VIEW); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\App\Filesystem'); + $publicDir = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::STATIC_VIEW_DIR); $publicDir->delete('adminhtml'); $publicDir->delete('frontend'); $this->_model = null; @@ -73,9 +73,9 @@ class PublicationTest extends \PHPUnit_Framework_TestCase */ public function testGetPublicDir() { - /** @var $filesystem \Magento\Filesystem */ - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem'); - $expectedPublicDir = $filesystem->getPath(\Magento\Filesystem::STATIC_VIEW); + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem'); + $expectedPublicDir = $filesystem->getPath(\Magento\App\Filesystem::STATIC_VIEW_DIR); $this->assertEquals($expectedPublicDir, $this->_viewService->getPublicDir()); } @@ -440,8 +440,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase { $appInstallDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir(); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => "$appInstallDir/media_for_change"), + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => "$appInstallDir/media_for_change"), ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -531,8 +531,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase { $appInstallDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir(); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => "$appInstallDir/media_for_change"), + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => "$appInstallDir/media_for_change"), ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -579,8 +579,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase protected function _initTestTheme($allowDuplication = null) { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/Core/Model/_files/design/') + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/Core/Model/_files/design/') ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -616,8 +616,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase public function testCssWithBase64Data() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/Core/Model/_files/design/') + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/Core/Model/_files/design/') ) )); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadAreaPart( @@ -674,8 +674,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase public function testGetViewFilePublicPathExistingFile() { $filePath = 'mage/mage.js'; - $expectedFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Filesystem') - ->getPath(\Magento\Filesystem::PUB_LIB) . '/' . $filePath; + $expectedFile = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Filesystem') + ->getPath(\Magento\App\Filesystem::PUB_LIB_DIR) . '/' . $filePath; $this->assertFileExists($expectedFile, 'Please verify existence of public library file'); $actualFile = $this->_viewUrl->getViewFilePublicPath($filePath); diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php index cd30e248c06..5aab31a69e5 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/DataTest.php @@ -38,34 +38,34 @@ class DataTest extends \PHPUnit_Framework_TestCase protected $_configData; /** - * @var \Magento\Filesystem\DirectoryList + * @var \Magento\App\Filesystem\DirectoryList */ protected $directoryList; public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Filesystem $filesystem */ + /** @var \Magento\App\Filesystem $filesystem */ $filesystem = $objectManager->create( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('directoryList' => $objectManager->create( - 'Magento\Filesystem\DirectoryList', + 'Magento\App\Filesystem\DirectoryList', array( 'root' => BP, 'directories' => array( - \Magento\Filesystem::MODULES => array('path' => __DIR__ . '/_files/code'), - \Magento\Filesystem::CONFIG => array('path' => __DIR__ . '/_files/code'), - \Magento\Filesystem::THEMES => array('path' => __DIR__ . '/_files/design') + \Magento\App\Filesystem::MODULES_DIR => array('path' => __DIR__ . '/_files/code'), + \Magento\App\Filesystem::CONFIG_DIR => array('path' => __DIR__ . '/_files/code'), + \Magento\App\Filesystem::THEMES_DIR => array('path' => __DIR__ . '/_files/design') ) ) ) ) ); - $this->directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); + $this->directoryList = $objectManager->get('Magento\App\Filesystem\DirectoryList'); $dirPath = ltrim(str_replace($this->directoryList->getRoot(), '', str_replace('\\', '/', __DIR__)) . '/_files', '/'); - $this->directoryList->addDirectory(\Magento\Filesystem::MODULES, array('path' => $dirPath)); + $this->directoryList->addDirectory(\Magento\App\Filesystem::MODULES_DIR, array('path' => $dirPath)); /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $objectManager->create( diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php index 76d1ea791d9..56d3f3adeb6 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php @@ -33,24 +33,24 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase private $_object; /** - * @var \Magento\Filesystem\DirectoryList + * @var \Magento\App\Filesystem\DirectoryList */ protected $directoryList; public function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Filesystem $filesystem */ + /** @var \Magento\App\Filesystem $filesystem */ $filesystem = $objectManager->create( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('directoryList' => $objectManager->create( - 'Magento\Filesystem\DirectoryList', + 'Magento\App\Filesystem\DirectoryList', array( 'root' => BP, 'directories' => array( - \Magento\Filesystem::MODULES => array('path' => __DIR__ . '/_files/code'), - \Magento\Filesystem::THEMES => array('path' => __DIR__ . '/_files/design'), - \Magento\Filesystem::CONFIG => array('path' => __DIR__ . '/_files/'), + \Magento\App\Filesystem::MODULES_DIR => array('path' => __DIR__ . '/_files/code'), + \Magento\App\Filesystem::THEMES_DIR => array('path' => __DIR__ . '/_files/design'), + \Magento\App\Filesystem::CONFIG_DIR => array('path' => __DIR__ . '/_files/'), ) ) ) @@ -79,10 +79,10 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase 'filesystem' => $filesystem )); - $this->directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); + $this->directoryList = $objectManager->get('Magento\App\Filesystem\DirectoryList'); $dirPath = ltrim(str_replace($this->directoryList->getRoot(), '', str_replace('\\', '/', __DIR__)) . '/_files', '/'); - $this->directoryList->addDirectory(\Magento\Filesystem::MODULES, array('path' => $dirPath)); + $this->directoryList->addDirectory(\Magento\App\Filesystem::MODULES_DIR, array('path' => $dirPath)); } diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php index 117377a5ccb..a68c2dcf067 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/Config/ReaderTest.php @@ -28,7 +28,7 @@ namespace Magento\Widget\Model\Config; class ReaderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Filesystem\DirectoryList + * @var \Magento\App\Filesystem\DirectoryList */ protected $directoryList; @@ -42,14 +42,14 @@ class ReaderTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->directoryList = $objectManager->get('Magento\Filesystem\DirectoryList'); + $this->directoryList = $objectManager->get('Magento\App\Filesystem\DirectoryList'); $dirPath = ltrim(str_replace($this->directoryList->getRoot(), '', str_replace('\\', '/', __DIR__)) . '/_files', '/'); - $this->directoryList->addDirectory(\Magento\Filesystem::MODULES, array('path' => $dirPath . '/code')); - $this->directoryList->addDirectory(\Magento\Filesystem::CONFIG, array('path' => $dirPath)); - $this->directoryList->addDirectory(\Magento\Filesystem::ROOT, array('path' => $dirPath)); + $this->directoryList->addDirectory(\Magento\App\Filesystem::MODULES_DIR, array('path' => $dirPath . '/code')); + $this->directoryList->addDirectory(\Magento\App\Filesystem::CONFIG_DIR, array('path' => $dirPath)); + $this->directoryList->addDirectory(\Magento\App\Filesystem::ROOT_DIR, array('path' => $dirPath)); - $filesystem = $objectManager->create('Magento\Filesystem', array('directoryList' => $this->directoryList)); + $filesystem = $objectManager->create('Magento\App\Filesystem', array('directoryList' => $this->directoryList)); /** @var \Magento\Module\Declaration\FileResolver $modulesDeclarations */ $modulesDeclarations = $objectManager->create( diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php index a61926ece18..826810c1eed 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php @@ -69,8 +69,10 @@ class WidgetTest extends \PHPUnit_Framework_TestCase $objectManager->get('Magento\Core\Model\App') ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager->get('Magento\View\DesignInterface')->setDesignTheme('magento_backend'); - $expectedPubFile = $objectManager->get('Magento\Filesystem') - ->getPath(\Magento\Filesystem::STATIC_VIEW) . "/adminhtml/magento_backend/en_US/{$expectedFile}"; + $expectedFilePath = "/adminhtml/magento_backend/en_US/{$expectedFile}"; + $expectedPubFile = $objectManager->get('Magento\App\Filesystem') + ->getPath(\Magento\App\Filesystem::STATIC_VIEW_DIR) . $expectedFilePath; + if (file_exists($expectedPubFile)) { unlink($expectedPubFile); } @@ -107,8 +109,8 @@ class WidgetTest extends \PHPUnit_Framework_TestCase public function testGetPlaceholderImageUrlAtTheme() { \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( - \Magento\Filesystem::PARAM_APP_DIRS => array( - \Magento\Filesystem::THEMES => array('path' => dirname(__DIR__) . '/_files/design') + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => dirname(__DIR__) . '/_files/design') ) )); $actualFile = $this->testGetPlaceholderImageUrl( diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Helper/DataTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Helper/DataTest.php new file mode 100644 index 00000000000..485bf04a527 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Helper/DataTest.php @@ -0,0 +1,107 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Wishlist + * @subpackage integration_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Wishlist\Helper; + +class DataTest extends \Magento\TestFramework\TestCase\AbstractController +{ + /** + * @var Data + */ + private $wishlistHelper; + + /** + * @var \Magento\ObjectManager + */ + private $objectManager; + + /** + * Get requrer instance + */ + protected function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->wishlistHelper = $this->objectManager->get('Magento\Wishlist\Helper\Data'); + } + + /** + * Clear wishlist helper property + */ + protected function tearDown() + { + $this->_wishlistHelper = null; + } + + public function testGetAddParams() + { + $product = $this->objectManager->get('Magento\Catalog\Model\Product'); + $product->setId(11); + $json = $this->wishlistHelper->getAddParams($product); + $params = (array) json_decode($json); + $data = (array) $params['data']; + $this->assertEquals('11', $data['product']); + $this->assertArrayHasKey('form_key', $data); + $this->assertArrayHasKey('uenc', $data); + $this->assertStringEndsWith( + 'wishlist/index/add/', + $params['action'] + ); + } + + public function testGetMoveFromCartParams() + { + $json = $this->wishlistHelper->getMoveFromCartParams(11); + $params = (array) json_decode($json); + $data = (array) $params['data']; + $this->assertEquals('11', $data['item']); + $this->assertArrayHasKey('form_key', $data); + $this->assertArrayHasKey('uenc', $data); + $this->assertStringEndsWith( + 'wishlist/index/fromcart/', + $params['action'] + ); + } + + public function testGetUpdateParams() + { + $product = $this->objectManager->get('Magento\Catalog\Model\Product'); + $product->setId(11); + $product->setWishlistItemId(15); + $json = $this->wishlistHelper->getUpdateParams($product); + $params = (array) json_decode($json); + $data = (array) $params['data']; + $this->assertEquals('11', $data['product']); + $this->assertEquals('15', $data['id']); + $this->assertArrayHasKey('form_key', $data); + $this->assertArrayHasKey('uenc', $data); + $this->assertStringEndsWith( + 'wishlist/index/updateItemOptions/', + $params['action'] + ); + } + +} diff --git a/dev/tests/performance/framework/Magento/TestFramework/Application.php b/dev/tests/performance/framework/Magento/TestFramework/Application.php index 4cebc1770ad..1db471fe515 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Application.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Application.php @@ -195,8 +195,8 @@ class Application protected function _updateFilesystemPermissions() { /** @var \Magento\Filesystem\Directory\Write $varDirectory */ - $varDirectory = $this->getObjectManager()->get('Magento\Filesystem') - ->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $varDirectory = $this->getObjectManager()->get('Magento\App\Filesystem') + ->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $varDirectory->changePermissions('', 0777); } diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/DbRule.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/DbRule.php index ba085b83842..d811e9d08a6 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/DbRule.php +++ b/dev/tests/static/framework/Magento/TestFramework/Dependency/DbRule.php @@ -39,16 +39,12 @@ class DbRule implements \Magento\TestFramework\Dependency\RuleInterface /** * Constructor + * + * @param array $tables */ - public function __construct() + public function __construct(array $tables) { - $replaceFilePattern = str_replace('\\', '/', realpath(__DIR__)) . '/_files/*.php'; - - $this->_moduleTableMap = array(); - foreach (glob($replaceFilePattern) as $fileName) { - $tables = @include $fileName; - $this->_moduleTableMap = array_merge($this->_moduleTableMap, $tables); - } + $this->_moduleTableMap = $tables; } /** diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/LayoutRule.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/LayoutRule.php index 65e3cebac97..099f3ac46e8 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/LayoutRule.php +++ b/dev/tests/static/framework/Magento/TestFramework/Dependency/LayoutRule.php @@ -30,21 +30,6 @@ namespace Magento\TestFramework\Dependency; class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface { - /** - * Cases to search dependencies - * - * @var array - */ - protected $_cases = array( - '_caseAttributeModule', - '_caseElementBlock', - '_caseElementAction', - '_caseLayoutHandle', - '_caseLayoutHandleParent', - '_caseLayoutHandleUpdate', - '_caseLayoutReference', - ); - /** * Default modules list. * @@ -100,22 +85,6 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface */ protected $_mapLayoutHandles = array(); - /** - * List of exceptions - * - * Format: array( - * '{Exception_Type}' => '{Source}' - * ) - * - * @var array - */ - protected $_exceptions = array(); - - /** - * Display exceptions - */ - const EXCEPTION_ALLOWED = false; - /** * Unknown layout handle */ @@ -133,22 +102,16 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface /** * Constructor + * + * @param array $mapRouters + * @param array $mapLayoutBlocks + * @param array $mapLayoutHandles */ - public function __construct() + public function __construct(array $mapRouters, array $mapLayoutBlocks, array $mapLayoutHandles) { - $args = func_get_args(); - if (count($args)) { - if (isset($args[0]['mapRouters'])) { - $this->_mapRouters = $args[0]['mapRouters']; - } - if (isset($args[0]['mapLayoutBlocks'])) { - $this->_mapLayoutBlocks = $args[0]['mapLayoutBlocks']; - } - if (isset($args[0]['mapLayoutHandles'])) { - $this->_mapLayoutHandles = $args[0]['mapLayoutHandles']; - } - } - + $this->_mapRouters = $mapRouters; + $this->_mapLayoutBlocks = $mapLayoutBlocks; + $this->_mapLayoutHandles = $mapLayoutHandles; $this->_namespaces = implode('|', \Magento\TestFramework\Utility\Files::init()->getNamespaces()); } @@ -167,43 +130,18 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface return array(); } - $this->_exceptions = array(); + $attributes = $this->_caseAttributeModule($currentModule, $contents); + $blocks = $this->_caseElementBlock($currentModule, $contents); + $actions = $this->_caseElementAction($currentModule, $contents); + $handle = $this->_caseLayoutHandle($currentModule, $file, $contents); + $handleParents = $this->_caseLayoutHandleParent($currentModule, $file, $contents); + $handleUpdates = $this->_caseLayoutHandleUpdate($currentModule, $file, $contents); + $references = $this->_caseLayoutReference($currentModule, $file, $contents); - $dependencies = array(); - foreach ($this->_cases as $case) { - if (method_exists($this, $case)) { - $result = $this->$case($currentModule, $fileType, $file, $contents); - if (count($result)) { - $dependencies = array_merge($dependencies, $result); - } - } - } - return array_merge($dependencies, $this->_applyExceptions()); - } - - /** - * Apply exceptions - * - * @return array - */ - protected function _applyExceptions() - { - if (!self::EXCEPTION_ALLOWED) { - return array(); - } - - $result = array(); - foreach ($this->_exceptions as $type => $source) { - if (is_array($source)) { - $source = array_keys($source); - } - $result[] = array( - 'exception' => $type, - 'module' => '', - 'source' => $source, - ); - } - return $result; + $dependencies = array_merge( + $attributes, $blocks, $actions, $handle, $handleParents, $handleUpdates, $references + ); + return $dependencies; } /** @@ -212,19 +150,14 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface * Ex.: <element module="{module}"> * * @param $currentModule - * @param $fileType - * @param $file * @param $contents * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _caseAttributeModule($currentModule, $fileType, $file, &$contents) + protected function _caseAttributeModule($currentModule, &$contents) { $patterns = array( - \Magento\Test\Integrity\DependencyTest::TYPE_SOFT => '/(?<source><.+module\s*=\s*[\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)[\'"].*>)/', + . '(?<module>[A-Z][a-zA-Z]+)[\'"].*>)/' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, ); return $this->_checkDependenciesByRegexp($currentModule, $contents, $patterns); } @@ -236,22 +169,17 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface * <block template="{path}"> * * @param $currentModule - * @param $fileType - * @param $file * @param $contents * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _caseElementBlock($currentModule, $fileType, $file, &$contents) + protected function _caseElementBlock($currentModule, &$contents) { $patterns = array( - \Magento\Test\Integrity\DependencyTest::TYPE_HARD => '/(?<source><block.*class\s*=\s*[\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)[_\\\\](?:[A-Z][a-zA-Z]+[_\\\\]?){1,}[\'"].*>)/', - \Magento\Test\Integrity\DependencyTest::TYPE_SOFT => + . '(?<module>[A-Z][a-zA-Z]+)[_\\\\]' + . '(?:[A-Z][a-zA-Z]+[_\\\\]?){1,}[\'"].*>)/' => \Magento\Test\Integrity\DependencyTest::TYPE_HARD, '/(?<source><block.*template\s*=\s*[\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)::[\w\/\.]+[\'"].*>)/', + . '(?<module>[A-Z][a-zA-Z]+)::[\w\/\.]+[\'"].*>)/' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, ); return $this->_checkDependenciesByRegexp($currentModule, $contents, $patterns); } @@ -265,28 +193,24 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface * <element helper="{name}"> * * @param $currentModule - * @param $fileType - * @param $file * @param $contents * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _caseElementAction($currentModule, $fileType, $file, &$contents) + protected function _caseElementAction($currentModule, &$contents) { $patterns = array( - \Magento\Test\Integrity\DependencyTest::TYPE_SOFT => '/(?<source><block\s*>(?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)[_\\\\](?:[A-Z][a-zA-Z]+[_\\\\]?){1,}<\/block\s*>)/', - \Magento\Test\Integrity\DependencyTest::TYPE_SOFT => + . '(?<module>[A-Z][a-zA-Z]+)[_\\\\]' + . '(?:[A-Z][a-zA-Z]+[_\\\\]?){1,}<\/block\s*>)/' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, '/(?<source><template\s*>(?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)::[\w\/\.]+<\/template\s*>)/', - \Magento\Test\Integrity\DependencyTest::TYPE_SOFT => + . '(?<module>[A-Z][a-zA-Z]+)::[\w\/\.]+' + . '<\/template\s*>)/' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, '/(?<source><file\s*>(?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)::[\w\/\.-]+<\/file\s*>)/', - \Magento\Test\Integrity\DependencyTest::TYPE_SOFT => + . '(?<module>[A-Z][a-zA-Z]+)::[\w\/\.-]+' + . '<\/file\s*>)/' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, '/(?<source><.*helper\s*=\s*[\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)[_\\\\](?:[A-Z][a-z]+[_\\\\]?){1,}::[\w]+[\'"].*>)/', + . '(?<module>[A-Z][a-zA-Z]+)[_\\\\](?:[A-Z][a-z]+[_\\\\]?){1,}::[\w]+' + . '[\'"].*>)/' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, ); return $this->_checkDependenciesByRegexp($currentModule, $contents, $patterns); } @@ -297,28 +221,33 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface * Ex.: <layout><{name}>...</layout> * * @param $currentModule - * @param $fileType * @param $file * @param $contents * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _caseLayoutHandle($currentModule, $fileType, $file, &$contents) + protected function _caseLayoutHandle($currentModule, $file, &$contents) { - $xml = simplexml_load_file($file); + $xml = @simplexml_load_string($contents); + if (!$xml) { + return array(); + } $area = $this->_getAreaByFile($file); $result = array(); foreach ((array)$xml->xpath('/layout/child::*') as $element) { $check = $this->_checkDependencyLayoutHandle($currentModule, $area, $element->getName()); - $module = isset($check['module']) ? $check['module'] : null; - if ($module) { - $result[$module] = array( - 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, - 'source' => $element->getName(), - ); + $modules = isset($check['module']) ? $check['module'] : null; + if ($modules) { + if (!is_array($modules)) { + $modules = [$modules]; + } + foreach ($modules as $module) { + $result[$module] = array( + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + 'source' => $element->getName(), + ); + } } } return $this->_getUniqueDependencies($result); @@ -330,28 +259,33 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface * Ex.: <layout_name parent="{name}"> * * @param $currentModule - * @param $fileType * @param $file * @param $contents * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _caseLayoutHandleParent($currentModule, $fileType, $file, &$contents) + protected function _caseLayoutHandleParent($currentModule, $file, &$contents) { - $xml = simplexml_load_file($file); + $xml = @simplexml_load_string($contents); + if (!$xml) { + return array(); + } $area = $this->_getAreaByFile($file); $result = array(); foreach ((array)$xml->xpath('/layout/child::*/@parent') as $element) { $check = $this->_checkDependencyLayoutHandle($currentModule, $area, (string)$element); - $module = isset($check['module']) ? $check['module'] : null; - if ($module) { - $result[$module] = array( - 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_HARD, - 'source' => (string)$element, - ); + $modules = isset($check['module']) ? $check['module'] : null; + if ($modules) { + if (!is_array($modules)) { + $modules = [$modules]; + } + foreach ($modules as $module) { + $result[$module] = array( + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_HARD, + 'source' => (string)$element, + ); + } } } return $this->_getUniqueDependencies($result); @@ -363,28 +297,33 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface * Ex.: <update handle="{name}" /> * * @param $currentModule - * @param $fileType * @param $file * @param $contents * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _caseLayoutHandleUpdate($currentModule, $fileType, $file, &$contents) + protected function _caseLayoutHandleUpdate($currentModule, $file, &$contents) { - $xml = simplexml_load_file($file); + $xml = @simplexml_load_string($contents); + if (!$xml) { + return array(); + } $area = $this->_getAreaByFile($file); $result = array(); foreach ((array)$xml->xpath('//update/@handle') as $element) { $check = $this->_checkDependencyLayoutHandle($currentModule, $area, (string)$element); - $module = isset($check['module']) ? $check['module'] : null; - if ($module) { - $result[$module] = array( - 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, - 'source' => (string)$element, - ); + $modules = isset($check['module']) ? $check['module'] : null; + if ($modules) { + if (!is_array($modules)) { + $modules = [$modules]; + } + foreach ($modules as $module) { + $result[$module] = array( + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + 'source' => (string)$element, + ); + } } } return $this->_getUniqueDependencies($result); @@ -396,16 +335,16 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface * Ex.: <reference name="{name}"> * * @param $currentModule - * @param $fileType * @param $file * @param $contents * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - protected function _caseLayoutReference($currentModule, $fileType, $file, &$contents) + protected function _caseLayoutReference($currentModule, $file, &$contents) { - $xml = simplexml_load_file($file); + $xml = @simplexml_load_string($contents); + if (!$xml) { + return array(); + } $area = $this->_getAreaByFile($file); @@ -434,7 +373,7 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface protected function _checkDependenciesByRegexp($currentModule, &$contents, $patterns = array()) { $result = array(); - foreach ($patterns as $type => $pattern) { + foreach ($patterns as $pattern => $type) { if (preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { $module = $match['namespace'] . '\\' . $match['module']; @@ -472,9 +411,9 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface $router = implode('_', $chunks); if (isset($this->_mapRouters[$router])) { // CASE 1: Single dependency - $module = $this->_mapRouters[$router]; - if ($currentModule != $module) { - return array('module' => $module); + $modules = $this->_mapRouters[$router]; + if (!in_array($currentModule, $modules)) { + return array('module' => $modules); } } @@ -495,14 +434,8 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface if (isset($modules[$defaultModule])) { return array('module' => $defaultModule); } - - // CASE 5: \Exception - Undefined dependency - $undefinedDependency = implode(', ', $modules); - $this->_exceptions[self::EXCEPTION_TYPE_UNDEFINED_DEPENDENCY][$undefinedDependency] = $undefinedDependency; } - // CASE 6: \Exception - Undefined handle - $this->_exceptions[self::EXCEPTION_TYPE_UNKNOWN_HANDLE][$handle] = $handle; return array(); } @@ -538,14 +471,7 @@ class LayoutRule implements \Magento\TestFramework\Dependency\RuleInterface if (isset($modules[$defaultModule])) { return array('module' => $defaultModule); } - - // CASE 4: \Exception - Undefined dependency - $undefinedDependency = implode(', ', $modules); - $this->_exceptions[self::EXCEPTION_TYPE_UNDEFINED_DEPENDENCY][$undefinedDependency] = $undefinedDependency; } - - // CASE 5: \Exception - Undefined block - $this->_exceptions[self::EXCEPTION_TYPE_UNKNOWN_BLOCK][$block] = $block; return array(); } diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php index 03fd97b9ee3..17ccfc54eb0 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php +++ b/dev/tests/static/framework/Magento/TestFramework/Dependency/PhpRule.php @@ -31,6 +31,53 @@ namespace Magento\TestFramework\Dependency; class PhpRule implements \Magento\TestFramework\Dependency\RuleInterface { + /** + * List of routers + * + * Format: array( + * '{Router}' => '{Module_Name}' + * ) + * + * @var array + */ + protected $_mapRouters = array(); + + /** + * List of layout blocks + * + * Format: array( + * '{Area}' => array( + * '{Block_Name}' => array('{Module_Name}' => '{Module_Name}') + * )) + * + * @var array + */ + protected $_mapLayoutBlocks = array(); + + /** + * Default modules list. + * + * @var array + */ + protected $_defaultModules = array( + 'default' => 'Magento\Install', + 'frontend' => 'Magento\Theme', + 'adminhtml' => 'Magento\Adminhtml', + ); + + /** + * Constructor + * + * @param array $mapRouters + * @param array $mapLayoutBlocks + */ + public function __construct(array $mapRouters, array $mapLayoutBlocks) + { + $this->_mapRouters = $mapRouters; + $this->_mapLayoutBlocks = $mapLayoutBlocks; + $this->_namespaces = implode('|', \Magento\TestFramework\Utility\Files::init()->getNamespaces()); + } + /** * Gets alien dependencies information for current module by analyzing file's contents * @@ -42,7 +89,7 @@ class PhpRule implements \Magento\TestFramework\Dependency\RuleInterface */ public function getDependencyInfo($currentModule, $fileType, $file, &$contents) { - if (!in_array($fileType, array('php'))) { + if (!in_array($fileType, ['php', 'template'])) { return array(); } @@ -55,7 +102,7 @@ class PhpRule implements \Magento\TestFramework\Dependency\RuleInterface $matches['module'] = array_unique($matches['module']); foreach ($matches['module'] as $i => $referenceModule) { $referenceModule = str_replace('_', '\\', $referenceModule); - if ($currentModule == $referenceModule || $referenceModule == 'Magento\MagentoException') { + if ($currentModule == $referenceModule) { continue; } $dependenciesInfo[] = array( @@ -65,6 +112,183 @@ class PhpRule implements \Magento\TestFramework\Dependency\RuleInterface ); } } + $result = $this->_caseGetUrl($currentModule, $contents); + if (count($result)) { + $dependenciesInfo = array_merge($dependenciesInfo, $result); + } + $result = $this->_caseLayoutBlock($currentModule, $fileType, $file, $contents); + if (count($result)) { + $dependenciesInfo = array_merge($dependenciesInfo, $result); + } + return $dependenciesInfo; } + + /** + * Check get URL method + * + * Ex.: getUrl('{path}') + * + * @param $currentModule + * @param $contents + * @return array + */ + protected function _caseGetUrl($currentModule, &$contents) + { + $pattern = '/[\->:]+(?<source>getUrl\([\'"](?<router>[\w\/*]+)[\'"])/'; + + $dependencies = array(); + if (!preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER)) { + return $dependencies; + } + + foreach ($matches as $item) { + $router = str_replace('/', '\\', $item['router']); + if (isset($this->_mapRouters[$router])) { + $modules = $this->_mapRouters[$router]; + if (!in_array($currentModule, $modules)) { + foreach ($modules as $module) { + $dependencies[] = array( + 'module' => $module, + 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, + 'source' => $item['source'], + ); + } + } + } + } + return $dependencies; + } + + /** + * Check layout blocks + * + * @param $currentModule + * @param $fileType + * @param $file + * @param $contents + * @return array + */ + protected function _caseLayoutBlock($currentModule, $fileType, $file, &$contents) + { + $pattern = '/[\->:]+(?<source>(?:getBlock|getBlockHtml)\([\'"](?<block>[\w\.\-]+)[\'"]\))/'; + + $area = $this->_getAreaByFile($file, $fileType); + + $result = array(); + if (!preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER)) { + return $result; + } + + foreach ($matches as $match) { + if (in_array($match['block'], ['root', 'content'])) { + continue; + } + $check = $this->_checkDependencyLayoutBlock($currentModule, $area, $match['block']); + $module = isset($check['module']) ? $check['module'] : null; + if ($module) { + $result[$module] = array( + 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, + 'source' => $match['source'], + ); + } + } + return $this->_getUniqueDependencies($result); + } + + /** + * Get area from file path + * + * @param $file + * @param $fileType + * @return string|null + */ + protected function _getAreaByFile($file, $fileType) + { + if ($fileType == 'php') { + return null; + } + $area = 'default'; + if (preg_match('/\/(?<area>adminhtml|frontend)\//', $file, $matches)) { + $area = $matches['area']; + } + return $area; + } + + /** + * Check layout block dependency + * + * Return: array( + * 'module' // dependent module + * 'source' // source text + * ) + * + * @param $currentModule + * @param $area + * @param $block + * @return array + */ + protected function _checkDependencyLayoutBlock($currentModule, $area, $block) + { + if (isset($this->_mapLayoutBlocks[$area][$block]) || is_null($area)) { + // CASE 1: No dependencies + $modules = []; + if (is_null($area)) { + foreach ($this->_mapLayoutBlocks as $blocks) { + if (array_key_exists($block, $blocks)) { + $modules += $blocks[$block]; + } + } + } else { + $modules = $this->_mapLayoutBlocks[$area][$block]; + } + if (isset($modules[$currentModule])) { + return array('module' => null); + } + // CASE 2: Single dependency + if (1 == count($modules)) { + return array('module' => current($modules)); + } + // CASE 3: Default module dependency + $defaultModule = $this->_getDefaultModuleName($area); + if (isset($modules[$defaultModule])) { + return array('module' => $defaultModule); + } + } + // CASE 4: \Exception - Undefined block + return array(); + } + + /** + * Retrieve default module name (by area) + * + * @param string $area + * @return null + */ + protected function _getDefaultModuleName($area = 'default') + { + if (isset($this->_defaultModules[$area])) { + return $this->_defaultModules[$area]; + } + return null; + } + + /** + * Retrieve unique dependencies + * + * @param array $dependencies + * @return array + */ + protected function _getUniqueDependencies($dependencies = array()) + { + $result = array(); + foreach ($dependencies as $module => $value) { + $result[] = array( + 'module' => $module, + 'type' => $value['type'], + 'source' => $value['source'], + ); + } + return $result; + } } diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/TemplateRule.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/TemplateRule.php deleted file mode 100644 index 62815e0523a..00000000000 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/TemplateRule.php +++ /dev/null @@ -1,494 +0,0 @@ -<?php -/** - * Rule for searching dependencies in layout files - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento - * @subpackage static_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\TestFramework\Dependency; - -class TemplateRule implements \Magento\TestFramework\Dependency\RuleInterface -{ - /** - * Cases to search dependencies - * - * @var array - */ - protected $_cases = array( - '_caseModelSingleton', - '_caseHelper', - '_caseCreateBlock', - '_caseConstant', - '_caseAddFile', - '_caseGetUrl', - '_caseLayoutBlock', - ); - - /** - * Default modules list. - * - * @var array - */ - protected $_defaultModules = array( - 'default' => 'Magento_Install', - 'frontend' => 'Magento_Theme', - 'adminhtml' => 'Magento_Adminhtml', - ); - - /** - * Namespaces to analyze - * - * Format: {Namespace}|{Namespace}|... - * - * @var string - */ - protected $_namespaces; - - /** - * List of routers - * - * Format: array( - * '{Router}' => '{Module_Name}' - * ) - * - * @var array - */ - protected $_mapRouters = array(); - - /** - * List of layout blocks - * - * Format: array( - * '{Area}' => array( - * '{Block_Name}' => array('{Module_Name}' => '{Module_Name}') - * )) - * - * @var array - */ - protected $_mapLayoutBlocks = array(); - - /** - * List of exceptions - * - * Format: array( - * '{Exception_Type}' => '{Source}' - * ) - * - * @var array - */ - protected $_exceptions = array(); - - /** - * Display exceptions - */ - const EXCEPTION_ALLOWED = false; - - /** - * Unknown layout block - */ - const EXCEPTION_TYPE_UNKNOWN_BLOCK = 'UNKNOWN_BLOCK'; - - /** - * Undefined dependency - */ - const EXCEPTION_TYPE_UNDEFINED_DEPENDENCY = 'UNDEFINED_DEPENDENCY'; - - /** - * Constructor - */ - public function __construct() - { - $args = func_get_args(); - if (count($args)) { - if (isset($args[0]['mapRouters'])) { - $this->_mapRouters = $args[0]['mapRouters']; - } - if (isset($args[0]['mapLayoutBlocks'])) { - $this->_mapLayoutBlocks = $args[0]['mapLayoutBlocks']; - } - } - - $this->_namespaces = implode('|', \Magento\TestFramework\Utility\Files::init()->getNamespaces()); - } - - /** - * Retrieve dependencies information for current module - * - * @param string $currentModule - * @param string $fileType - * @param string $file - * @param string $contents - * @return array - */ - public function getDependencyInfo($currentModule, $fileType, $file, &$contents) - { - if ('template' != $fileType) { - return array(); - } - - $this->_exceptions = array(); - - $dependencies = array(); - foreach ($this->_cases as $case) { - if (method_exists($this, $case)) { - $result = $this->$case($currentModule, $fileType, $file, $contents); - if (count($result)) { - $dependencies = array_merge($dependencies, $result); - } - } - } - return array_merge($dependencies, $this->_applyExceptions()); - } - - /** - * Apply exceptions - * - * @return array - */ - protected function _applyExceptions() - { - if (!self::EXCEPTION_ALLOWED) { - return array(); - } - - $result = array(); - foreach ($this->_exceptions as $type => $source) { - if (is_array($source)) { - $source = array_keys($source); - } - $result[] = array( - 'exception' => $type, - 'module' => '', - 'source' => $source, - ); - } - return $result; - } - - /** - * Check models calls - * - * Ex.: \Mage::getModel('{Class_Name}') - * \Mage::getSingleton('{Class_Name}') - * \Mage::getBlockSingleton('{Class_Name}') - * - * @param $currentModule - * @param $fileType - * @param $file - * @param $contents - * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _caseModelSingleton($currentModule, $fileType, $file, &$contents) - { - $patterns = array( - \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD => - '/(?<source>Mage::(?:getModel|getSingleton|getBlockSingleton)+\([\'"]' - . '(?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)\w*[\'"]\))/', - ); - return $this->_checkDependenciesByRegexp($currentModule, $contents, $patterns); - } - - /** - * Check helpers calls - * - * Ex.: \Mage::helper('{Class_Name}') - * $this->helper('{Class_Name}') - * - * @param $currentModule - * @param $fileType - * @param $file - * @param $contents - * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _caseHelper($currentModule, $fileType, $file, &$contents) - { - $patterns = array( - \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD => - '/(?<source>[$a-zA-Z0-9_\->:]+helper\([\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)\w*)/', - ); - return $this->_checkDependenciesByRegexp($currentModule, $contents, $patterns); - } - - /** - * Check createBlock() methods - * - * Ex.: createBlock('{Class_Name}') - * - * @param $currentModule - * @param $fileType - * @param $file - * @param $contents - * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _caseCreateBlock($currentModule, $fileType, $file, &$contents) - { - $patterns = array( - \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD => - '/[\->:]+(?<source>createBlock\([\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)\w*)/', - ); - return $this->_checkDependenciesByRegexp($currentModule, $contents, $patterns); - } - - /** - * Check using of constants - * - * Ex.: {Class_Name}::{Constant_Name} - * - * @param $currentModule - * @param $fileType - * @param $file - * @param $contents - * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _caseConstant($currentModule, $fileType, $file, &$contents) - { - $patterns = array( - \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD => - '/(?<source>(?<namespace>' . $this->_namespaces . ')[_\\\\](?<module>[A-Z][a-zA-Z]+)[_\\\\]' - . '(?:[A-Z][a-z]+[_\\\\]?){1,}::[A-Z[_\\\\]]+)/', - ); - return $this->_checkDependenciesByRegexp($currentModule, $contents, $patterns); - } - - /** - * Check adding additional files - * - * Ex.: $this->getViewFileUrl('{Module_name}::{File_Name}') - * - * @param $currentModule - * @param $fileType - * @param $file - * @param $contents - * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _caseAddFile($currentModule, $fileType, $file, &$contents) - { - $patterns = array( - \Magento\TestFramework\Dependency\RuleInterface::TYPE_SOFT => - '/(?<source>[$a-zA-Z0-9_\->:]+getViewFileUrl\([\'"](?<namespace>' . $this->_namespaces . ')[_\\\\]' - . '(?<module>[A-Z][a-zA-Z]+)::[\w\/\.-]+)/', - ); - return $this->_checkDependenciesByRegexp($currentModule, $contents, $patterns); - } - - /** - * Check get URL method - * - * Ex.: getUrl('{path}') - * - * @param $currentModule - * @param $fileType - * @param $file - * @param $contents - * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _caseGetUrl($currentModule, $fileType, $file, &$contents) - { - $pattern = '/[\->:]+(?<source>getUrl\([\'"](?<router>[\w\/*]+)[\'"])/'; - - $dependencies = array(); - if (preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER)) { - foreach ($matches as $item) { - $router = str_replace('/', '\\', $item['router']); - if (isset($this->_mapRouters[$router])) { - $moduleName = $this->_mapRouters[$router]; - if ($currentModule != $moduleName) { - $dependencies[] = array( - 'module' => $moduleName, - 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_SOFT, - 'source' => $item['source'], - ); - } - } - } - } - return $dependencies; - } - - /** - * Check layout blocks - * - * @param $currentModule - * @param $fileType - * @param $file - * @param $contents - * @return array - * - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - protected function _caseLayoutBlock($currentModule, $fileType, $file, &$contents) - { - $pattern = '/[\->:]+(?<source>(?:getBlock|getBlockHtml)\([\'"](?<block>[\w\.\-]+)[\'"]\))/'; - - $area = $this->_getAreaByFile($file); - - $result = array(); - if (preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER)) { - foreach ($matches as $match) { - $check = $this->_checkDependencyLayoutBlock($currentModule, $area, $match['block']); - $module = isset($check['module']) ? $check['module'] : null; - if ($module) { - $result[$module] = array( - 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, - 'source' => $match['source'], - ); - } - } - } - return $this->_getUniqueDependencies($result); - } - - /** - * Search dependencies by defined regexp patterns - * - * @param $currentModule - * @param $contents - * @param array $patterns - * @return array - */ - protected function _checkDependenciesByRegexp($currentModule, $contents, $patterns = array()) - { - $result = array(); - foreach ($patterns as $type => $pattern) { - if (preg_match_all($pattern, $contents, $matches, PREG_SET_ORDER)) { - foreach ($matches as $match) { - $module = $match['namespace'] . '\\' . $match['module']; - if ($currentModule != $module) { - $result[$module] = array( - 'type' => $type, - 'source' => $match['source'], - ); - } - } - } - } - return $this->_getUniqueDependencies($result); - } - - /** - * Check layout block dependency - * - * Return: array( - * 'module' // dependent module - * 'source' // source text - * ) - * - * @param $currentModule - * @param $area - * @param $block - * @return array - */ - protected function _checkDependencyLayoutBlock($currentModule, $area, $block) - { - if (isset($this->_mapLayoutBlocks[$area][$block])) { - // CASE 1: No dependencies - $modules = $this->_mapLayoutBlocks[$area][$block]; - if (isset($modules[$currentModule])) { - return array('module' => null); - } - - // CASE 2: Single dependency - if (1 == count($modules)) { - return array('module' => current($modules)); - } - - // CASE 3: Default module dependency - $defaultModule = $this->_getDefaultModuleName($area); - if (isset($modules[$defaultModule])) { - return array('module' => $defaultModule); - } - - // CASE 4: \Exception - Undefined dependency - $undefinedDependency = implode(', ', $modules); - $this->_exceptions[self::EXCEPTION_TYPE_UNDEFINED_DEPENDENCY][$undefinedDependency] = $undefinedDependency; - } - - // CASE 5: \Exception - Undefined block - $this->_exceptions[self::EXCEPTION_TYPE_UNKNOWN_BLOCK][$block] = $block; - return array(); - } - - /** - * Get area from file path - * - * @param $file - * @return string - */ - protected function _getAreaByFile($file) - { - $area = 'default'; - if (preg_match('/\/(?<area>adminhtml|frontend)\//', $file, $matches)) { - $area = $matches['area']; - } - return $area; - } - - /** - * Retrieve default module name (by area) - * - * @param string $area - * @return null - */ - protected function _getDefaultModuleName($area = 'default') - { - if (isset($this->_defaultModules[$area])) { - return $this->_defaultModules[$area]; - } - return null; - } - - /** - * Retrieve unique dependencies - * - * @param array $dependencies - * @return array - */ - protected function _getUniqueDependencies($dependencies = array()) - { - $result = array(); - foreach ($dependencies as $module => $value) { - $result[] = array( - 'module' => $module, - 'type' => $value['type'], - 'source' => $value['source'], - ); - } - return $result; - } -} diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DbRuleTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DbRuleTest.php new file mode 100644 index 00000000000..7f9df5b091a --- /dev/null +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/DbRuleTest.php @@ -0,0 +1,88 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento + * @subpackage static_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\TestFramework\Dependency; + +class DbRuleTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var DbRule + */ + protected $model; + + protected function setUp() + { + $this->model = new DbRule(['some_table' => 'SomeModule']); + } + + /** + * @param string $module + * @param string $file + * @param string $contents + * @param array $expected + * @dataProvider getDependencyInfoDataProvider + */ + public function testGetDependencyInfo($module, $file, $contents, array $expected) + { + $this->assertEquals($expected, $this->model->getDependencyInfo($module, 'any', $file, $contents)); + } + + public function getDependencyInfoDataProvider() + { + return [ + ['any', 'non-resource-file-path.php', 'any', []], + [ + 'any', + '/app/some/path/sql/some-file.php', + '$install->getTableName("unknown_table")', + [['module' => 'Unknown', 'source' => 'unknown_table']] + ], + [ + 'any', + '/app/some/path/data/some-file.php', + '$install->getTableName("unknown_table")', + [['module' => 'Unknown', 'source' => 'unknown_table']] + ], + [ + 'SomeModule', + '/app/some/path/resource/some-file.php', + '$install->getTableName("some_table")', + [] + ], + [ + 'any', + '/app/some/path/resource/some-file.php', + '$install->getTableName(\'some_table\')', + [[ + 'module' => 'SomeModule', + 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, + 'source' => 'some_table' + ]] + ], + ]; + } +} diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/LayoutRuleTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/LayoutRuleTest.php new file mode 100644 index 00000000000..412bb29ba0e --- /dev/null +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/LayoutRuleTest.php @@ -0,0 +1,264 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento + * @subpackage static_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\TestFramework\Dependency; + +class LayoutRuleTest extends \PHPUnit_Framework_TestCase +{ + public function testNonLayoutGetDependencyInfo() + { + $model = new LayoutRule([], [], []); + $content = 'any content'; + $this->assertEmpty($model->getDependencyInfo('any', 'not layout', 'any', $content)); + } + + /** + * @param string $contents + * @param array $expected + * @dataProvider getDependencyInfoDataProvider + */ + public function testGetDependencyInfo($contents, array $expected) + { + $model = new LayoutRule([], [], []); + $this->assertEquals($expected, $model->getDependencyInfo('Magento\SomeModule', 'layout', 'any', $contents)); + } + + public function getDependencyInfoDataProvider() + { + return [ + [ + '<element module="Magento\AnotherModule">', + [[ + 'module' => 'Magento\AnotherModule', + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + 'source' => '<element module="Magento\AnotherModule">', + ]] + ], + [ + '<element module="Magento\SomeModule">', + [] + ], + [ + '<block class="Magento\AnotherModule\Several\Chunks">', + [[ + 'module' => 'Magento\AnotherModule', + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_HARD, + 'source' => '<block class="Magento\AnotherModule\Several\Chunks">', + ]] + ], + [ + '<block class="Magento\SomeModule\Several\Chunks">', + [] + ], + [ + '<extra></extra><block template="Magento_AnotherModule::template/path.phtml">', + [[ + 'module' => 'Magento\AnotherModule', + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + 'source' => '<block template="Magento_AnotherModule::template/path.phtml">', + ]] + ], + [ + '<block template="Magento_SomeModule::template/path.phtml">', + [] + ], + [ + '<block>Magento\AnotherModule\Several\Chunks</block>', + [[ + 'module' => 'Magento\AnotherModule', + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + 'source' => '<block>Magento\AnotherModule\Several\Chunks</block>', + ]] + ], + [ + '<block>Magento\SomeModule\Several\Chunks</block>', + [] + ], + [ + '<template>Magento_AnotherModule::template/path.phtml</template>', + [[ + 'module' => 'Magento\AnotherModule', + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + 'source' => '<template>Magento_AnotherModule::template/path.phtml</template>', + ]] + ], + [ + '<template>Magento_SomeModule::template/path.phtml</template>', + [] + ], + [ + '<file>Magento_AnotherModule::file/path.txt</file>', + [[ + 'module' => 'Magento\AnotherModule', + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + 'source' => '<file>Magento_AnotherModule::file/path.txt</file>', + ]] + ], + [ + '<file>Magento_SomeModule::file/path.txt</file>', + [] + ], + [ + '<any helper="Magento\AnotherModule\Several\Chunks::text">', + [[ + 'module' => 'Magento\AnotherModule', + 'type' => \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + 'source' => '<any helper="Magento\AnotherModule\Several\Chunks::text">', + ]] + ], + [ + '<any helper="Magento\SomeModule\Several\Chunks::text">', + [] + ], + ]; + } + + /** + * @param string $contents + * @param string $type + * @dataProvider layoutGetDependencyInfoDataProvider + */ + public function testUpdatesRouterGetDependencyInfo($contents, $type) + { + $model = new LayoutRule( + ['router_name' => ['Magento\RouterModule']], + [], + [] + ); + $this->assertEquals([], $model->getDependencyInfo('Magento\RouterModule', 'layout', 'any', $contents)); + $this->assertEquals( + [[ + 'module' => 'Magento\RouterModule', + 'type' => $type, + 'source' => 'router_name_action', + ]], + $model->getDependencyInfo('Magento\AnotherModule', 'layout', 'any', $contents) + ); + } + + /** + * @param string $contents + * @param string $type + * @param bool $isHandle + * @dataProvider layoutGetDependencyInfoWithReferenceDataProvider + */ + public function testLayoutGetDependencyInfo($contents, $type, $isHandle) + { + // test one module + $data = [ + 'frontend' => ['any_handle_name' => ['Magento\AnyHandleModule' => 'Magento\AnyHandleModule']], + 'default' => ['singlechunk' => ['Magento\DefaultHandleModule' => 'Magento\DefaultHandleModule']] + ]; + $model = $isHandle ? new LayoutRule([], [], $data) : new LayoutRule([], $data, []); + $this->assertEquals( + [], + $model->getDependencyInfo('Magento\AnyHandleModule', 'layout', 'path/frontend/file.txt', $contents) + ); + $this->assertEquals( + [], + $model->getDependencyInfo('Magento\DefaultHandleModule', 'layout', 'any', $contents) + ); + $this->assertEquals( + [[ + 'module' => 'Magento\DefaultHandleModule', + 'type' => $type, + 'source' => 'singlechunk', + ]], + $model->getDependencyInfo('any', 'layout', 'any', $contents) + ); + $this->assertEquals( + [[ + 'module' => 'Magento\AnyHandleModule', + 'type' => $type, + 'source' => 'any_handle_name', + ]], + $model->getDependencyInfo('any', 'layout', 'path/frontend/file.txt', $contents) + ); + // test several modules + $data = ['frontend' => ['any_handle_name' => [ + 'Magento\Theme' => 'Magento\Theme', + 'Magento\HandleModule' => 'Magento\HandleModule', + ]]]; + $model = $isHandle ? new LayoutRule([], [], $data) : new LayoutRule([], $data, []); + $this->assertEquals( + [[ + 'module' => 'Magento\Theme', + 'type' => $type, + 'source' => 'any_handle_name', + ]], + $model->getDependencyInfo('any', 'layout', 'path/frontend/file.txt', $contents) + ); + $this->assertEquals( + [], + $model->getDependencyInfo('Magento\HandleModule', 'layout', 'path/frontend/file.txt', $contents) + ); + } + + public function layoutGetDependencyInfoDataProvider() + { + return [ + [ + $this->_getLayoutFileContent('layout_handle.xml'), + \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + true + ], + [ + $this->_getLayoutFileContent('layout_handle_parent.xml'), + \Magento\Test\Integrity\DependencyTest::TYPE_HARD, + true + ], + [ + $this->_getLayoutFileContent('layout_handle_update.xml'), + \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + true + ] + ]; + } + + public function layoutGetDependencyInfoWithReferenceDataProvider() + { + return array_merge( + $this->layoutGetDependencyInfoDataProvider(), + [[ + $this->_getLayoutFileContent('layout_reference.xml'), + \Magento\Test\Integrity\DependencyTest::TYPE_SOFT, + false + ]] + ); + } + + /** + * Get content of layout file + * + * @param string $fileName + * @return string + */ + protected function _getLayoutFileContent($fileName) + { + return file_get_contents(str_replace('\\', '/', realpath(__DIR__)) . '/_files/' . $fileName); + } +} diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php new file mode 100644 index 00000000000..67cb23656e1 --- /dev/null +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/PhpRuleTest.php @@ -0,0 +1,154 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento + * @subpackage static_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\TestFramework\Dependency; + +class PhpRuleTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var PhpRule + */ + protected $model; + + protected function setUp() + { + $mapRoutes = array( + 'someModule' => array('Magento\SomeModule'), + 'anotherModule' => array('Magento\OneModule') + ); + $mapLayoutBlocks = array( + 'area' => array('block.name' => array('Magento\SomeModule' => 'Magento\SomeModule')) + ); + $this->model = new PhpRule($mapRoutes, $mapLayoutBlocks); + } + + public function testNonPhpGetDependencyInfo() + { + $content = 'any content'; + $this->assertEmpty($this->model->getDependencyInfo('any', 'not php', 'any', $content)); + } + + /** + * @param string $module + * @param string $content + * @param array $expected + * @dataProvider getDependencyInfoDataProvider + */ + public function testGetDependencyInfo($module, $content, array $expected) + { + $this->assertEquals($expected, $this->model->getDependencyInfo($module, 'php', 'any', $content)); + } + + public function getDependencyInfoDataProvider() + { + return [ + ['Magento\SomeModule', 'something extends \Magento\SomeModule\Any\ClassName {', []], //1 + [ + 'Magento\AnotherModule', + 'something extends \Magento\SomeModule\Any\ClassName {', + [[ + 'module' => 'Magento\SomeModule', + 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, + 'source' => 'Magento\SomeModule\Any\ClassName', + ]] + ], // 2 + ['Magento\SomeModule', '$this->getViewFileUrl("Magento_SomeModule::js/order-by-sku-failure.js")', []], //3 + [ + 'Magento\AnotherModule', + '$this->getViewFileUrl("Magento_SomeModule::js/order-by-sku-failure.js")', + [[ + 'module' => 'Magento\SomeModule', + 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, + 'source' => 'Magento_SomeModule', + ]] + ], //4 + ['Magento\SomeModule', '$this->helper("Magento\SomeModule\Any\ClassName")', []], //5 + [ + 'Magento\AnotherModule', + '$this->helper("Magento\SomeModule\Any\ClassName")', + [[ + 'module' => 'Magento\SomeModule', + 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, + 'source' => 'Magento\SomeModule\Any\ClassName', + ]] + ], //6 + ['Magento\SomeModule', '$this->getUrl("someModule")', []], // 7 + [ + 'Magento\AnotherModule', + '$this->getUrl("anotherModule")', + [[ + 'module' => 'Magento\OneModule', + 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, + 'source' => 'getUrl("anotherModule"', + ]] + ], //8 + ['Magento\SomeModule', '$this->getLayout()->getBlock(\'block.name\');', []], // 9 + [ + 'Magento\AnotherModule', + '$this->getLayout()->getBlock(\'block.name\');', + [[ + 'module' => 'Magento\SomeModule', + 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, + 'source' => 'getBlock(\'block.name\')', + ]] + ], //10 + ]; + } + + /** + * @param string $module + * @param string $content + * @param array $expected + * @dataProvider getDefaultModelDependencyDataProvider + */ + public function testGetDefaultModelDependency($module, $content, array $expected) + { + $mapLayoutBlocks = array( + 'default' => array('block.name' => array( + 'Magento\SomeModule' => 'Magento\SomeModule', + 'Magento\Install' => 'Magento\Install' + )) + ); + $this->model = new PhpRule([], $mapLayoutBlocks); + $this->assertEquals($expected, $this->model->getDependencyInfo($module, 'template', 'any', $content)); + } + + public function getDefaultModelDependencyDataProvider() + { + return [ + [ + 'Magento\AnotherModule', + '$this->getLayout()->getBlock(\'block.name\');', + [[ + 'module' => 'Magento\Install', + 'type' => \Magento\TestFramework\Dependency\RuleInterface::TYPE_HARD, + 'source' => 'getBlock(\'block.name\')', + ]] + ], + ]; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/etc/module.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle.xml similarity index 86% rename from dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/etc/module.xml rename to dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle.xml index a90721f32a8..797a7495733 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/Magento/Catalog/etc/module.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle.xml @@ -23,6 +23,8 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<config> - <module name="Magento_Catalog" version="1.6.0.0.23" active="true"/> -</config> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <any_handle_name /> + <singlechunk /> + <router_name_action /> +</layout> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/layout_update.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_parent.xml similarity index 86% rename from dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/layout_update.xml rename to dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_parent.xml index e56c2fb4889..7aa13ed5a36 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DataService/LayoutTest/layout_update.xml +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_parent.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\View\Element\Template" name="block_with_service_calls"> - <data service_call="testServiceCall" alias="testData"/> - </block> + <any_node1 parent="any_handle_name" /> + <any_node2 parent="singlechunk" /> + <any_node3 parent="router_name_action" /> </layout> diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_update.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_update.xml new file mode 100644 index 00000000000..41648f6c00c --- /dev/null +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_handle_update.xml @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <update handle="any_handle_name" /> + <any_node> + <update handle="singlechunk"> + <update handle="router_name_action" /> + </update> + </any_node> +</layout> diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_reference.xml b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_reference.xml new file mode 100644 index 00000000000..bc3e54dda6b --- /dev/null +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Dependency/_files/layout_reference.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <reference name="any_handle_name" /> + <any_node> + <reference name="singlechunk" /> + </any_node> +</layout> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php index 32bc2989a1e..2157bded428 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php @@ -29,9 +29,6 @@ */ namespace Magento\Test\Integrity; -/** - * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) - */ class DependencyTest extends \PHPUnit_Framework_TestCase { /** @@ -47,6 +44,11 @@ class DependencyTest extends \PHPUnit_Framework_TestCase const MAP_TYPE_FOUND = 'found'; const MAP_TYPE_REDUNDANT = 'redundant'; + /** + * Count of directories in path + */ + const DIR_PATH_COUNT = 4; + /** * List of config.xml files by modules * @@ -58,6 +60,17 @@ class DependencyTest extends \PHPUnit_Framework_TestCase */ protected static $_listConfigXml = array(); + /** + * List of routes.xml files by modules + * + * Format: array( + * '{Module_Name}' => '{Filename}' + * ) + * + * @var array + */ + protected static $_listRoutesXml = array(); + /** * List of routers * @@ -107,18 +120,6 @@ class DependencyTest extends \PHPUnit_Framework_TestCase */ protected static $_mapDependencies = array(); - /** - * List of fake dependencies - * - * Format: array( - * '{Module_Name}' => array( - * '{Dependency_Name}' => '{Dependency_Name}', - * )) - * - * @var array - */ - protected static $_mapExceptions = array(); - /** * Regex pattern for validation file path of theme * @@ -135,18 +136,6 @@ class DependencyTest extends \PHPUnit_Framework_TestCase */ protected static $_namespaces; - /** - * Rule list - * - * @var array - */ - protected static $_rules = array( - 'Magento\TestFramework\Dependency\PhpRule', - 'Magento\TestFramework\Dependency\DbRule', - 'Magento\TestFramework\Dependency\LayoutRule', - 'Magento\TestFramework\Dependency\TemplateRule', - ); - /** * Rule instances * @@ -156,13 +145,13 @@ class DependencyTest extends \PHPUnit_Framework_TestCase /** * Sets up data - * */ public static function setUpBeforeClass() { self::$_namespaces = implode('|', \Magento\TestFramework\Utility\Files::init()->getNamespaces()); self::_prepareListConfigXml(); + self::_prepareListRoutesXml(); self::_prepareMapRouters(); self::_prepareMapLayoutBlocks(); @@ -181,7 +170,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase $defaultThemes = array(); foreach (self::$_listConfigXml as $file) { $config = simplexml_load_file($file); - $nodes = $config->xpath("/config/*/design/theme/full_name") ?: array(); + $nodes = @ ($config->xpath("/config/*/design/theme/full_name") ?: array()); foreach ($nodes as $node) { $defaultThemes[] = (string)$node; } @@ -194,32 +183,20 @@ class DependencyTest extends \PHPUnit_Framework_TestCase */ protected static function _initRules() { - self::$_rulesInstances = array(); - foreach (self::$_rules as $ruleClass) { - if (class_exists($ruleClass)) { - /** @var \Magento\TestFramework\Dependency\RuleInterface $rule */ - $rule = new $ruleClass(array( - 'mapRouters' => self::$_mapRouters, - 'mapLayoutBlocks' => self::$_mapLayoutBlocks, - 'mapLayoutHandles' => self::$_mapLayoutHandles, - )); - if ($rule instanceof \Magento\TestFramework\Dependency\RuleInterface) { - self::$_rulesInstances[$ruleClass] = $rule; - } - } + $replaceFilePattern = str_replace('\\', '/', realpath(__DIR__)) . '/_files/dependency_test/*.php'; + $dbRuleTables = array(); + foreach (glob($replaceFilePattern) as $fileName) { + $dbRuleTables = array_merge($dbRuleTables, @include($fileName)); } - } - - /** - * Validates file when it is belonged to default themes - * - * @param $file string - * @return bool - */ - protected function _isThemeFile($file) - { - $filename = self::_getRelativeFilename($file); - return (bool)preg_match(self::$_defaultThemes, $filename); + self::$_rulesInstances = array( + new \Magento\TestFramework\Dependency\PhpRule(self::$_mapRouters, self::$_mapLayoutBlocks), + new \Magento\TestFramework\Dependency\DbRule($dbRuleTables), + new \Magento\TestFramework\Dependency\LayoutRule( + self::$_mapRouters, + self::$_mapLayoutBlocks, + self::$_mapLayoutHandles + ), + ); } /** @@ -274,7 +251,11 @@ class DependencyTest extends \PHPUnit_Framework_TestCase * @param string $file */ function ($fileType, $file) { - if (strpos($file, 'app/code') === false && !$this->_isThemeFile($file)) { + // Validates file when it is belonged to default themes + $filename = self::_getRelativeFilename($file); + $isThemeFile = (bool)preg_match(self::$_defaultThemes, $filename); + + if (strpos($file, 'app/code') === false && !$isThemeFile) { return; } @@ -285,16 +266,16 @@ class DependencyTest extends \PHPUnit_Framework_TestCase $dependencies = array(); foreach (self::$_rulesInstances as $rule) { /** @var \Magento\TestFramework\Dependency\RuleInterface $rule */ - $dependencies = array_merge($dependencies, - $rule->getDependencyInfo($module, $fileType, $file, $contents)); + $newDependencies = $rule->getDependencyInfo($module, $fileType, $file, $contents); + $dependencies = array_merge($dependencies, $newDependencies); } // Collect dependencies - $undeclared = $this->_collectDependencies($module, $dependencies); + $undeclaredDependency = $this->_collectDependencies($module, $dependencies); // Prepare output message $result = array(); - foreach ($undeclared as $type => $modules) { + foreach ($undeclaredDependency as $type => $modules) { $modules = array_unique($modules); if (!count($modules)) { continue; @@ -312,19 +293,18 @@ class DependencyTest extends \PHPUnit_Framework_TestCase /** * Collect dependencies * - * @param $currentModule + * @param string $currentModuleName * @param array $dependencies * @return array */ - protected function _collectDependencies($currentModule, $dependencies = array()) + protected function _collectDependencies($currentModuleName, $dependencies = array()) { if (!count($dependencies)) { return array(); } - $undeclared = array(); foreach ($dependencies as $dependency) { - $this->collectDependency($dependency, $currentModule, $undeclared); + $this->collectDependency($dependency, $currentModuleName, $undeclared); } return $undeclared; } @@ -332,11 +312,11 @@ class DependencyTest extends \PHPUnit_Framework_TestCase /** * Collect a dependency * - * @param $dependency - * @param $currentModule - * @return array + * @param string $currentModule + * @param array $dependency + * @param array $undeclared */ - private function collectDependency($dependency, $currentModule, $undeclared) + private function collectDependency($dependency, $currentModule, &$undeclared) { $module = $dependency['module']; $nsModule = str_replace('_', '\\', $module); @@ -346,12 +326,10 @@ class DependencyTest extends \PHPUnit_Framework_TestCase $hard = $this->_getDependencies($currentModule, self::TYPE_HARD, self::MAP_TYPE_DECLARED); $declared = ($type == self::TYPE_SOFT) ? array_merge($soft, $hard) : $hard; - if (!in_array($module, $declared) && !in_array($nsModule, $declared)) { - if ($this->_isFake($module)) { - $this->_addFake($currentModule, $module); - return; - } + if (!in_array($module, $declared) && !in_array($nsModule, $declared) && !$this->_isFake($module)) { $undeclared[$type][] = $module; + } elseif ((in_array($module, $declared) || in_array($nsModule, $declared)) && $this->_isFake($module)) { + $this->_setDependencies($currentModule, $type, self::MAP_TYPE_REDUNDANT, $module); } $this->_addDependencies($currentModule, $type, self::MAP_TYPE_FOUND, $nsModule); @@ -366,20 +344,14 @@ class DependencyTest extends \PHPUnit_Framework_TestCase public function collectRedundant() { foreach (array_keys(self::$_mapDependencies) as $module) { - // Override 'soft' dependencies with 'hard' $soft = $this->_getDependencies($module, self::TYPE_SOFT, self::MAP_TYPE_FOUND); $hard = $this->_getDependencies($module, self::TYPE_HARD, self::MAP_TYPE_FOUND); - - $this->_setDependencies($module, self::TYPE_SOFT, self::MAP_TYPE_FOUND, - array_diff($soft, $hard)); - + $this->_setDependencies($module, self::TYPE_SOFT, self::MAP_TYPE_FOUND, array_diff($soft, $hard)); foreach ($this->_getTypes() as $type) { $declared = $this->_getDependencies($module, $type, self::MAP_TYPE_DECLARED); $found = $this->_getDependencies($module, $type, self::MAP_TYPE_FOUND); - - $this->_setDependencies($module, $type, self::MAP_TYPE_REDUNDANT, - array_diff($declared, $found)); + $this->_setDependencies($module, $type, self::MAP_TYPE_REDUNDANT, array_diff($declared, $found)); } } } @@ -410,25 +382,6 @@ class DependencyTest extends \PHPUnit_Framework_TestCase } } - /** - * Check fake dependencies that was found in a previous tests - * - * @depends testUndeclared - */ - public function testFake() - { - $this->markTestSkipped('Skip fake modules!'); - - if (count(self::$_mapExceptions)) { - $result = array(); - foreach (self::$_mapExceptions as $module => $items) { - $result[] = sprintf("\r\nModule %s: [%s]", - $module, implode(', ', array_values($items))); - } - $this->fail("Undefined dependencies found!\r\n" . implode(' ', $result)); - } - } - /** * Extract Magento relative filename from absolute filename * @@ -437,8 +390,8 @@ class DependencyTest extends \PHPUnit_Framework_TestCase */ static protected function _getRelativeFilename($absoluteFilename) { - $relativeFileName = str_replace(\Magento\TestFramework\Utility\Files::init()->getPathToSource(), - '', $absoluteFilename); + $pathToSource = \Magento\TestFramework\Utility\Files::init()->getPathToSource(); + $relativeFileName = str_replace($pathToSource, '', $absoluteFilename); return trim(str_replace('\\', '/', $relativeFileName), '/'); } @@ -454,6 +407,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase if (preg_match('/\/(?<namespace>' . self::$_namespaces . ')[\/_\\\\]?(?<module>[^\/]+)\//', $file, $matches)) { return $matches['namespace'] . '\\' . $matches['module']; } + return ''; } /** @@ -461,13 +415,14 @@ class DependencyTest extends \PHPUnit_Framework_TestCase * * @param string $fileType * @param array $files + * @param bool|null $skip * @return array */ - protected function _prepareFiles($fileType, $files) + protected function _prepareFiles($fileType, $files, $skip = null) { $result = array(); foreach (array_keys($files) as $file) { - if (substr_count(self::_getRelativeFilename($file), '/') < 4) { + if (!$skip && (substr_count(self::_getRelativeFilename($file), '/') < self::DIR_PATH_COUNT)) { continue; } $result[$file] = array($fileType, $file); @@ -487,7 +442,7 @@ class DependencyTest extends \PHPUnit_Framework_TestCase // Get all php files $files = array_merge($files, $this->_prepareFiles('php', - \Magento\TestFramework\Utility\Files::init()->getPhpFiles(true, false, false, true))); + \Magento\TestFramework\Utility\Files::init()->getPhpFiles(true, false, false, true), true)); // Get all configuration files $files = array_merge($files, @@ -518,51 +473,50 @@ class DependencyTest extends \PHPUnit_Framework_TestCase } } + /** + * Prepare list of routes.xml files (by modules) + */ + protected static function _prepareListRoutesXml() + { + $files = \Magento\TestFramework\Utility\Files::init()->getConfigFiles('*/routes.xml', array(), false); + foreach ($files as $file) { + if (preg_match('/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)/', $file, $matches)) { + $module = $matches['namespace'] . '\\' . $matches['module']; + self::$_listRoutesXml[$module] = $file; + } + } + } + /** * Prepare map of routers - * - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) */ protected static function _prepareMapRouters() { - $pattern = '/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)\/controllers\/' - . '(?<path>[\/\w]*)Controller.php/'; + $pattern = '/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)\/Controller\/' + . '(?<path>[\/\w]*).php/'; $files = \Magento\TestFramework\Utility\Files::init()->getPhpFiles(true, false, false, false); foreach ($files as $file) { if (preg_match($pattern, $file, $matches)) { - - $chunks = explode('/', strtolower($matches['path'])); $module = $matches['namespace'] . '\\' . $matches['module']; - - // Read module's config.xml file - $config = simplexml_load_file(self::$_listConfigXml[$module]); - - if ($module == 'Magento\Adminhtml') { - $nodes = $config->xpath("/config/admin/routers/*") ?: array(); - } elseif ('adminhtml' == $chunks[0]) { - array_shift($chunks); - $nodes = $config->xpath("/config/admin/routers/*") ?: array(); - } else { - $nodes = $config->xpath("/config/frontend/routers/*") ?: array(); - foreach ($nodes as $nodeKey => $node) { - // Exclude overridden routers - if ('' == (string)$node->args->frontName) { - unset($nodes[$nodeKey]); + if (isset(self::$_listRoutesXml[$module])) { + // Read module's routes.xml file + $config = simplexml_load_file(self::$_listRoutesXml[$module]); + $nodes = $config->xpath("/config/router/*"); + foreach ($nodes as $node) { + $id = (string)$node['id']; + if ($id != 'adminhtml' && '' == (string)$node['frontName']) { + // Exclude overridden routers + continue; + } + if (!isset(self::$_mapRouters[$id])) { + self::$_mapRouters[$id] = []; + } + if (!in_array($module, self::$_mapRouters[$id])) { + self::$_mapRouters[$id][] = $module; } } } - - $controllerName = implode('\\', $chunks); - foreach ($nodes as $node) { - /** @var \SimpleXMLElement $node */ - $path = $node->getName() ? $node->getName() . '\\' . $controllerName : $controllerName; - if (isset(self::$_mapRouters[$path]) && (self::$_mapRouters[$path] == 'Magento\Adminhtml')) { - continue; - } - self::$_mapRouters[$path] = $module; - } } } } @@ -577,24 +531,17 @@ class DependencyTest extends \PHPUnit_Framework_TestCase $area = 'default'; if (preg_match('/[\/](?<area>adminhtml|frontend)[\/]/', $file, $matches)) { $area = $matches['area']; - if (!isset(self::$_mapLayoutBlocks[$area])) { - self::$_mapLayoutBlocks[$area] = array(); - } + self::$_mapLayoutBlocks[$area] = @ (self::$_mapLayoutBlocks[$area] ?: array()); } - if (preg_match('/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)/', $file, $matches)) { $module = $matches['namespace'] . '\\' . $matches['module']; - $xml = simplexml_load_file($file); foreach ((array)$xml->xpath('//container | //block') as $element) { /** @var \SimpleXMLElement $element */ $attributes = $element->attributes(); - $block = (string)$attributes->name; if (!empty($block)) { - if (!isset(self::$_mapLayoutBlocks[$area][$block])) { - self::$_mapLayoutBlocks[$area][$block] = array(); - } + self::$_mapLayoutBlocks[$area][$block] = @ (self::$_mapLayoutBlocks[$area][$block] ?: []); self::$_mapLayoutBlocks[$area][$block][$module] = $module; } } @@ -612,22 +559,16 @@ class DependencyTest extends \PHPUnit_Framework_TestCase $area = 'default'; if (preg_match('/\/(?<area>adminhtml|frontend)\//', $file, $matches)) { $area = $matches['area']; - if (!isset(self::$_mapLayoutHandles[$area])) { - self::$_mapLayoutHandles[$area] = array(); - } + self::$_mapLayoutHandles[$area] = @ (self::$_mapLayoutHandles[$area] ?: array()); } - if (preg_match('/app\/code\/(?<namespace>[A-Z][a-z]+)[_\/\\\\](?<module>[A-Z][a-zA-Z]+)/', $file, $matches)) { $module = $matches['namespace'] . '\\' . $matches['module']; - $xml = simplexml_load_file($file); foreach ((array)$xml->xpath('/layout/child::*') as $element) { /** @var \SimpleXMLElement $element */ $handle = $element->getName(); - if (!isset(self::$_mapLayoutHandles[$area][$handle])) { - self::$_mapLayoutHandles[$area][$handle] = array(); - } + self::$_mapLayoutHandles[$area][$handle] = @ (self::$_mapLayoutHandles[$area][$handle] ?: array()); self::$_mapLayoutHandles[$area][$handle][$module] = $module; } } @@ -649,9 +590,6 @@ class DependencyTest extends \PHPUnit_Framework_TestCase /** * Initialise map of dependencies - * - * @SuppressWarnings(PHPMD.NPathComplexity) - * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ protected static function _initDependencies() { @@ -659,14 +597,11 @@ class DependencyTest extends \PHPUnit_Framework_TestCase foreach ($files as $file) { $config = simplexml_load_file($file); - - $module = $config->xpath("/config/module") ?: array(); + $module = $config->xpath("/config/module"); $moduleName = (string)$module[0]->attributes()->name; $moduleName = str_replace('_', '\\', $moduleName); + self::$_mapDependencies[$moduleName] = @ (self::$_mapDependencies[$moduleName] ?: array()); - if (!isset(self::$_mapDependencies[$moduleName])) { - self::$_mapDependencies[$moduleName] = array(); - } foreach (self::_getTypes() as $type) { if (!isset(self::$_mapDependencies[$moduleName][$type])) { self::$_mapDependencies[$moduleName][$type] = array( @@ -679,8 +614,8 @@ class DependencyTest extends \PHPUnit_Framework_TestCase foreach ($module[0]->depends->children() as $dependency) { /** @var \SimpleXMLElement $dependency */ - $type = (isset($dependency['type']) && (string)$dependency['type'] == self::TYPE_SOFT) ? self::TYPE_SOFT - : self::TYPE_HARD; + $type = (isset($dependency['type']) && (string)$dependency['type'] == self::TYPE_SOFT) + ? self::TYPE_SOFT : self::TYPE_HARD; if ($dependency->getName() == 'module') { self::_addDependencies($moduleName, $type, self::MAP_TYPE_DECLARED, str_replace('_', '\\', (string)$dependency->attributes()->name)); @@ -753,15 +688,4 @@ class DependencyTest extends \PHPUnit_Framework_TestCase { return isset(self::$_mapDependencies[$module]) ? false : true; } - - /** - * Add fake dependency to list - * - * @param $module - * @param $dependency - */ - protected function _addFake($module, $dependency) - { - self::$_mapExceptions[$module][$dependency] = $dependency; - } } diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt index eb19033d294..ce2b62d4129 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt @@ -64,5 +64,5 @@ lib/Magento/App/Helper/Context.php lib/Magento/View/DesignLoader.php lib/Magento/Session/SidResolverInterface.php -lib/Magento/Filesystem/DirectoryList/Configuration.php +lib/Magento/App/Filesystem/DirectoryList/Configuration.php lib/Magento/Filesystem/Driver/Http.php diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/LayoutConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/LayoutConfigTest.php deleted file mode 100644 index ac83d94ca91..00000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/LayoutConfigTest.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php -/** - * Validates that all layouts with service_calls actually reference a valid service call - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Test\Integrity\Magento\Core\Model\DataService; - -class LayoutConfigTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var array string[] $_serviceCalls Array of valid service calls available to layouts - */ - protected static $_serviceCalls; - - /** - * Gathers all valid service calls from config files - */ - public static function setUpBeforeClass() - { - /** - * @var array string[] $configFiles - */ - $configFiles = \Magento\TestFramework\Utility\Files::init()->getConfigFiles('service_calls.xml', array()); - /** - * @var string $file - */ - foreach ($configFiles as $file) { - /** - * @var \DOMDocument $dom - */ - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($file[0])); - - /** - * @var \DOMNodeList $serviceCalls - */ - $serviceCalls = $dom->getElementsByTagName('service_calls'); - $serviceCalls = $serviceCalls->item(0); - if ($serviceCalls != null && $serviceCalls->hasChildNodes()) { - - /** - * @var $serviceCall \DOMNode - */ - foreach ($serviceCalls->childNodes as $serviceCall) { - if ($serviceCall->localName == 'service_call') { - self::$_serviceCalls[] = $serviceCall->attributes->getNamedItem('name')->nodeValue; - } - } - } - } - } - - public function testXmlFiles() - { - $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); - $invoker( - /** - * Given a layout file, test whether all of its service calls are valid - * - * @param $layoutFile - */ - function ($layoutFile) { - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($layoutFile)); - $dataList = $dom->getElementsByTagName('data'); - /** @var \DOMNode $data */ - foreach ($dataList as $data) { - if ($data->hasAttributes()) { - /** @var \DOMNode $serviceCallAttribute */ - $serviceCallAttribute = $data->attributes->getNamedItem('service_call'); - if ($serviceCallAttribute) { - /** @var string $serviceCall */ - $serviceCall = $serviceCallAttribute->nodeValue; - $this->assertContains( - $serviceCall, - self::$_serviceCalls, - "Unknown service call: $serviceCall" - ); - } - } - } - }, - \Magento\TestFramework\Utility\Files::init()->getLayoutFiles() - ); - } -} diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/SystemConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/SystemConfigTest.php deleted file mode 100644 index f192bf53947..00000000000 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Core/Model/DataService/SystemConfigTest.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Validates that all options with service_calls actually reference a valid service call - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Test\Integrity\Magento\Core\Model\DataService; - -class SystemConfigTest extends \PHPUnit_Framework_TestCase -{ - /** @var array string[] */ - protected static $_serviceCalls = array(); - - public static function setUpBeforeClass() - { - $configFiles = \Magento\TestFramework\Utility\Files::init()->getConfigFiles('service_calls.xml', array()); - foreach ($configFiles as $file) { - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($file[0])); - $serviceCalls = $dom->getElementsByTagName('service_calls'); - $serviceCalls = $serviceCalls->item(0); - if ($serviceCalls->hasChildNodes()) { - foreach ($serviceCalls->childNodes as $serviceCall) { - /** @var $serviceCall \DOMNode */ - if ($serviceCall->localName == 'service_call') { - self::$_serviceCalls[] = $serviceCall->attributes->getNamedItem('name')->nodeValue; - } - } - } - } - } - - public function testXmlFiles() - { - $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this); - $invoker( - function ($configFile) { - $dom = new \DOMDocument(); - $dom->loadXML(file_get_contents($configFile)); - $this->assertNotNull($dom); - $optionsList = $dom->getElementsByTagName('options'); - foreach ($optionsList as $options) { - /** @var $options \DOMNode */ - if ($options->hasAttributes()) { - $serviceCallAttribute = $options->attributes->getNamedItem('service_call'); - if (null != $serviceCallAttribute) { - $serviceCall = $serviceCallAttribute->nodeValue; - $this->assertTrue( - in_array($serviceCall, self::$_serviceCalls), "Unknown service call: $serviceCall" - ); - } - } - } - }, - \Magento\TestFramework\Utility\Files::init()->getConfigFiles('adminhtml/system.xml', array()) - ); - } -} diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php similarity index 99% rename from dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ce.php rename to dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php index 9e442150901..349012feacf 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php @@ -241,7 +241,7 @@ return array ( 'oauth_consumer' => 'Magento_Integration', 'oauth_nonce' => 'Magento_Integration', 'oauth_token' => 'Magento_Integration', - 'paygate_authorizenet_debug' => 'Magento_Paygate', + 'authorizenet_debug' => 'Magento_Authorizenet', 'paypal_cert' => 'Magento_Paypal', 'paypal_payment_transaction' => 'Magento_Paypal', 'paypal_settlement_report' => 'Magento_Paypal', diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt index 0b919ec4ec7..3abb2660b65 100644 --- a/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt +++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/core.txt @@ -10,7 +10,7 @@ app/code/Magento/Rule/view/adminhtml/rules.js app/code/Magento/Sales/view/adminhtml/order/create/giftmessage.js app/code/Magento/Sales/view/adminhtml/order/create/scripts.js app/code/Magento/Sales/view/adminhtml/order/giftoptions_tooltip.js -app/code/Magento/Sales/view/adminhtml/order/shipment/packaging.js +app/code/Magento/Shipping/view/adminhtml/order/packaging.js app/code/Magento/Theme/view/frontend/menu.js pub/lib/mage/adminhtml pub/lib/mage/backend/editablemultiselect.js diff --git a/dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/core.txt b/dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/core.txt index c7a5d925e00..4010d4ff6ed 100644 --- a/dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/core.txt +++ b/dev/tests/static/testsuite/Magento/Test/Js/_files/whitelist/core.txt @@ -9,8 +9,6 @@ app/code/Magento/Downloadable app/code/Magento/GiftMessage app/code/Magento/Install app/code/Magento/Newsletter -app/code/Magento/PageCache -app/code/Magento/Paygate app/code/Magento/Payment app/code/Magento/Paypal app/code/Magento/Persistent diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php index 125bc8ed638..e3688f440cd 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php @@ -137,8 +137,8 @@ class LayoutTest extends \PHPUnit_Framework_TestCase $this->assertContains('::', $action->getAttribute('helper')); } - if (false - !== strpos($layoutFile, 'app/code/Magento/Sales/view/adminhtml/layout/sales_order') + if (false !== strpos($layoutFile, 'app/code/Magento/Sales/view/adminhtml/layout/sales_order') + || false !== strpos($layoutFile, 'app/code/Magento/Shipping/view/adminhtml/layout/adminhtml_order') ) { $this->markTestIncomplete("The file {$layoutFile} has to use \\Magento\\Core\\Block\\Text\\List, \n" . 'there is no solution to get rid of it right now.' diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php index b5aa7fa00be..5005cea86c1 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/ObsoleteCodeTest.php @@ -324,7 +324,7 @@ class ObsoleteCodeTest extends \PHPUnit_Framework_TestCase '/getOptions\(\)\s*->get(Base|App|Code|Design|Etc|Lib|Locale|Js|Media' .'|Var|Tmp|Cache|Log|Session|Upload|Export)?Dir\(/S', $content, - 'The class \Magento\Core\Model\Config\Options is obsolete. Replacement suggestion: \Magento\Filesystem' + 'The class \Magento\Core\Model\Config\Options is obsolete. Replacement suggestion: \Magento\App\Filesystem' ); } diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index 0fce58d9963..8e548d12698 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -117,6 +117,16 @@ return array( array('Mage_Adminhtml_Block_Report_Refresh_Statistics_Grid'), array('Mage_Adminhtml_Block_Report_Search_Grid'), array('Mage_Adminhtml_Block_Sales'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\Create\Form', 'Magento\Shipping\Block\Adminhtml\Create\Form'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\Create\Items', 'Magento\Shipping\Block\Adminhtml\Create\Items'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\View\Comments', 'Magento\Shipping\Block\Adminhtml\View\Comments'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\View\Form', 'Magento\Shipping\Block\Adminhtml\View\Form'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\View\Items', 'Magento\Shipping\Block\Adminhtml\View\Items'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\Create', 'Magento\Shipping\Block\Adminhtml\Create'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\View', 'Magento\Shipping\Block\Adminhtml\View'), + array('Magento\Sales\Block\Order\Shipment\Items', 'Magento\Shipping\Block\Items'), + array('Magento\Sales\Controller\Adminhtml\Order\Shipment', 'Magento\Shipping\Controller\Adminhtml\Order\Shipment'), + array('Magento\Sales\Block\Order\Shipment', 'Magento\Shipping\Block\Order\Shipment'), array('Mage_Adminhtml_Block_Sales_Order_Create_Customer_Grid'), array('Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid_Renderer_Giftmessage'), array('Mage_Adminhtml_Block_Sales_Order_Status_Grid'), @@ -616,7 +626,7 @@ return array( array('Mage_Core_Controller_Magento_Router_Admin', 'Magento\Backend\App\Router\DefaultRouter'), array('Mage_Core_Model_Convert'), array('Mage_Core_Model_Config_Fieldset', 'Magento\Core\Model\Fieldset\Config'), - array('Mage_Core_Model_Config_Options', 'Magento\Filesystem'), + array('Mage_Core_Model_Config_Options', 'Magento\App\Filesystem'), array('Magento\App\Dir', 'Magento\Filesystem'), array('Magento\Filesystem\Adapter\Local', 'Magento\Filesystem\Driver\File'), array('Magento\Filesystem\Adapter\Zlib', 'Magento\Filesystem\Driver\Zlib'), @@ -699,6 +709,18 @@ return array( array('Mage_Reports_Model_Test'), array('Mage_Rss_Model_Observer'), array('Mage_Rss_Model_Session', 'Magento_Backend_Model_Auth and \Magento\Backend\Model\Auth\Session'), + array('Magento\Sales\Block\Adminhtml\Order\Invoice\Create\Tracking', + '\Magento\Shipping\Block\Adminhtml\Order\Tracking'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\Create\Tracking', + 'Magento\Shipping\Block\Adminhtml\Order\Tracking'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\Packaging', + '\Magento\Shipping\Block\Adminhtml\Order\Packaging'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\Packaging\Grid', + '\Magento\Shipping\Block\Adminhtml\Order\Packaging\Grid'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\Tracking\Info', + '\Magento\Shipping\Block\Adminhtml\Order\Tracking'), + array('Magento\Sales\Block\Adminhtml\Order\Shipment\View\Tracking', + 'Magento\Shipping\Block\Adminhtml\Order\Tracking\View'), array('Mage_Sales_Block_Order_Details'), array('Mage_Sales_Block_Order_Tax'), array('Mage_Sales_Block_Guest_Links'), @@ -1040,6 +1062,9 @@ return array( array('Magento\ImportExport\Model\Resource\Helper\Mysql4', 'Magento\ImportExport\Model\Resource\Helper'), array('Magento\Reports\Model\Resource\Helper\Mysql4', 'Magento\Reports\Model\Resource\Helper'), array('Magento\Backup\Model\Resource\Helper\Mysql4', 'Magento\Backup\Model\Resource\Helper'), + array('Magento\Sales\Model\CarrierFactory', 'Magento\Shipping\Model\CarrierFactory'), + array('Magento\Sales\Model\Order\Pdf\Shipment\Packaging', 'Magento\Shipping\Model\Order\Pdf\Packaging'), + array('Magento\Sales\Model\ResourceFactory'), array('Magento\Sales\Model\Resource\Helper\Mysql4', 'Magento\Sales\Model\Resource\Helper'), array('Magento\Core\Model\Resource\Helper\Mysql4', 'Magento\Core\Model\Resource\Helper'), array('Magento\Catalog\Model\Resource\Helper\Mysql4', 'Magento\Catalog\Model\Resource\Helper'), @@ -1702,7 +1727,7 @@ return array( ), array( 'Magento\App\Dir\Verification', - 'Magento\Filesystem\DirectoryList\Verification' + 'Magento\App\Filesystem\DirectoryList\Verification' ), array('Magento\Core\Model\Cookie', 'Magento\Stdlib\Cookie'), array('Magento\Core\Model\Logger', 'Magento\Logger'), @@ -1778,4 +1803,59 @@ return array( array('Magento\Reminder\Model\Resource\HelperFactory'), array('Magento\Reminder\Model\Resource\Helper'), array('Magento\CatalogRule\Block\Adminhtml\Promo\Widget\Chooser'), + array( + 'Magento\Catalog\Model\Product\Type\Grouped\Backend', + 'Magento\GroupedProduct\Model\Product\Type\Grouped\Backend' + ), + array( + 'Magento\Catalog\Model\Product\Type\Grouped\Price', + 'Magento\GroupedProduct\Model\Product\Type\Grouped\Price' + ), + array( + 'Magento\Catalog\Model\Resource\Product\Indexer\Price\Grouped', + 'Magento\GroupedProduct\Model\Resource\Product\Indexer\Price\Grouped' + ), + array( + 'Magento\Catalog\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection', + 'Magento\GroupedProduct\Model\Resource\Product\Type\Grouped\AssociatedProductsCollection' + ), + array( + 'Magento\Catalog\Model\Product\Type\Grouped', + 'Magento\GroupedProduct\Model\Product\Type\Grouped' + ), + array( + 'Magento\Catalog\Block\Adminhtml\Product\Composite\Fieldset\Grouped', + 'Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped' + ), + array( + 'Magento\Catalog\Block\Adminhtml\Product\Edit\Tabs\Grouped', + ), + array( + 'Magento\Catalog\Block\Product\Grouped\AssociatedProducts', + 'Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts', + ), + array( + 'Magento\Catalog\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts', + 'Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts' + ), + array( + 'Magento\Catalog\Block\Product\View\Type\Grouped', + 'Magento\GroupedProduct\Block\Product\View\Type\Grouped' + ), + ['CollFactory', 'CollectionFactory'], // no need to shorten anymore + ['Magento\Shipping\Model\Rate\Result\AbstractResult', 'Magento\Sales\Model\Quote\Address\RateResult\AbstractResult'], + ['Magento\Shipping\Model\Rate\Result\Error', 'Magento\Sales\Model\Quote\Address\RateResult\Error'], + ['Magento\Shipping\Model\Rate\Result\Method', 'Magento\Sales\Model\Quote\Address\RateResult\Method'], + [ + 'Magento\Shipping\Model\Rate\AbstractRate', + 'Magento\Sales\Model\Quote\Address\Rate + Magento\Shipping\Model\CarrierFactory' + ], + ['Magento\Shipping\Model\Rate\Request', 'Magento\Sales\Model\Quote\Address\RateRequest'], + array('Magento\PageCache\Block\Adminhtml\Cache\Additional'), + array('Magento\PageCache\Controller\Adminhtml\PageCache'), + array('Magento\PageCache\Model\Control\ControlInterface'), + array('Magento\PageCache\Model\Control\Zend'), + array('Magento\PageCache\Model\System\Config\Source\Controls'), + array('Magento\PageCache\Model\CacheControlFactory'), + array('Magento\PageCache\Model\Observer'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php index 783a3677b3b..620f02e6d0a 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php @@ -192,9 +192,6 @@ return array( ), array('XML_PATH_INDEXER_DATA', 'Magento\Index\Model\Process'), array('XML_PATH_INSTALL_DATE', 'Mage_Core_Model_App', 'Mage_Core_Model_Config_Primary::XML_PATH_INSTALL_DATE'), - array('XML_PATH_EXTERNAL_CACHE_CONTROLS', 'Magento\PageCache\Helper\Data'), - array('XML_PATH_EXTERNAL_CACHE_CONTROLS', 'Magento\PageCache\Model\CacheControlFactory'), - array('XML_PATH_EXTERNAL_CACHE_CONTROL', 'Magento\PageCache\Helper\Data'), array('XML_PATH_LOCALE_INHERITANCE', 'Mage_Core_Model_Translate'), array('XML_PATH_PRODUCT_ATTRIBUTES', 'Magento\Wishlist\Model\Config'), array('XML_PATH_PRODUCT_COLLECTION_ATTRIBUTES', 'Magento\Catalog\Model\Config'), @@ -210,6 +207,36 @@ return array( 'Magento\Core\Helper\Data', 'Magento_Core_Model_Design_Package::XML_PATH_STATIC_FILE_SIGNATURE' ), + array( + 'XML_PATH_STORE_ADDRESS1', + 'Magento\Shipping\Model\Shipping', + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ADDRESS1' + ), + array( + 'XML_PATH_STORE_ADDRESS2', + 'Magento\Shipping\Model\Shipping', + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ADDRESS2' + ), + array( + 'XML_PATH_STORE_CITY', + 'Magento\Shipping\Model\Shipping', + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_CITY' + ), + array( + 'XML_PATH_STORE_REGION_ID', + 'Magento\Shipping\Model\Shipping', + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_REGION_ID' + ), + array( + 'XML_PATH_STORE_ZIP', + 'Magento\Shipping\Model\Shipping', + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_ZIP' + ), + array( + 'XML_PATH_STORE_COUNTRY_ID', + 'Magento\Shipping\Model\Shipping', + 'Magento\Sales\Model\Order\Shipment::XML_PATH_STORE_COUNTRY_ID' + ), array('XML_PATH_TEMPLATE_EMAIL', 'Magento\Core\Model\Email\Template'), array( 'XML_PATH_TEMPLATE_FILTER', @@ -512,5 +539,38 @@ return array( array('UPLOAD_ROOT', 'Magento\Backend\Model\Config\Backend\Logo'), array('UPLOAD_ROOT', 'Magento\Backend\Model\Config\Backend\Favicon'), array('DIRECTORY_SEPARATOR', 'Magento\Filesystem'), - array('PARAM_APP_URIS', 'Magento\Filesystem') + + array('MAX_QTY_VALUE', '\Magento\Catalog\Controller\Adminhtml\Product', + 'Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter::MAX_QTY_VALUE' + ), + array('LINK_TYPE_GROUPED', '\Magento\Catalog\Model\Product\Link', + '\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED' + ), + array('TYPE_GROUPED', '\Magento\Catalog\Model\Product\Type', + '\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED' + ), + + array('PARAM_APP_URIS', 'Magento\Filesystem'), + + array('ROOT', '\Magento\Filesystem', '\Magento\App\Filesystem::ROOT_DIR'), + array('APP', '\Magento\Filesystem', '\Magento\App\Filesystem::APP_DIR'), + array('MODULES', '\Magento\Filesystem', '\Magento\App\Filesystem::MODULES_DIR'), + array('THEMES', '\Magento\Filesystem', '\Magento\App\Filesystem::THEMES_DIR'), + array('CONFIG', '\Magento\Filesystem', '\Magento\App\Filesystem::CONFIG_DIR'), + array('LIB', '\Magento\Filesystem', '\Magento\App\Filesystem::LIB_DIR'), + array('LOCALE', '\Magento\Filesystem', '\Magento\App\Filesystem::LOCALE_DIR'), + array('PUB', '\Magento\Filesystem', '\Magento\App\Filesystem::PUB_DIR'), + array('PUB_LIB', '\Magento\Filesystem', '\Magento\App\Filesystem::PUB_LIB_DIR'), + array('MEDIA', '\Magento\Filesystem', '\Magento\App\Filesystem::MEDIA_DIR'), + array('STATIC_VIEW', '\Magento\Filesystem', '\Magento\App\Filesystem::STATIC_VIEW_DIR'), + array('PUB_VIEW_CACHE', '\Magento\Filesystem', '\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR'), + array('VAR_DIR', '\Magento\Filesystem', '\Magento\App\Filesystem'), + array('TMP', '\Magento\Filesystem', '\Magento\App\Filesystem::TMP_DIR'), + array('CACHE', '\Magento\Filesystem', '\Magento\App\Filesystem::CACHE_DIR'), + array('LOG', '\Magento\Filesystem', '\Magento\App\Filesystem::LOG_DIR'), + array('SESSION', '\Magento\Filesystem', '\Magento\App\Filesystem::SESSION_DIR'), + array('DI', '\Magento\Filesystem', '\Magento\App\Filesystem::DI_DIR'), + array('GENERATION', '\Magento\Filesystem', '\Magento\App\Filesystem::GENERATION_DIR'), + array('UPLOAD', '\Magento\Filesystem', '\Magento\App\Filesystem::UPLOAD_DIR'), + array('SYS_TMP', '\Magento\Filesystem', '\Magento\App\Filesystem::SYS_TMP_DIR'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index c1f0cb868f4..a1b18f18361 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -73,9 +73,9 @@ return array( array('_getCacheKey', 'Magento\Catalog\Model\Layer\Filter\Price'), array('_getCacheLockId', 'Magento\Core\Model\Config'), array('_getCacheTags', 'Magento\Core\Model\App'), + array('_getCarrier', 'Magento\Shipping\Model\Config', 'Magento\Shipping\Model\CarrierFactory::create||get'), array('_getChildHtml'), array('_getConfig', 'Magento\Theme\Helper\Layout'), - array('_getCookie', 'Magento\PageCache\Helper\Data'), array('_getCollapseState', 'Magento\Backend\Block\System\Config\Form\Fieldset', '_isCollapseState'), array('_getCollectionNames', 'Magento\Backend\Controller\Report\Sales'), array('_getConnectionAdapterClassName', 'Magento\App\Resource'), @@ -210,7 +210,7 @@ return array( array('addRegisterLink', 'Magento\Customer\Block\Account\Link'), array('addRenderer', 'Magento\Bundle\Block\Catalog\Product\View\Type\Bundle'), array('addReviewSummaryTemplate', 'Magento\Catalog\Block\Product\AbstractProduct'), - array('addRowItemRender', 'Magento\Checkout\Block\Multishipping\Overview'), + array('addRowItemRender', 'Magento\Multishipping\Block\Checkout\Overview'), array('addSaleableFilterToCollection'), array('addSearchQfFilter'), array('addTemplateData', 'Magento\Newsletter\Model\Queue'), @@ -229,6 +229,8 @@ return array( '$collection->setVisibility(\Magento\Catalog\Model\Product\Visibility->getVisibleInSiteIds());' ), array('addWishListSortOrder', 'Magento\Wishlist\Model\Resource\Item\Collection'), + array('aggregateSalesReportShipmentData', '\Magento\Sales\Model\Observer', + '\Magento\Shipping\Model\Observer::aggregateSalesReportShipmentData'), array('appendBundleSelectionData', 'Magento\Bundle\Model\Observer'), array('applyAllDataUpdates', 'Magento\Core\Model\Resource\Setup'), array('applyAllUpdates', 'Magento\Core\Model\Resource\Setup'), @@ -273,7 +275,7 @@ return array( ), array('cleanVarFolder', '', 'Magento_Io_File::rmdirRecursive()'), array('cleanVarSubFolders', '', - '\Magento\Filesystem::getDirectoryRead(\Magento\Filesystem::VAR_DIR)::search())'), + '\Magento\App\Filesystem::getDirectoryRead(\Magento\App\Filesystem::VAR_DIR)::search())'), array('cloneIndexTable', 'Magento\Index\Model\Resource\AbstractResource'), array('collectRoutes', 'Magento\Backend\App\Router\DefaultRouter'), array('collectRoutes', 'Magento\Core\App\Router\Base'), @@ -331,7 +333,6 @@ return array( array('getButtonsHtml', 'Magento_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search'), array('getCache', 'Magento\Core\Model\Config'), array('getCacheBetaTypes'), - array('getCacheControls', 'Magento\PageCache\Helper\Data', 'Magento\PageCache\Model\CacheControlFactory'), array('getChangeLocaleUrl', 'Magento\Backend\Block\Page\Footer'), array('getCheckoutMehod', 'Magento\Checkout\Model\Type\Onepage'), array('getChildGroup', '', 'Magento_Core_Block_AbstractBlock::getGroupChildNames()'), @@ -400,6 +401,7 @@ return array( array('getIsEngineAvailable'), array('getIsGlobal', 'Magento\Eav\Model\Entity\Attribute\AbstractAttribute'), array('getIsInStock', 'Magento\Checkout\Block\Cart\Item\Renderer'), + array('getIsGrouped', 'Magento\Catalog\Block\Adminhtml\Product\Edit'), array('getItemRender', 'Magento\Checkout\Block\Cart\AbstractCart'), array('getItemRendererInfo', 'Magento\Checkout\Block\Cart\AbstractCart'), array('getKeyList', 'Magento\DB\Adapter\Pdo\Mysql'), @@ -422,6 +424,8 @@ return array( array('getModuleConfigurationFiles', 'Magento\Core\Model\Config'), array('getModuleSetup', 'Magento\Core\Model\Config'), array('getNeedUsePriceExcludeTax', '', 'Magento_Tax_Model_Config::priceIncludesTax()'), + array('getNumberDetail', 'Magento\Sales\Model\Order\Shipment\Track', + 'Magento\Shipping\Model\Order\Track::getNumberDetail()'), array('getOneBalanceTotal'), array('getOptimalCssUrls', 'Magento\Core\Model\Design\Package\Proxy', 'Magento\View\Asset\Merged'), array('getOptimalJsUrls', 'Magento\Core\Model\Design\Package\Proxy', 'Magento\View\Asset\Merged'), @@ -503,6 +507,7 @@ return array( array('getSecure', 'Magento\Core\Model\Url', 'isSecure'), array('getSelectionFinalPrice', 'Magento\Bundle\Model\Product\Price'), array('getShipId', 'Magento\Shipping\Block\Tracking\Popup'), + array('getShippingCarrier', 'Magento\Sales\Model\Order', 'Magento\Shipping\Model\CarrierFactory::create'), array('getShowTemplateHints', 'Magento\View\Element\Template'), array('getSortedChildBlocks', '', 'getChildNames() + $this->getLayout()->getBlock($name)'), array('getSortedChildren', '', 'getChildNames'), @@ -589,7 +594,7 @@ return array( array('isAdmin', 'Magento\Core\Model\Store'), array('isAllowedGuestCheckout', 'Magento\Sales\Model\Quote'), array('isAutomaticCleaningAvailable', 'Magento\Cache\Backend\Eaccelerator'), - array('isCheckoutAvailable', 'Magento\Checkout\Model\Type\Multishipping'), + array('isCheckoutAvailable', 'Magento\Multishipping\Model\Checkout\Type\Multishipping'), array('isDirectOutput', 'Magento\Core\Model\Layout'), array('isDirectOutput', 'Magento\View\LayoutInterface'), array('isFulAmountCovered'), @@ -745,6 +750,7 @@ return array( array('validateDataArray', 'Magento\Convert\Container\AbstractContainer'), array('validateFile', 'Magento\Core\Model\Design\Package'), array('validateOrder', 'Magento\Checkout\Model\Type\Onepage'), + array('viewTrackAction', 'Magento\Sales\Controller\Adminhtml\Order\Shipment'), array('_prepareOptionValues', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), array('_getOptionValuesCollection', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), array(' _prepareSystemAttributeOptionValues', 'Magento\Eav\Block\Adminhtml\Attribute\Edit\Options\AbstractOptions'), @@ -829,6 +835,8 @@ return array( array('prepareColumn', 'Magento\Eav\Model\Resource\Helper'), array('getInsertFromSelectUsingAnalytic', 'Magento\Eav\Model\Resource\Helper'), array('setOneRowLimit', 'Magento\Eav\Model\Resource\Helper'), + array('getCarrierByCode', 'Magento\Shipping\Model\Config', 'Magento\Shipping\Model\CarrierFactory::create||get'), + array('getCarrierInstance', 'Magento\Shipping\Model\Config', 'Magento\Shipping\Model\CarrierFactory::create||get'), array('getCastToIntExpression', 'Magento\Eav\Model\Resource\Helper'), array('_initMetaTags', 'Magento\Theme\Block\Html\Head'), array('addMetaTag', 'Magento\Theme\Block\Html\Head'), @@ -1122,4 +1130,63 @@ return array( array('getDisplayMode', '\Magento\Catalog\Model\Session'), array('setEscapeMessageFlag', 'Magento\View\Block\Messages'), array('shouldEscapeMessage', 'Magento\View\Block\Messages'), + array('isPathInDirectory', 'Magento\Filesystem\Directory\ReadInterface'), + array('isSuper', '\Magento\Catalog\Model\Product'), + array('isSuperGroup', '\Magento\Catalog\Model\Product'), + array('isGrouped', '\Magento\Catalog\Model\Product'), + array('isSuperConfig', '\Magento\Catalog\Model\Product'), + array('getGroupedLinkCollection', '\Magento\Catalog\Model\Product'), + array('duplicate', '\Magento\Catalog\Model\Product', '\Magento\Catalog\Model\Product\Copier::copy'), + array('useGroupedLinks', '\Magento\Catalog\Model\Product\Link'), + array('saveGroupedLinks', '\Magento\Catalog\Model\Product\Link'), + array( + '_initProductSave', '\Magento\Catalog\Controller\Adminhtml\Product', + '\Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper::initialize' + ), + array('superGroupAction', '\Magento\Catalog\Controller\Adminhtml\Product'), + array('superGroupPopupAction', '\Magento\Catalog\Controller\Adminhtml\Product', + '\Magento\GroupedProduct\Controller\Adminhtml\Edit::popupAction' + ), + array( + 'prepareProductSave', '\Magento\Bundle\Model\Observer', + '\Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Bundle::afterInitialize' + ), + array('duplicateProduct', 'Magento\Bundle\Model\Observer', + 'Magento\Bundle\Model\Product\CopyConstructor\Bundle::build' + ), + array( + 'prepareProductSave', '\Magento\Downloadable\Model\Observer', + '\Magento\Downloadable\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Downloadable::afterInitialize' + ), + array( + 'duplicateProduct', '\Magento\Downloadable\Model\Observer', + '\Magento\Downloadable\Model\Product\CopyConstructor\Downloadable::build' + ), + array( + 'catalogProductPrepareSave', '\Magento\PricePermissions\Model\Observer', + '\Magento\PricePermissions\Controller\Adminhtml\Product\Initialization\Helper\Plugin\PricePermissions::' + . 'afterInitialize' + ), + array( + 'getGroupedOptions', '\Magento\Catalog\Helper\Product\Configuration', + '\Magento\GroupedProduct\Helper\Product\Configuration\Plugin\Grouped::aroundGetOptions', + ), + array('copyInventoryData', 'Magento\CatalogInventory\Model\Observer', + '\Magento\CatalogInventory\Model\Product\CopyConstructor\CatalogInventory::build' + ), + ['getTrackingAjaxUrl', 'Magento\Shipping\Helper\Data'], + ['isFreeMethod', 'Magento\Shipping\Helper\Data'], + ['_initOrder', 'Magento\Shipping\Controller\Tracking'], + ['ajaxAction', 'Magento\Shipping\Controller\Tracking'], + ['_getTracksCollection', 'Magento\Shipping\Controller\Tracking'], + array('getAddToWishlistUrl', 'Magento\Catalog\Block\Product\AbstractProduct'), + array('getAddToWishlistUrl', 'Magento\Catalog\Helper\Product\Compare'), + array('getAddToWishlistUrl', 'Magento\Wishlist\Block\AbstractBlock'), + array('getAddUrlWithParams', 'Magento\Wishlist\Helper\Data'), + array('getMoveFromCartUrl', 'Magento\Wishlist\Helper\Data'), + array('getAddUrl', 'Magento\Wishlist\Helper\Data'), + array('getRemoveUrl', 'Magento\Wishlist\Helper\Data'), + array('getUpdateUrl', 'Magento\Wishlist\Helper\Data'), + array('getItemRemoveUrl', 'Magento\Wishlist\Block\AbstractBlock'), + array('_getUrlParams', 'Magento\Catalog\Helper\Product\Compare'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php index 037f90f4ad2..bbdd9b45e76 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php @@ -73,7 +73,7 @@ return array( array('_moduleReader', 'Magento\Backend\Model\Menu\Config'), array('_option', 'Magento\Captcha\Helper\Data', '_dirs'), array('_options', 'Magento\Core\Model\Config', 'Magento\Filesystem'), - array('_optionsMapping', null, '\Magento\Filesystem::getPath($nodeKey)'), + array('_optionsMapping', null, '\Magento\App\Filesystem::getPath($nodeKey)'), array('_order', 'Magento\Checkout\Block\Onepage\Success'), array('_order_id'), array('_parent', 'Magento\Core\Block\AbstractBlock'), diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt index b36ee6c2cb7..5d72f476bdc 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt @@ -14,6 +14,7 @@ app/code/Magento/Integration/view app/code/Magento/Theme/view app/code/Magento/User/view app/code/Magento/Webapi/view +app/code/Magento/GroupedProduct/view dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php dev/tests/integration/framework/Magento/TestFramework/Db/Adapter/Mysql.php dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index c0726a3247d..f7aabbe6797 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -16,7 +16,6 @@ lib/Magento/DB sql data Magento/Paypal -Magento/Paygate Magento/Downloadable Magento/Core/Model/Resource/Helper Magento/Catalog/Block/Adminhtml @@ -74,7 +73,8 @@ Magento/Reports/Model/Resource Magento/Review/Block Magento/Rss/Block/Catalog Magento/Rule -Magento/Sales/Block/Adminhtml +Magento/Sales/Block/Adminhtml/Order +Magento/Shipping/Block/Adminhtml/View Magento/Sales/Model/Resource Magento/Sales/Model/Quote/Address/Total Magento/Sales/Model/Resource/Report/Order diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt index 1f9af532727..a6edf3e83f0 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt @@ -16,7 +16,6 @@ app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php app/code/Magento/Catalog/Block/Adminhtml/Product/Options/Ajax.php app/code/Magento/Catalog/Block/Product/Configurable -app/code/Magento/Catalog/Block/Product/Grouped app/code/Magento/Catalog/Block/Product/TemplateSelector.php app/code/Magento/Catalog/Block/Product/View/BaseImage.php app/code/Magento/Catalog/Block/Product/View/Gallery.php @@ -39,7 +38,6 @@ app/code/Magento/Cms/Controller/Router.php app/code/Magento/Cms/Model/Template/FilterProvider.php app/code/Magento/Core/data app/code/Magento/Core/Model/Config -app/code/Magento/Core/Model/DataService app/code/Magento/Core/Model/Design.php app/code/Magento/Core/Model/Layout/Factory.php app/code/Magento/Core/Model/Layout/Update.php @@ -97,7 +95,6 @@ app/code/Magento/Log/Model/Resource/Shell.php app/code/Magento/Log/Model/Shell.php app/code/Magento/Log/Model/Shell app/code/Magento/Theme/Block/Html/Head -app/code/Magento/PageCache/Model/CacheControlFactory.php app/code/Magento/ProductAlert/Block/Product/View app/code/Magento/Reports/Block/Adminhtml/Customer app/code/Magento/Reports/Block/Adminhtml/Product @@ -116,9 +113,16 @@ app/code/Magento/Sales/Model/Order/Pdf/Config app/code/Magento/Sales/Model/Order/Pdf/Config.php app/code/Magento/Sales/Model/Order/Pdf/Total/Factory.php app/code/Magento/Sales/Model/Observer +app/code/Magento/Sales/Model/Quote/Address/*Interface.php app/code/Magento/SalesRule/Model/Plugin +app/code/Magento/Shipping/Block/Adminhtml/Order/Tracking/Invoice.php +app/code/Magento/Shipping/Model/Observer.php +app/code/Magento/Shipping/Model/Order/Track.php +app/code/Magento/Shipping/Model/CarrierFactory.php +app/code/Magento/Shipping/Model/Resource/Order app/code/Magento/Theme app/code/Magento/Webapi +app/code/Magento/GroupedProduct app/code/Magento/Wishlist/Block/Link.php dev/shell dev/tests/integration diff --git a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php index bdd3dcad3f9..49e9c21de1e 100644 --- a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php +++ b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php @@ -107,7 +107,7 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $this->_eventManagerMock = $this->_makeMock('Magento\Event\ManagerInterface'); $this->_controllerMock = $this->_makeMock('Magento\App\FrontController'); $this->_loggerMock = $this->_makeMock('Magento\Logger'); - $this->_filesystemMock = $this->_makeMock('Magento\Filesystem'); + $this->_filesystemMock = $this->_makeMock('Magento\App\Filesystem'); $this->_cacheMock = $this->_makeMock('Magento\App\CacheInterface'); $this->_storeConfigMock = $this->_makeMock('Magento\Core\Model\Store\Config'); $this->_storeManagerMock = $this->_makeMock('Magento\Core\Model\StoreManager'); diff --git a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php index 8647fe25ac4..d91524f51c4 100644 --- a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php +++ b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php @@ -219,4 +219,25 @@ class ObjectManager } return $constructArguments; } + + /** + * Get collection mock + * + * @param string $className + * @param array $data + * @return \PHPUnit_Framework_MockObject_MockObject + * @throws \InvalidArgumentException + */ + public function getCollectionMock($className, array $data) + { + if (!is_subclass_of($className, '\Magento\Data\Collection')) { + throw new \InvalidArgumentException($className . ' does not instance of \Magento\Data\Collection'); + } + $mock = $this->_testObject->getMock($className, array(), array(), '', false, false); + $iterator = new \ArrayIterator($data); + $mock->expects($this->_testObject->any()) + ->method('getIterator') + ->will($this->_testObject->returnValue($iterator)); + return $mock; + } } diff --git a/dev/tests/unit/testsuite/Magento/App/Cache/Frontend/FactoryTest.php b/dev/tests/unit/testsuite/Magento/App/Cache/Frontend/FactoryTest.php index a6928c983fd..86be6faaa07 100644 --- a/dev/tests/unit/testsuite/Magento/App/Cache/Frontend/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Cache/Frontend/FactoryTest.php @@ -174,11 +174,11 @@ class FactoryTest extends \PHPUnit_Framework_TestCase ->will($this->returnCallback($processFrontendFunc)); $map = array( - array(\Magento\Filesystem::CACHE, 'CACHE_DIR'), - array(\Magento\Filesystem::CONFIG, 'CONFIG_DIR'), + array(\Magento\App\Filesystem::CACHE_DIR, 'CACHE_DIR'), + array(\Magento\App\Filesystem::CONFIG_DIR, 'CONFIG_DIR'), ); - $filesystem = $this->getMock('Magento\Filesystem', array('getPath'), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array('getPath'), array(), '', false); $filesystem->expects($this->any()) ->method('getPath') diff --git a/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/PrimaryTest.php b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/PrimaryTest.php index 1f005a294c0..6bc14536aef 100644 --- a/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/PrimaryTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Config/FileResolver/PrimaryTest.php @@ -34,14 +34,14 @@ class PrimaryTest extends \PHPUnit_Framework_TestCase public function testGet(array $fileList, $scope, $filename) { $directory = $this->getMock('Magento\Filesystem\Directory\Read', array('search'), array(), '', false); - $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array('getDirectoryRead'), array(), '', false); $iteratorFactory = $this->getMock( 'Magento\Config\FileIteratorFactory', array('create'), array(), '', false ); $filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::CONFIG) + ->with(\Magento\App\Filesystem::CONFIG_DIR) ->will($this->returnValue($directory)); $directory->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php b/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php index 43dacaf62de..19ca14435fe 100644 --- a/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Config/LoaderTest.php @@ -33,13 +33,13 @@ class LoaderTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Filesystem\DirectoryList | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem\DirectoryList | \PHPUnit_Framework_MockObject_MockObject */ protected $_dirs; public function setUp() { - $this->_dirs = $this->getMock('\Magento\Filesystem\DirectoryList', array('getDir'), array(), '', false); + $this->_dirs = $this->getMock('\Magento\App\Filesystem\DirectoryList', array('getDir'), array(), '', false); } public function testWithOneXmlFile() diff --git a/dev/tests/unit/testsuite/Magento/App/Console/ResponseTest.php b/dev/tests/unit/testsuite/Magento/App/Console/ResponseTest.php new file mode 100644 index 00000000000..496392b5fd6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/Console/ResponseTest.php @@ -0,0 +1,68 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App\Console; + +class ResponseTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\App\Console\Response + */ + protected $model; + + public function setUp() + { + $this->model = new \Magento\App\Console\Response(); + } + + public function testSendResponseDefaultBehaviour() + { + $this->model->terminateOnSend(false); + $this->assertEquals(0, $this->model->sendResponse()); + } + + /** + * @dataProvider setCodeProvider + */ + public function testSetCode($code, $expectedCode) + { + $this->model->terminateOnSend(false); + $this->model->setCode($code); + $result = $this->model->sendResponse(); + $this->assertEquals($expectedCode, $result); + } + + public static function setCodeProvider() + { + $largeCode = 256; + $lowCode = 1; + $lowestCode = -255; + return array( + array($largeCode, 255), + array($lowCode, $lowCode), + array($lowestCode, $lowestCode), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/CronTest.php b/dev/tests/unit/testsuite/Magento/App/CronTest.php index 41c49383eb3..c08e2d4fdf7 100644 --- a/dev/tests/unit/testsuite/Magento/App/CronTest.php +++ b/dev/tests/unit/testsuite/Magento/App/CronTest.php @@ -45,13 +45,20 @@ class CronTest extends \PHPUnit_Framework_TestCase */ protected $_stateMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_responseMock; + protected function setUp() { $this->_eventManagerMock = $this->getMock('Magento\Event\ManagerInterface'); $this->_stateMock = $this->getMock('Magento\App\State', array(), array(), '', false); + $this->_responseMock = $this->getMock('Magento\App\Console\Response', array(), array(), '', false); $this->_model = new Cron( $this->_eventManagerMock, - $this->_stateMock + $this->_stateMock, + $this->_responseMock ); } @@ -59,6 +66,7 @@ class CronTest extends \PHPUnit_Framework_TestCase { $this->_stateMock->expects($this->once())->method('setAreaCode')->with('crontab'); $this->_eventManagerMock->expects($this->once())->method('dispatch')->with('default'); - $this->assertEquals(0, $this->_model->execute()); + $this->_responseMock->expects($this->once())->method('setCode')->with(0); + $this->assertEquals($this->_responseMock, $this->_model->execute()); } } diff --git a/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php b/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php index 159c04b6fa6..e0ca6964362 100644 --- a/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php +++ b/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php @@ -35,6 +35,11 @@ class EntryPointTest extends \PHPUnit_Framework_TestCase */ protected $_objectManagerMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_responseMock; + /** * @var string */ @@ -51,6 +56,7 @@ class EntryPointTest extends \PHPUnit_Framework_TestCase 'MAGE_MODE' => 'developer', ); $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); + $this->_responseMock = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); $this->_rootDir = realpath(__DIR__ . '/../../../../../../../'); $this->_model = new \Magento\App\EntryPoint\EntryPoint( $this->_rootDir, @@ -63,11 +69,10 @@ class EntryPointTest extends \PHPUnit_Framework_TestCase { $applicationName = '\Magento\App\TestApplication'; $applicationMock = $this->getMock('\Magento\AppInterface'); - $applicationMock->expects($this->once())->method('execute')->will($this->returnValue(0)); + $applicationMock->expects($this->once())->method('execute')->will($this->returnValue($this->_responseMock)); $this->_objectManagerMock->expects($this->once())->method('create')->with($applicationName, array()) ->will($this->returnValue($applicationMock)); - - $this->assertEquals(0, $this->_model->run($applicationName)); + $this->assertNull($this->_model->run($applicationName)); } public function testRunCatchesExceptionThrownByApplication() @@ -81,9 +86,6 @@ class EntryPointTest extends \PHPUnit_Framework_TestCase ->method('create') ->with($applicationName, array()) ->will($this->returnValue($applicationMock)); - // clean output - ob_start(); - $this->assertEquals(1, $this->_model->run($applicationName)); - ob_end_clean(); + $this->assertNull($this->_model->run($applicationName)); } } diff --git a/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php b/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php index fe63f540934..2ab60a00d83 100644 --- a/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Error/HandlerTest.php @@ -37,7 +37,7 @@ class HandlerTest extends \PHPUnit_Framework_TestCase /** * Filesystem mock * - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $filesystem; @@ -58,7 +58,7 @@ class HandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $this->filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->appState = $this->getMock('Magento\App\State', array(), array(), '', false); $this->handler = new \Magento\App\Error\Handler($this->logger, $this->filesystem, $this->appState); } @@ -93,7 +93,7 @@ class HandlerTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(\Magento\App\State::MODE_DEFAULT)); $this->filesystem->expects($this->atLeastOnce()) ->method('getPath') - ->with(\Magento\Filesystem::PUB) + ->with(\Magento\App\Filesystem::PUB_DIR) ->will($this->returnValue(dirname(__DIR__) . '/../_files')); $exception = new \Exception('TestMessage'); diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryList/VerificationTest.php b/dev/tests/unit/testsuite/Magento/App/Filesystem/DirectoryList/VerificationTest.php similarity index 66% rename from dev/tests/unit/testsuite/Magento/Filesystem/DirectoryList/VerificationTest.php rename to dev/tests/unit/testsuite/Magento/App/Filesystem/DirectoryList/VerificationTest.php index f575216f10d..951dd109ae9 100644 --- a/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryList/VerificationTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Filesystem/DirectoryList/VerificationTest.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Filesystem\DirectoryList; +namespace Magento\App\Filesystem\DirectoryList; use Magento\App\State; @@ -52,36 +52,25 @@ class VerificationTest extends \PHPUnit_Framework_TestCase 'developer mode' => array( State::MODE_DEVELOPER, array( - \Magento\Filesystem::MEDIA => array(true, true, 'base_dir/pub/media'), - \Magento\Filesystem::STATIC_VIEW => array(true, true, 'base_dir/pub/static'), - \Magento\Filesystem::VAR_DIR => array(true, true, 'base_dir/var'), - \Magento\Filesystem::TMP => array(true, true, 'base_dir/var/tmp'), - \Magento\Filesystem::CACHE => array(true, true, 'base_dir/var/cache'), - \Magento\Filesystem::LOG => array(true, true, 'base_dir/var/log'), - \Magento\Filesystem::SESSION => array(true, true, 'base_dir/var/session') + \Magento\App\Filesystem::CACHE_DIR => array(true, true, 'base_dir/var/cache'), + \Magento\App\Filesystem::LOG_DIR => array(true, true, 'base_dir/var/log'), + \Magento\App\Filesystem::SESSION_DIR => array(true, true, 'base_dir/var/session') ), ), 'with_not_existing_dirs' => array( State::MODE_DEFAULT, array( - \Magento\Filesystem::MEDIA => array(false, true, 'base_dir/pub/media'), - \Magento\Filesystem::STATIC_VIEW => array(true, true, 'base_dir/pub/static'), - \Magento\Filesystem::VAR_DIR => array(false, true, 'base_dir/var'), - \Magento\Filesystem::TMP => array(true, true, 'base_dir/var/tmp'), - \Magento\Filesystem::CACHE => array(false, true, 'base_dir/var/cache'), - \Magento\Filesystem::LOG => array(true, true, 'base_dir/var/log'), - \Magento\Filesystem::SESSION => array(false, true, 'base_dir/var/session') + \Magento\App\Filesystem::CACHE_DIR => array(false, true, 'base_dir/var/cache'), + \Magento\App\Filesystem::LOG_DIR => array(true, true, 'base_dir/var/log'), + \Magento\App\Filesystem::SESSION_DIR => array(false, true, 'base_dir/var/session') ), ), 'production mode' => array( State::MODE_PRODUCTION, array( - \Magento\Filesystem::MEDIA => array(true, true, 'base_dir/pub/media'), - \Magento\Filesystem::VAR_DIR => array(true, true, 'base_dir/var'), - \Magento\Filesystem::TMP => array(true, true, 'base_dir/var/tmp'), - \Magento\Filesystem::CACHE => array(true, true, 'base_dir/var/cache'), - \Magento\Filesystem::LOG => array(true, true, 'base_dir/var/log'), - \Magento\Filesystem::SESSION => array(true, true, 'base_dir/var/session') + \Magento\App\Filesystem::CACHE_DIR => array(true, true, 'base_dir/var/cache'), + \Magento\App\Filesystem::LOG_DIR => array(true, true, 'base_dir/var/log'), + \Magento\App\Filesystem::SESSION_DIR => array(true, true, 'base_dir/var/session') ), ), ); @@ -112,13 +101,9 @@ class VerificationTest extends \PHPUnit_Framework_TestCase 'developer mode' => array( State::MODE_DEVELOPER, array( - \Magento\Filesystem::MEDIA => array(true, false, 'base_dir/pub/media'), - \Magento\Filesystem::STATIC_VIEW => array(true, true, 'base_dir/pub/static'), - \Magento\Filesystem::VAR_DIR => array(true, false, 'base_dir/var'), - \Magento\Filesystem::TMP => array(true, true, 'base_dir/var/tmp'), - \Magento\Filesystem::CACHE => array(true, false, 'base_dir/var/cache'), - \Magento\Filesystem::LOG => array(true, true, 'base_dir/var/log'), - \Magento\Filesystem::SESSION => array(true, false, 'base_dir/var/session') + \Magento\App\Filesystem::CACHE_DIR => array(true, false, 'base_dir/var/cache'), + \Magento\App\Filesystem::LOG_DIR => array(true, true, 'base_dir/var/log'), + \Magento\App\Filesystem::SESSION_DIR => array(true, false, 'base_dir/var/session') ), ) ); @@ -149,13 +134,9 @@ class VerificationTest extends \PHPUnit_Framework_TestCase 'developer mode' => array( State::MODE_DEVELOPER, array( - \Magento\Filesystem::MEDIA => array(true, false, 'base_dir/pub/media', true), - \Magento\Filesystem::STATIC_VIEW => array(true, true, 'base_dir/pub/static'), - \Magento\Filesystem::VAR_DIR => array(true, false, 'base_dir/var'), - \Magento\Filesystem::TMP => array(true, true, 'base_dir/var/tmp', true), - \Magento\Filesystem::CACHE => array(true, false, 'base_dir/var/cache'), - \Magento\Filesystem::LOG => array(true, true, 'base_dir/var/log'), - \Magento\Filesystem::SESSION => array(true, false, 'base_dir/var/session', true) + \Magento\App\Filesystem::CACHE_DIR => array(true, false, 'base_dir/var/cache'), + \Magento\App\Filesystem::LOG_DIR => array(true, true, 'base_dir/var/log'), + \Magento\App\Filesystem::SESSION_DIR => array(true, false, 'base_dir/var/session', true) ), ) ); @@ -186,7 +167,13 @@ class VerificationTest extends \PHPUnit_Framework_TestCase */ protected function getFilesystemMock(array $dirsToVerify) { - $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite', '__wakeup'), array(), '', false); + $filesystem = $this->getMock( + 'Magento\App\Filesystem', + array('getDirectoryWrite', '__wakeup'), + array(), + '', + false + ); $valueMap = array(); foreach ($dirsToVerify as $code => $config) { $createException = isset($config[3]) ? $config[3] : false; diff --git a/dev/tests/unit/testsuite/Magento/App/FilesystemTest.php b/dev/tests/unit/testsuite/Magento/App/FilesystemTest.php new file mode 100644 index 00000000000..d4c4c67333d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/App/FilesystemTest.php @@ -0,0 +1,71 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; + +class FilesystemTest extends \PHPUnit_Framework_TestCase +{ + /** @var Filesystem */ + protected $_filesystem; + + /** @var \Magento\Filesystem\Directory\ReadFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $_dirReadFactoryMock; + + /** @var \Magento\Filesystem\Directory\WriteFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $_dirWriteFactoryMock; + + /** @var \Magento\App\Filesystem\DirectoryList|\PHPUnit_Framework_MockObject_MockObject */ + protected $_directoryListMock; + + /** @var \Magento\Filesystem\File\ReadFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $_fileReadFactoryMock; + + public function setUp() + { + $this->_dirReadFactoryMock = $this->getMock('Magento\Filesystem\Directory\ReadFactory', [], [], '', false); + $this->_directoryListMock = $this->getMock('Magento\App\Filesystem\DirectoryList', [], [], '', false); + $this->_dirWriteFactoryMock = $this->getMock('Magento\Filesystem\Directory\WriteFactory', [], [], '', false); + $this->_fileReadFactoryMock = $this->getMock('Magento\Filesystem\File\ReadFactory', [], [], '', false); + + $this->_filesystem = new Filesystem( + $this->_directoryListMock, + $this->_dirReadFactoryMock, + $this->_dirWriteFactoryMock, + $this->_fileReadFactoryMock + ); + } + + public function testGetPath() + { + $this->_setupDirectoryListMock(['path' => '\\some\\path']); + $this->assertEquals('/some/path', $this->_filesystem->getPath(Filesystem::ROOT_DIR)); + } + + protected function _setupDirectoryListMock(array $config) + { + $this->_directoryListMock + ->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue($config)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php b/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php index f947592d33f..bfccbc5fc7d 100644 --- a/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Response/Http/FileFactoryTest.php @@ -48,7 +48,7 @@ class FileFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_fileSystemMock = $this->getMock( - 'Magento\Filesystem', array('getDirectoryWrite'), array(), '', false + 'Magento\App\Filesystem', array('getDirectoryWrite'), array(), '', false ); $this->_dirMock = $this->getMockBuilder('\Magento\Filesystem\Directory\Write') ->disableOriginalConstructor() diff --git a/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php b/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php index 52a743518cf..73e163bacc6 100644 --- a/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php +++ b/dev/tests/unit/testsuite/Magento/Authorizenet/Helper/BackendTest.php @@ -61,7 +61,7 @@ class BackendTest extends \PHPUnit_Framework_TestCase { $this->_urlBuilder->expects($this->once()) ->method('getUrl') - ->with($this->equalTo('*/authorizenet_directpost_payment/place'), $this->equalTo(array())) + ->with($this->equalTo('adminhtml/authorizenet_directpost_payment/place'), $this->equalTo(array())) ->will($this->returnValue('some value')); $this->assertEquals('some value', $this->_model->getPlaceOrderAdminUrl()); } diff --git a/dev/tests/unit/testsuite/Magento/Paygate/Model/Authorizenet/CardsTest.php b/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Authorizenet/CardsTest.php similarity index 94% rename from dev/tests/unit/testsuite/Magento/Paygate/Model/Authorizenet/CardsTest.php rename to dev/tests/unit/testsuite/Magento/Authorizenet/Model/Authorizenet/CardsTest.php index 3c23774f8ac..42697d1c1b6 100644 --- a/dev/tests/unit/testsuite/Magento/Paygate/Model/Authorizenet/CardsTest.php +++ b/dev/tests/unit/testsuite/Magento/Authorizenet/Model/Authorizenet/CardsTest.php @@ -19,25 +19,25 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Paygate + * @package Magento_Authorizenet * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Paygate\Model\Authorizenet; +namespace Magento\Authorizenet\Model\Authorizenet; class CardsTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Paygate\Model\Authorizenet\Card + * @var \Magento\Authorizenet\Model\Authorizenet\Card */ protected $_object; protected function setUp() { $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_object = $objectManagerHelper->getObject('Magento\Paygate\Model\Authorizenet\Cards'); + $this->_object = $objectManagerHelper->getObject('Magento\Authorizenet\Model\Authorizenet\Cards'); } /** diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/TabTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/TabTest.php new file mode 100644 index 00000000000..3375da44616 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/TabTest.php @@ -0,0 +1,77 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Backend\Block\Widget; + +class TabTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $helper; + + protected function setUp() + { + $this->helper = new \Magento\TestFramework\Helper\ObjectManager($this); + } + + /** + * @param string $method + * @param string $field + * @param mixed $value + * @param mixed $expected + * @dataProvider dataProvider + */ + public function testGetters($method, $field, $value, $expected) + { + /** @var \Magento\Backend\Block\Widget\Tab $object */ + $object = $this->helper->getObject( + '\Magento\Backend\Block\Widget\Tab', + array('data' => array($field => $value)) + ); + $this->assertEquals($expected, $object->$method()); + } + + public function dataProvider() + { + return array( + 'getTabLabel' => array('getTabLabel', 'label', 'test label', 'test label'), + 'getTabLabel (default)' => array('getTabLabel', 'empty', 'test label', null), + + 'getTabTitle' => array('getTabTitle', 'title', 'test title', 'test title'), + 'getTabTitle (default)' => array('getTabTitle', 'empty', 'test title', null), + + 'canShowTab' => array('canShowTab', 'can_show', false, false), + 'canShowTab (default)' => array('canShowTab', 'empty', false, true), + + 'isHidden' => array('isHidden', 'is_hidden', true, true), + 'isHidden (default)' => array('isHidden', 'empty', true, false), + + 'getTabClass' => array('getTabClass', 'class', 'test classes', 'test classes'), + 'getTabClass (default)' => array('getTabClass', 'empty', 'test classes', null), + + 'getTabUrl' => array('getTabUrl', 'url', 'test url', 'test url'), + 'getTabUrl (default)' => array('getTabUrl', 'empty', 'test url', '#'), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php index cf05297856f..277fe207ab5 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/FieldTest.php @@ -63,11 +63,6 @@ class FieldTest extends \PHPUnit_Framework_TestCase */ protected $_blockFactoryMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_dsGraphMock; - /** * @var \PHPUnit_Framework_MockObject_MockObject */ @@ -96,9 +91,6 @@ class FieldTest extends \PHPUnit_Framework_TestCase $this->_blockFactoryMock = $this->getMock( 'Magento\View\Element\BlockFactory', array(), array(), '', false ); - $this->_dsGraphMock = $this->getMock( - 'Magento\Core\Model\DataService\Graph', array(), array(), '', false - ); $this->_depMapperMock = $this->getMock( 'Magento\Backend\Model\Config\Structure\Element\Dependency\Mapper', array(), array(), '', false ); @@ -109,7 +101,6 @@ class FieldTest extends \PHPUnit_Framework_TestCase $this->_sourceFactoryMock, $this->_commentFactoryMock, $this->_blockFactoryMock, - $this->_dsGraphMock, $this->_depMapperMock ); } @@ -402,53 +393,6 @@ class FieldTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expected, $this->_model->getOptions()); } - public function testGetOptionsWithServiceOptions() - { - $option = array( - array('customLabel' => 'test', 'customId' => 0), - array('customLabel' => 'test2', 'customId' => 1) - ); - $this->_dsGraphMock->expects($this->once()) - ->method('get') - ->with('serviceCallName') - ->will($this->returnValue($option)); - - $expected = array( - array('label' => __('test'), 'value' => 0), - array('label' => __('test2'), 'value' => 1) - ); - $options = array( - 'service_call' => 'serviceCallName', - 'idField' => 'customId', - 'labelField' => 'customLabel', - 'includeSelectLine' => 'false', - ); - $this->_model->setData(array('source_service' => $options), 'scope'); - $this->assertEquals($expected, $this->_model->getOptions()); - } - - public function testGetOptionsWithServiceOptionsButNoFieldNamesSpecified() - { - $option = array( - array('name' => 'test', 'id' => 0), - array('name' => 'test2', 'id' => 1) - ); - $this->_dsGraphMock->expects($this->once()) - ->method('get') - ->with('serviceCallName') - ->will($this->returnValue($option)); - - $expected = array( - array('label' => __('test'), 'value' => 0), - array('label' => __('test2'), 'value' => 1) - ); - $options = array( - 'service_call' => 'serviceCallName', - ); - $this->_model->setData(array('source_service' => $options), 'scope'); - $this->assertEquals($expected, $this->_model->getOptions()); - } - public function testGetDependenciesWithoutDependencies() { $this->_depMapperMock->expects($this->never())->method('getDependencies'); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/_files/invalidSystemXmlArray.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/_files/invalidSystemXmlArray.php index d5e7c85f283..7a2a91d116d 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/_files/invalidSystemXmlArray.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/_files/invalidSystemXmlArray.php @@ -120,20 +120,6 @@ return array . '<group id="group2"><label>Label_One</label></group></section></system></config>', array("Element 'section', attribute 'advanced': 'string' is not a valid value of the atomic type " . "'xs:boolean'.")), - 'source_service_without_all_required_attribute' => array( - '<?xml version="1.0"?><config><system><section id="section1" advanced="false">' - . '<group id="group1"><label>Label</label><field id="field_id"><source_service service_call="name" ' - . 'idField="field" labelField="label" includeEmptyValueOption="false"/><source_service labelField="label"/>' - . '</field></group><group id="group2"><label>Label_One</label></group></section></system></config>', - array("Element 'source_service': The attribute 'service_call' is required but missing.")), - 'includeEmptyValueOption_attribute_with_invalid_value' => array( - '<?xml version="1.0"?><config><system><section id="section1" advanced="false">' - . '<group id="group1"><label>Label</label><field id="field_id"><source_service service_call="name" ' - . 'includeEmptyValueOption="string"/><source_service service_call="label" includeEmptyValueOption="10"/>' - . '</field></group><group id="group2"><label>Label_One</label></group></section></system></config>', - array("Element 'source_service', attribute 'includeEmptyValueOption': 'string' is not a valid value of the " - . "atomic type 'xs:boolean'.", "Element 'source_service', attribute 'includeEmptyValueOption': '10' is not a " - . "valid value of the atomic type 'xs:boolean'.")), 'options_node_without_any_options' => array( '<?xml version="1.0"?><config><system><section id="section1" advanced="false">' . '<group id="group1"><label>Label</label><field id="field_id"><options />' diff --git a/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php b/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php index 222a80df442..406a8ec6a8a 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/MediaTest.php @@ -36,7 +36,7 @@ require_once(__DIR__ . '/_files/io.php'); class MediaTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystemMock; @@ -77,7 +77,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase ->method('create') ->will($this->returnValue(true)); - $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_backupFactoryMock = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); $this->_backupFactoryMock->expects($this->once()) ->method('create') diff --git a/dev/tests/unit/testsuite/Magento/Backup/Model/Fs/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Backup/Model/Fs/CollectionTest.php index 0aa69fa2508..8e7f7cd3819 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/Model/Fs/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/Model/Fs/CollectionTest.php @@ -31,7 +31,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase public function testConstructor() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $filesystem = $this->getMockBuilder('\Magento\Filesystem') + $filesystem = $this->getMockBuilder('\Magento\App\Filesystem') ->disableOriginalConstructor() ->getMock(); $directoryWrite = $this->getMockBuilder('\Magento\Filesystem\Directory\WriteInterface') diff --git a/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php b/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php index 1aab9e76586..cea80695858 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/NomediaTest.php @@ -35,7 +35,7 @@ require_once(__DIR__ . '/_files/io.php'); class NomediaTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystemMock; @@ -76,7 +76,7 @@ class NomediaTest extends \PHPUnit_Framework_TestCase ->method('create') ->will($this->returnValue(true)); - $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_backupFactoryMock = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); $this->_backupFactoryMock->expects($this->once()) ->method('create') diff --git a/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php b/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php index 4d3714da467..620a47f023f 100644 --- a/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php +++ b/dev/tests/unit/testsuite/Magento/Backup/SnapshotTest.php @@ -31,7 +31,7 @@ class SnapshotTest extends \PHPUnit_Framework_TestCase { public function testGetDbBackupFilename() { - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $backupFactory = $this->getMock('Magento\Backup\Factory', array(), array(), '', false); $manager = $this->getMock( 'Magento\Backup\Snapshot', diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Controller/Adminhtml/Product/Initialization/Helper/Plugin/BundleTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Controller/Adminhtml/Product/Initialization/Helper/Plugin/BundleTest.php new file mode 100644 index 00000000000..a70d7604041 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Bundle/Controller/Adminhtml/Product/Initialization/Helper/Plugin/BundleTest.php @@ -0,0 +1,135 @@ +<?php +/** + * Test class for \Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Bundle + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin; + +class BundleTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Bundle + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $requestMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + protected function setUp() + { + $this->requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $methods = array( + 'getCompositeReadonly', 'setBundleOptionsData', + 'setBundleSelectionsData', 'getPriceType', 'setCanSaveCustomOptions', + 'getProductOptions', 'setProductOptions', 'setCanSaveBundleSelections', '__wakeup' + ); + $this->productMock = $this->getMock('\Magento\Catalog\Model\Product', $methods, array(), '', false); + $this->model = new \Magento\Bundle\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Bundle( + $this->requestMock + ); + } + + public function testAfterInitializeIfBundleAnsCustomOptionsAndBundleSelectionsExist() + { + $productOptionsBefore = array( + 0 => array('key' => 'value'), + 1 => array('is_delete' => false) + ); + $productOptionsAfter = array( + 0 => array('key' => 'value', + 'is_delete' => 1 + ), + 1 => array('is_delete' => 1) + ); + $postValue = 'postValue'; + $valueMap = array( + array('bundle_options', null, $postValue), + array('bundle_selections', null, $postValue), + array('affect_bundle_product_selections', null, 1), + ); + $this->requestMock->expects($this->any())->method('getPost')->will($this->returnValueMap($valueMap)); + $this->productMock->expects($this->any())->method('getCompositeReadonly')->will($this->returnValue(false)); + $this->productMock->expects($this->once())->method('setBundleOptionsData')->with($postValue); + $this->productMock->expects($this->once())->method('setBundleSelectionsData')->with($postValue); + $this->productMock->expects($this->once())->method('getPriceType')->will($this->returnValue(0)); + $this->productMock->expects($this->any())->method('getOptionsReadonly')->will($this->returnValue(false)); + $this->productMock->expects($this->once())->method('setCanSaveCustomOptions')->with(true); + $this ->productMock + ->expects($this->once()) + ->method('getProductOptions') + ->will($this->returnValue($productOptionsBefore)); + $this->productMock->expects($this->once())->method('setProductOptions')->with($productOptionsAfter); + $this->productMock->expects($this->once())->method('setCanSaveBundleSelections')->with(true); + $this->model->afterInitialize($this->productMock); + } + + public function testAfterInitializeIfBundleSelectionsAndCustomOptionsExist() + { + $postValue = 'postValue'; + $valueMap = array( + array('bundle_options', null, $postValue), + array('bundle_selections', null, false), + array('affect_bundle_product_selections', null, false), + ); + $this->requestMock->expects($this->any())->method('getPost')->will($this->returnValueMap($valueMap)); + $this->productMock->expects($this->any())->method('getCompositeReadonly')->will($this->returnValue(false)); + $this->productMock->expects($this->once())->method('setBundleOptionsData')->with($postValue); + $this->productMock->expects($this->never())->method('setBundleSelectionsData'); + $this->productMock->expects($this->once())->method('getPriceType')->will($this->returnValue(2)); + $this->productMock->expects($this->any())->method('getOptionsReadonly')->will($this->returnValue(true)); + $this->productMock->expects($this->once())->method('setCanSaveBundleSelections')->with(false); + $this->model->afterInitialize($this->productMock); + } + + public function testAfterInitializeIfCustomAndBundleOptionNotExist() + { + $postValue = 'postValue'; + $valueMap = array( + array('bundle_options', null, false), + array('bundle_selections', null, $postValue), + array('affect_bundle_product_selections', null, 1), + ); + $this->requestMock->expects($this->any())->method('getPost')->will($this->returnValueMap($valueMap)); + $this->productMock->expects($this->any())->method('getCompositeReadonly')->will($this->returnValue(false)); + $this->productMock->expects($this->never())->method('setBundleOptionsData'); + $this->productMock->expects($this->once())->method('setBundleSelectionsData')->with($postValue); + $this->productMock->expects($this->once())->method('getPriceType')->will($this->returnValue(0)); + $this->productMock->expects($this->any())->method('getOptionsReadonly')->will($this->returnValue(false)); + $this->productMock->expects($this->once())->method('setCanSaveCustomOptions')->with(true); + $this ->productMock + ->expects($this->once()) + ->method('getProductOptions') + ->will($this->returnValue(false)); + $this->productMock->expects($this->never())->method('setProductOptions'); + $this->productMock->expects($this->once())->method('setCanSaveBundleSelections')->with(true); + $this->model->afterInitialize($this->productMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CopyConstructor/BundleTest.php b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CopyConstructor/BundleTest.php new file mode 100644 index 00000000000..d74fc325982 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Bundle/Model/Product/CopyConstructor/BundleTest.php @@ -0,0 +1,160 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Bundle\Model\Product\CopyConstructor; + +class BundleTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var PHPUnit_Framework_MockObject_MockObject + */ + protected $product; + + /** + * @var PHPUnit_Framework_MockObject_MockObject + */ + protected $duplicate; + + /** + * @var \Magento\Bundle\Model\Product\CopyConstructor\Bundle + */ + protected $model; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + protected function setUp() + { + // Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Product $duplicate + $this->product = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $this->duplicate = $this->getMock( + 'Magento\Catalog\Model\Product', + array('setBundleOptionsData', 'setBundleSelectionsData', '__wakeup'), + array(), '', false); + $this->model = new \Magento\Bundle\Model\Product\CopyConstructor\Bundle(); + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + } + + public function testBuildNegative() + { + $this->product->expects($this->once())->method('getTypeId')->will($this->returnValue('other product')); + $this->product->expects($this->never())->method('getTypeInstance'); + $this->model->build($this->product, $this->duplicate); + } + + public function testBuildPositive() + { + //prepare mocks and data samples + $instance = $this->getMock('Magento\Bundle\Model\Product\Type', + array('setStoreFilter', 'getOptionsCollection', 'getSelectionsCollection', 'getOptionsIds'), + array(), + '', + false); + $option = $this->getMock( + 'Magento\Bundle\Model\Option', + array('getSelections', '__wakeup', 'getData'), + array(), + '', + false + ); + $options = array($option); + $optionCollection = $this->objectManager + ->getCollectionMock('Magento\Bundle\Model\Resource\Option\Collection', $options); + $optionRawData = array( + array( + 'required' => true, + 'position' => 100, + 'type' => 'someType', + 'title' => 'title', + 'delete' => '' + ) + ); + $selectionRawData = array( + array( + array( + 'product_id' => 123, + 'position' => 500, + 'is_default' => false, + 'selection_price_type' => 'priceType', + 'selection_price_value' => 'priceVal', + 'selection_qty' => 21, + 'selection_can_change_qty' => 11, + 'delete' => '' + ) + ) + ); + + $selection = $this->getMock( + 'Magento\Bundle\Model\Selection', + array( + 'getProductId', + 'getPosition', + 'getIsDefault', + 'getSelectionPriceType', + 'getSelectionPriceValue', + 'getSelectionQty', + 'getSelectionCanChangeQty', + '__wakeup' + ), + array(), + '', + false + ); + $selections = array($selection); + $selectionCollection = $this->getMock('Magento\Bundle\Model\Resource\Selection\Collection', + array(), array(), '', false); + + // method flow + $this->product->expects($this->once())->method('getTypeId')->will($this->returnValue('bundle')); + $this->product->expects($this->any())->method('getTypeInstance')->will($this->returnValue($instance)); + $instance->expects($this->once())->method('setStoreFilter')->with(null, $this->product); + $instance->expects($this->once())->method('getOptionsCollection')->with($this->product) + ->will($this->returnValue($optionCollection)); + $instance->expects($this->once())->method('getSelectionsCollection')->with(null, $this->product) + ->will($this->returnValue($selectionCollection)); + $optionCollection->expects($this->once())->method('appendSelections')->with($selectionCollection); + $option->expects($this->any())->method('getSelections')->will($this->returnValue($selections)); + + $option->expects($this->at(0))->method('getData')->with('required')->will($this->returnValue(true)); + $option->expects($this->at(1))->method('getData')->with('position')->will($this->returnValue(100)); + $option->expects($this->at(2))->method('getData')->with('type')->will($this->returnValue('someType')); + $option->expects($this->at(3))->method('getData')->with('title')->will($this->returnValue('title')); + $option->expects($this->at(4))->method('getData')->with('title')->will($this->returnValue('title')); + + $selection->expects($this->once())->method('getProductId')->will($this->returnValue(123)); + $selection->expects($this->once())->method('getPosition')->will($this->returnValue(500)); + $selection->expects($this->once())->method('getIsDefault')->will($this->returnValue(false)); + $selection->expects($this->once())->method('getSelectionPriceType')->will($this->returnValue('priceType')); + $selection->expects($this->once())->method('getSelectionPriceValue')->will($this->returnValue('priceVal')); + $selection->expects($this->once())->method('getSelectionQty')->will($this->returnValue(21)); + $selection->expects($this->once())->method('getSelectionCanChangeQty')->will($this->returnValue(11)); + + $this->duplicate->expects($this->once())->method('setBundleOptionsData')->with($optionRawData); + $this->duplicate->expects($this->once())->method('setBundleSelectionsData')->with($selectionRawData); + + $this->model->build($this->product, $this->duplicate); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php index dd4bbf5f4e0..7e7623a55e1 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Helper/Adminhtml/DataTest.php @@ -48,7 +48,7 @@ class DataTest extends \PHPUnit_Framework_TestCase ->with('admin/captcha/qwe') ->will($this->returnValue('1')); - $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); $filesystemMock->expects($this->any())->method('getDirectoryWrite')->will($this->returnValue($directoryMock)); diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php index a959ba76a48..4010ce04559 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Helper/DataTest.php @@ -36,7 +36,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); } protected function _getHelper($store, $config, $factory) @@ -105,7 +105,7 @@ class DataTest extends \PHPUnit_Framework_TestCase { $this->_filesystem->expects($this->once()) ->method('getPath') - ->with(\Magento\Filesystem::LIB) + ->with(\Magento\App\Filesystem::LIB_DIR) ->will($this->returnValue(TESTS_TEMP_DIR . '/lib')); $factoryMock = $this->getMock('Magento\Captcha\Model\CaptchaFactory', array(), array(), '', false); @@ -132,7 +132,7 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_filesystem->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::MEDIA) + ->with(\Magento\App\Filesystem::MEDIA_DIR) ->will($this->returnValue($dirWriteMock)); $dirWriteMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php b/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php index 3e2b408ba83..ef199f4aeec 100644 --- a/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php +++ b/dev/tests/unit/testsuite/Magento/Captcha/Model/CronTest.php @@ -76,7 +76,7 @@ class CronTest extends \PHPUnit_Framework_TestCase { $this->_helper = $this->getMock('Magento\Captcha\Helper\Data', array(), array(), '', false); $this->_adminHelper = $this->getMock('Magento\Captcha\Helper\Adminhtml\Data', array(), array(), '', false); - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_directory = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); $this->_storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/GridTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/GridTest.php index ebfd8bf6e4b..5096ee0f3fc 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Attribute/GridTest.php @@ -36,7 +36,7 @@ class GridTest extends \PHPUnit_Framework_TestCase ->method('getAttributeId') ->will($this->returnValue(2)); - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $urlBuilder = $this->getMock('Magento\UrlInterface', array(), array(), '', false); $urlBuilder->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/AlertsTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/AlertsTest.php new file mode 100644 index 00000000000..c36b3c84f13 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/AlertsTest.php @@ -0,0 +1,87 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; + +class AlertsTest extends \PHPUnit_Framework_TestCase +{ + + /** + * @var \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts + */ + protected $alerts; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeConfigMock; + + protected function setUp() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); + + $this->alerts = $helper->getObject('Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Alerts', array( + 'storeConfig' => $this->storeConfigMock + ) + ); + } + + /** + * @param bool $priceAllow + * @param bool $stockAllow + * @param bool $canShowTab + * + * @dataProvider canShowTabDataProvider + */ + public function testCanShowTab($priceAllow, $stockAllow, $canShowTab) + { + $valueMap = array( + array('catalog/productalert/allow_price', null, $priceAllow), + array('catalog/productalert/allow_stock', null, $stockAllow) + ); + $this->storeConfigMock->expects($this->any())->method('getConfig')->will($this->returnValueMap($valueMap)); + $this->assertEquals($canShowTab, $this->alerts->canShowTab()); + } + + public function canShowTabDataProvider() + { + return array( + 'alert_price_and_stock_allow' => array( + true, true, true + ), + 'alert_price_is_allowed_and_stock_is_unallowed' => array( + true, false, true + ), + 'alert_price_is_unallowed_and_stock_is_allowed' => array( + false, true, true + ), + 'alert_price_is_unallowed_and_stock_is_unallowed' => array( + false, false, false + ) + ); + } + +} + diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ViewTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ViewTest.php new file mode 100644 index 00000000000..1a043e6a041 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Block/Product/ViewTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Test class for \Magento\Catalog\Block\Product\View + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Block\Product; + +class ViewTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Block\Product\View + */ + protected $view; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productTypeConfig; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $registryMock; + + protected function setUp() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->productTypeConfig = $this->getMock('Magento\Catalog\Model\ProductTypes\ConfigInterface'); + $this->registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $this->view = $helper->getObject('Magento\Catalog\Block\Product\View', array( + 'productTypeConfig' => $this->productTypeConfig, + 'registry' => $this->registryMock + ) + ); + } + + public function testShouldRenderQuantity() + { + $productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $this->registryMock + ->expects($this->any()) + ->method('registry') + ->with('product') + ->will($this->returnValue($productMock)); + $productMock->expects($this->once())->method('getTypeId')->will($this->returnValue('id')); + $this->productTypeConfig + ->expects($this->once()) + ->method('isProductSet') + ->with('id') + ->will($this->returnValue(true)); + $this->assertEquals(false, $this->view->shouldRenderQuantity()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/Plugin/ConfigurableTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/Plugin/ConfigurableTest.php new file mode 100644 index 00000000000..28cbe9ec821 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper/Plugin/ConfigurableTest.php @@ -0,0 +1,146 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Plugin; + + +class ConfigurableTest extends \PHPUnit_Framework_TestCase +{ + + /** + * @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Configurable + */ + protected $plugin; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productTypeMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $requestMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + protected function setUp() + { + $this->productTypeMock = $this->getMock( + 'Magento\Catalog\Model\Product\Type\Configurable', array(), array(), '', false + ); + $this->requestMock = $this->getMock('\Magento\App\Request\Http', array(), array(), '', false); + $methods = array('setNewVariationsAttributeSetId', 'setAssociatedProductIds', + 'setCanSaveConfigurableAttributes', '__wakeup'); + $this->productMock = $this->getMock('Magento\Catalog\Model\Product', $methods, array(), '', false); + $this->plugin = new \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Configurable( + $this->productTypeMock, + $this->requestMock + ); + } + + public function testAfterInitializeIfAttributesNotEmptyAndActionNameNotGenerateVariations() + { + $associatedProductIds = array('key' => 'value'); + $generatedProductIds = array('key_one' => 'value_one'); + $expectedArray = array('key' => 'value', 'key_one' => 'value_one'); + $attributes = array('key' => 'value'); + $postValue = 'postValue'; + $valueMap = array( + array('new-variations-attribute-set-id', null, $postValue), + array('associated_product_ids', array(), $associatedProductIds), + array('variations-matrix', array(), $postValue), + array('affect_configurable_product_attributes', null, $postValue) + ); + $this->requestMock->expects($this->any())->method('getPost')->will($this->returnValueMap($valueMap)); + $this->requestMock + ->expects($this->once()) + ->method('getParam') + ->with('attributes') + ->will($this->returnValue($attributes)); + $this->productTypeMock + ->expects($this->once()) + ->method('setUsedProductAttributeIds') + ->with($attributes, $this->productMock); + $this->productMock->expects($this->once())->method('setNewVariationsAttributeSetId')->with($postValue); + $this->requestMock->expects($this->once())->method('getActionName')->will($this->returnValue('action_name')); + $this->productTypeMock + ->expects($this->once()) + ->method('generateSimpleProducts') + ->with($this->productMock, $postValue)->will($this->returnValue($generatedProductIds)); + $this->productMock->expects($this->once())->method('setAssociatedProductIds')->with($expectedArray); + $this->productMock->expects($this->once())->method('setCanSaveConfigurableAttributes')->with(true); + $this->plugin->afterInitialize($this->productMock); + } + + public function testAfterInitializeIfAttributesNotEmptyAndActionNameGenerateVariations() + { + $associatedProductIds = array('key' => 'value'); + $attributes = array('key' => 'value'); + $postValue = 'postValue'; + $valueMap = array( + array('new-variations-attribute-set-id', null, $postValue), + array('associated_product_ids', array(), $associatedProductIds), + array('variations-matrix', array(), $postValue), + array('affect_configurable_product_attributes', null, $postValue) + ); + $this->requestMock->expects($this->any())->method('getPost')->will($this->returnValueMap($valueMap)); + $this->requestMock + ->expects($this->once()) + ->method('getParam') + ->with('attributes') + ->will($this->returnValue($attributes)); + $this->productTypeMock + ->expects($this->once()) + ->method('setUsedProductAttributeIds') + ->with($attributes, $this->productMock); + $this->productMock->expects($this->once())->method('setNewVariationsAttributeSetId')->with($postValue); + $this->requestMock + ->expects($this->once()) + ->method('getActionName') + ->will($this->returnValue('generateVariations')); + $this->productTypeMock + ->expects($this->never()) + ->method('generateSimpleProducts'); + $this->productMock->expects($this->once())->method('setAssociatedProductIds')->with($associatedProductIds); + $this->productMock->expects($this->once())->method('setCanSaveConfigurableAttributes')->with(true); + $this->plugin->afterInitialize($this->productMock); + } + + public function testAfterInitializeIfAttributesEmpty() + { + $this->requestMock + ->expects($this->once()) + ->method('getParam') + ->with('attributes') + ->will($this->returnValue(array())); + $this->productTypeMock->expects($this->never())->method('setUsedProductAttributeIds'); + $this->requestMock->expects($this->never())->method('getPost'); + $this->productTypeMock->expects($this->never())->method('generateSimpleProducts'); + $this->plugin->afterInitialize($this->productMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/HelperTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/HelperTest.php new file mode 100644 index 00000000000..76d30e38a0d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/HelperTest.php @@ -0,0 +1,218 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization; + +class HelperTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $requestMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $jsHelperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $stockFilterMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productLinksMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $websiteMock; + + /** + * @var int + */ + protected $websiteId = 1; + + /** + * @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper + */ + protected $helper; + + protected function setUp() + { + $this->requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $this->jsHelperMock = $this->getMock('Magento\Backend\Helper\Js', array(), array(), '', false); + $this->storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $this->websiteMock = $this->getMock('Magento\Core\Model\Website', array(), array(), '', false); + $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + + $this->stockFilterMock = $this->getMock( + 'Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter', array(), array(), '', false + ); + $this->productLinksMock = $this->getMock( + 'Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper\ProductLinks', + array(), array(), '', false + ); + + $this->productMock = $this->getMock('Magento\Catalog\Model\Product', + array('setData', 'addData', 'getId', 'setWebsiteIds', 'isLockedAttribute', + 'lockAttribute', 'unlockAttribute', 'getOptionsReadOnly', + 'setProductOptions', 'setCanSaveCustomOptions', '__sleep', '__wakeup'), + array(), '', false); + + $this->websiteMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue($this->websiteId)); + + $this->storeMock->expects($this->once()) + ->method('getWebsite') + ->will($this->returnValue($this->websiteMock)); + + $this->storeManagerMock->expects($this->once()) + ->method('getStore') + ->with(true) + ->will($this->returnValue($this->storeMock)); + + $this->helper = new Helper( + $this->requestMock, + $this->jsHelperMock, + $this->storeManagerMock, + $this->stockFilterMock, + $this->productLinksMock + ); + } + + /** + * @covers Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper::initialize + */ + public function testInitialize() + { + $productData = array( + 'stock_data' => array('stock_data'), + 'url_key_create_redirect' => true, + 'options' => array('option1', 'option2') + ); + + $useDefaults = array('attributeCode1', 'attributeCode2'); + + $this->requestMock->expects($this->at(0)) + ->method('getPost') + ->with('product') + ->will($this->returnValue($productData)); + + $this->requestMock->expects($this->at(1)) + ->method('getPost') + ->with('use_default') + ->will($this->returnValue($useDefaults)); + + $this->requestMock->expects($this->at(2)) + ->method('getPost') + ->with('affect_product_custom_options') + ->will($this->returnValue(true)); + + $this->stockFilterMock->expects($this->once()) + ->method('filter') + ->with(array('stock_data')) + ->will($this->returnValue(array('stock_data'))); + + $this->storeManagerMock->expects($this->once()) + ->method('hasSingleStore') + ->will($this->returnValue(true)); + + $this->productLinksMock->expects($this->once()) + ->method('initializeLinks') + ->with($this->productMock) + ->will($this->returnValue($this->productMock)); + + $this->productMock->expects($this->once()) + ->method('isLockedAttribute') + ->with('media') + ->will($this->returnValue(true)); + + $this->productMock->expects($this->once()) + ->method('unlockAttribute') + ->with('media'); + + $this->productMock->expects($this->once()) + ->method('lockAttribute') + ->with('media'); + + $productData['category_ids'] = array(); + $productData['website_ids'] = array(); + $this->productMock->expects($this->once()) + ->method('addData') + ->with($productData); + + $this->productMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue(true)); + + $this->productMock->expects($this->once()) + ->method('setWebsiteIds') + ->with(array($this->websiteId)); + + $this->productMock->expects($this->at(6)) + ->method('setData') + ->with('save_rewrites_history', true); + + $this->productMock->expects($this->at(7)) + ->method('setData') + ->with('attributeCode1', false); + + $this->productMock->expects($this->at(8)) + ->method('setData') + ->with('attributeCode2', false); + + $this->productMock->expects($this->any()) + ->method('getOptionsReadOnly') + ->will($this->returnValue(false)); + + $this->productMock->expects($this->once()) + ->method('setProductOptions') + ->with($productData['options']); + + $this->productMock->expects($this->once()) + ->method('setCanSaveCustomOptions') + ->with(true); + + $this->assertEquals($this->productMock, $this->helper->initialize($this->productMock)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php new file mode 100644 index 00000000000..4e75748d9e4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Product/Initialization/StockDataFilterTest.php @@ -0,0 +1,133 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Controller\Adminhtml\Product\Initialization; + +class StockDataFilterTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter + */ + protected $stockDataFilter; + + protected function setUp() + { + $this->storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + + $this->storeMock->expects($this->any()) + ->method('getConfig') + ->with(\Magento\CatalogInventory\Model\Stock\Item::XML_PATH_MANAGE_STOCK) + ->will($this->returnValue(1)); + + $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManagerInterface'); + + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($this->storeMock)); + + $this->stockDataFilter = new StockDataFilter($this->storeManagerMock); + } + + /** + * @param array $inputStockData + * @param array $outputStockData + * + * @covers Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter::filter + * @dataProvider filterDataProvider + */ + public function testFilter(array $inputStockData, array $outputStockData) + { + $this->assertEquals($outputStockData, $this->stockDataFilter->filter($inputStockData)); + } + + /** + * Data provider for testFilter + * + * @return array + */ + public function filterDataProvider() + { + return array( + 'case1' => array( + 'inputStockData' => array(), + 'outputStockData' => array( + 'use_config_manage_stock' => 0, + 'is_decimal_divided' => 0 + ), + ), + 'case2' => array( + 'inputStockData' => array( + 'use_config_manage_stock' => 1, + ), + 'outputStockData' => array( + 'use_config_manage_stock' => 1, + 'manage_stock' => 1, + 'is_decimal_divided' => 0 + ), + ), + 'case3' => array( + 'inputStockData' => array( + 'qty' => + \Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter::MAX_QTY_VALUE + 1, + ), + 'outputStockData' => array( + 'qty' => + \Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter::MAX_QTY_VALUE, + 'is_decimal_divided' => 0, + 'use_config_manage_stock' => 0, + ), + ), + 'case4' => array( + 'inputStockData' => array( + 'min_qty' => -1, + ), + 'outputStockData' => array( + 'min_qty' => 0, + 'is_decimal_divided' => 0, + 'use_config_manage_stock' => 0 + ), + ), + 'case5' => array( + 'inputStockData' => array( + 'is_qty_decimal' => 0, + ), + 'outputStockData' => array( + 'is_qty_decimal' => 0, + 'is_decimal_divided' => 0, + 'use_config_manage_stock' => 0 + ), + ), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php index 47850b3602b..497ec526462 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/MediaTest.php @@ -61,7 +61,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase $directory = $this->getMockBuilder('Magento\Filesystem\Directory\Write') ->disableOriginalConstructor() ->getMock(); - $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); + $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock(); $filesystem->expects($this->once())->method('getDirectoryWrite')->will($this->returnValue($directory)); $this->_model = $this->_objectHelper->getObject('Magento\Catalog\Model\Product\Attribute\Backend\Media', array( 'eventManager' => $eventManager, diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopierTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopierTest.php new file mode 100644 index 00000000000..e5832b11fb6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopierTest.php @@ -0,0 +1,106 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Product; + +class CopierTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Copier + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $copyConstructorMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + + protected function setUp() + { + $this->copyConstructorMock = $this->getMock('\Magento\Catalog\Model\Product\CopyConstructorInterface'); + $this->productFactoryMock = $this->getMock( + '\Magento\Catalog\Model\ProductFactory', array('create'), array(), '', false + ); + $this->productMock = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); + $this->productMock->expects($this->any())->method('getId')->will($this->returnValue('1')); + $this->productMock->expects($this->any())->method('getData')->will($this->returnValue('product data')); + + $this->_model = new Copier($this->copyConstructorMock, $this->productFactoryMock); + } + + public function testCopy() + { + $this->productMock->expects($this->atLeastOnce())->method('getWebsiteIds'); + $this->productMock->expects($this->atLeastOnce())->method('getCategoryIds'); + + $resourceMock = $this->getMock('\Magento\Catalog\Model\Resource\Product', array(), array(), '', false); + $optionMock = $this->getMock('\Magento\Catalog\Model\Product\Option', array(), array(), '', false); + $this->productMock->expects($this->once()) + ->method('getResource')->will($this->returnValue($resourceMock)); + $this->productMock->expects($this->once()) + ->method('getOptionInstance')->will($this->returnValue($optionMock)); + + $duplicateMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array('__wakeup', 'setData', 'setIsDuplicate', 'setOriginalId', 'setStatus', 'setCreatedAt', 'setUpdatedAt', + 'setId', 'setStoreId', 'getId', 'save' + ), + array(), + '', + false + ); + $this->productFactoryMock->expects($this->once())->method('create')->will($this->returnValue($duplicateMock)); + + $duplicateMock->expects($this->once())->method('setIsDuplicate')->with(true); + $duplicateMock->expects($this->once())->method('setOriginalId')->with(1); + $duplicateMock->expects($this->once())->method('setStatus') + ->with(\Magento\Catalog\Model\Product\Status::STATUS_DISABLED); + $duplicateMock->expects($this->once())->method('setCreatedAt')->with(null); + $duplicateMock->expects($this->once())->method('setUpdatedAt')->with(null); + $duplicateMock->expects($this->once())->method('setId')->with(null); + $duplicateMock->expects($this->once())->method('setStoreId')->with(\Magento\Core\Model\Store::DEFAULT_STORE_ID); + $duplicateMock->expects($this->once())->method('setData')->with('product data'); + + + + $this->copyConstructorMock->expects($this->once())->method('build')->with($this->productMock, $duplicateMock); + + $duplicateMock->expects($this->once())->method('save'); + $duplicateMock->expects($this->any())->method('getId')->will($this->returnValue(2)); + + $optionMock->expects($this->once())->method('duplicate')->with(1, 2); + $resourceMock->expects($this->once())->method('duplicate')->with(1, 2); + $this->assertEquals($duplicateMock, $this->_model->copy($this->productMock)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/CompositeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/CompositeTest.php new file mode 100644 index 00000000000..b61317e5970 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/CompositeTest.php @@ -0,0 +1,52 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Product\CopyConstructor; + +class CompositeTest extends \PHPUnit_Framework_TestCase +{ + public function testBuild() + { + $factoryMock = $this->getMock( + '\Magento\Catalog\Model\Product\CopyConstructorFactory', array(), array(), '', false + ); + + $constructorMock = $this->getMock('\Magento\Catalog\Model\Product\CopyConstructorInterface'); + + $factoryMock->expects($this->exactly(2)) + ->method('create') + ->with('constructorInstance') + ->will($this->returnValue($constructorMock)); + + $productMock = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); + $duplicateMock = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); + + $constructorMock->expects($this->exactly(2))->method('build')->with($productMock, $duplicateMock); + + $model = new \Magento\Catalog\Model\Product\CopyConstructor\Composite( + $factoryMock, array('constructorInstance', 'constructorInstance') + ); + + $model->build($productMock, $duplicateMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/CrossSellTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/CrossSellTest.php new file mode 100644 index 00000000000..fa146ddaec2 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/CrossSellTest.php @@ -0,0 +1,130 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Product\CopyConstructor; + +class CrossSellTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Product\CopyConstructor\CrossSell + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_duplicateMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkCollectionMock; + + protected function setUp() + { + $this->_model = new \Magento\Catalog\Model\Product\CopyConstructor\CrossSell(); + + $this->_productMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array(), + array(), + '', + false + ); + + $this->_duplicateMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array('setCrossSellLinkData', '__wakeup'), + array(), + '', + false + ); + + $this->_linkMock = $this->getMock( + '\Magento\Catalog\Model\Product\Link', + array('__wakeup', 'getAttributes', 'getCrossSellLinkCollection', 'useCrossSellLinks'), + array(), + '', + false + ); + + $this->_productMock->expects($this->any()) + ->method('getLinkInstance') + ->will($this->returnValue($this->_linkMock)); + } + + public function testBuild() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $expectedData = array( + '100500' => array('some' => 'data') + ); + + $attributes = array( + 'attributeOne' => array('code' => 'one'), + 'attributeTwo' => array('code' => 'two'), + ); + + $this->_linkMock->expects($this->once())->method('useCrossSellLinks'); + + $this->_linkMock->expects($this->once())->method('getAttributes')->will($this->returnValue($attributes)); + + $productLinkMock = $this->getMock( + '\Magento\Catalog\Model\Resource\Product\Link', + array('__wakeup', 'getLinkedProductId', 'toArray'), + array(), + '', + false + ); + + $productLinkMock->expects($this->once())->method('getLinkedProductId')->will($this->returnValue('100500')); + $productLinkMock->expects($this->once()) + ->method('toArray') + ->with(array('one', 'two')) + ->will($this->returnValue(array('some' => 'data'))); + + $collectionMock = $helper->getCollectionMock( + '\Magento\Catalog\Model\Resource\Product\Link\Collection', + array($productLinkMock) + ); + $this->_productMock->expects($this->once()) + ->method('getCrossSellLinkCollection') + ->will($this->returnValue($collectionMock)); + + $this->_duplicateMock->expects($this->once()) + ->method('setCrossSellLinkData') + ->with($expectedData); + + $this->_model->build($this->_productMock, $this->_duplicateMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/RelatedTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/RelatedTest.php new file mode 100644 index 00000000000..54489439a77 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/RelatedTest.php @@ -0,0 +1,130 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Product\CopyConstructor; + +class RelatedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \\Magento\Catalog\Model\Product\CopyConstructor\Related + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_duplicateMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkCollectionMock; + + protected function setUp() + { + $this->_model = new \Magento\Catalog\Model\Product\CopyConstructor\Related(); + + $this->_productMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array(), + array(), + '', + false + ); + + $this->_duplicateMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array('setRelatedLinkData', '__wakeup'), + array(), + '', + false + ); + + $this->_linkMock = $this->getMock( + '\Magento\Catalog\Model\Product\Link', + array('__wakeup', 'getAttributes', 'getRelatedLinkCollection', 'useRelatedLinks'), + array(), + '', + false + ); + + $this->_productMock->expects($this->any()) + ->method('getLinkInstance') + ->will($this->returnValue($this->_linkMock)); + } + + public function testBuild() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $expectedData = array( + '100500' => array('some' => 'data') + ); + + $attributes = array( + 'attributeOne' => array('code' => 'one'), + 'attributeTwo' => array('code' => 'two'), + ); + + $this->_linkMock->expects($this->once())->method('useRelatedLinks'); + + $this->_linkMock->expects($this->once())->method('getAttributes')->will($this->returnValue($attributes)); + + $productLinkMock = $this->getMock( + '\Magento\Catalog\Model\Resource\Product\Link', + array('__wakeup', 'getLinkedProductId', 'toArray'), + array(), + '', + false + ); + + $productLinkMock->expects($this->once())->method('getLinkedProductId')->will($this->returnValue('100500')); + $productLinkMock->expects($this->once()) + ->method('toArray') + ->with(array('one', 'two')) + ->will($this->returnValue(array('some' => 'data'))); + + $collectionMock = $helper->getCollectionMock( + '\Magento\Catalog\Model\Resource\Product\Link\Collection', + array($productLinkMock) + ); + $this->_productMock->expects($this->once()) + ->method('getRelatedLinkCollection') + ->will($this->returnValue($collectionMock)); + + $this->_duplicateMock->expects($this->once()) + ->method('setRelatedLinkData') + ->with($expectedData); + + $this->_model->build($this->_productMock, $this->_duplicateMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/UpSellTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/UpSellTest.php new file mode 100644 index 00000000000..6bfdc1dad7e --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructor/UpSellTest.php @@ -0,0 +1,130 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Product\CopyConstructor; + +class UpSellTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Product\CopyConstructor\UpSell + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_duplicateMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkCollectionMock; + + protected function setUp() + { + $this->_model = new \Magento\Catalog\Model\Product\CopyConstructor\UpSell(); + + $this->_productMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array(), + array(), + '', + false + ); + + $this->_duplicateMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array('setUpSellLinkData', '__wakeup'), + array(), + '', + false + ); + + $this->_linkMock = $this->getMock( + '\Magento\Catalog\Model\Product\Link', + array('__wakeup', 'getAttributes', 'getUpSellLinkCollection', 'useUpSellLinks'), + array(), + '', + false + ); + + $this->_productMock->expects($this->any()) + ->method('getLinkInstance') + ->will($this->returnValue($this->_linkMock)); + } + + public function testBuild() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $expectedData = array( + '100500' => array('some' => 'data') + ); + + $attributes = array( + 'attributeOne' => array('code' => 'one'), + 'attributeTwo' => array('code' => 'two'), + ); + + $this->_linkMock->expects($this->once())->method('useUpSellLinks'); + + $this->_linkMock->expects($this->once())->method('getAttributes')->will($this->returnValue($attributes)); + + $productLinkMock = $this->getMock( + '\Magento\Catalog\Model\Resource\Product\Link', + array('__wakeup', 'getLinkedProductId', 'toArray'), + array(), + '', + false + ); + + $productLinkMock->expects($this->once())->method('getLinkedProductId')->will($this->returnValue('100500')); + $productLinkMock->expects($this->once()) + ->method('toArray') + ->with(array('one', 'two')) + ->will($this->returnValue(array('some' => 'data'))); + + $collectionMock = $helper->getCollectionMock( + '\Magento\Catalog\Model\Resource\Product\Link\Collection', + array($productLinkMock) + ); + $this->_productMock->expects($this->once()) + ->method('getUpSellLinkCollection') + ->will($this->returnValue($collectionMock)); + + $this->_duplicateMock->expects($this->once()) + ->method('setUpSellLinkData') + ->with($expectedData); + + $this->_model->build($this->_productMock, $this->_duplicateMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructorFactoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructorFactoryTest.php new file mode 100644 index 00000000000..5f07852ba20 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/CopyConstructorFactoryTest.php @@ -0,0 +1,64 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Product; + +class CopyConstructorFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var CopyConstructorFactory + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_objectManagerMock; + + protected function setUp() + { + $this->_objectManagerMock = $this->getMock('\Magento\ObjectManager'); + $this->_model = new CopyConstructorFactory($this->_objectManagerMock); + } + + public function testCreateWithInvalidType() + { + $this->setExpectedException( + '\InvalidArgumentException', + '\Magento\Object does not implement \Magento\Catalog\Model\Product\CopyConstructorInterface' + ); + $this->_objectManagerMock->expects($this->never())->method('create'); + $this->_model->create('\Magento\Object'); + } + + public function testCreateWithValidType() + { + $this->_objectManagerMock->expects($this->once()) + ->method('create')->with('\Magento\Catalog\Model\Product\CopyConstructor\Composite') + ->will($this->returnValue('object')); + $this->assertEquals( + 'object', + $this->_model->create('\Magento\Catalog\Model\Product\CopyConstructor\Composite') + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/ConfigurableTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/ConfigurableTest.php index cfed1bb3dc9..ebcd919f9f7 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/ConfigurableTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/ConfigurableTest.php @@ -50,7 +50,7 @@ class ConfigurableTest extends \PHPUnit_Framework_TestCase $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); - $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); + $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock(); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/GroupedTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/GroupedTest.php deleted file mode 100644 index 93923ad0623..00000000000 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/GroupedTest.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Catalog - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Catalog\Model\Product\Type; - -class GroupedTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Catalog\Model\Product\Type\Grouped - */ - protected $_model; - - protected function setUp() - { - $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - $coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); - $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); - $this->_model = $objectHelper->getObject('Magento\Catalog\Model\Product\Type\Grouped', array( - 'eventManager' => $eventManager, - 'coreData' => $coreDataMock, - 'fileStorageDb' => $fileStorageDbMock, - 'filesystem' => $filesystem, - 'coreRegistry' => $coreRegistry, - 'logger' => $logger, - 'productFactory' => $productFactoryMock, - )); - } - - public function testHasWeightFalse() - { - $this->assertFalse($this->_model->hasWeight(), 'This product has weight, but it should not'); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php index ede43a03000..ea510e84e8c 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/SimpleTest.php @@ -40,7 +40,7 @@ class SimpleTest extends \PHPUnit_Framework_TestCase $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); - $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); + $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock(); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php index d216cdb8dc5..f56b1cbda15 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Type/VirtualTest.php @@ -41,7 +41,7 @@ class VirtualTest extends \PHPUnit_Framework_TestCase $coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); $coreRegistryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); - $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); + $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock(); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); $this->_model = $objectHelper->getObject('Magento\Catalog\Model\Product\Type\Virtual', array( diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/ConfigTest.php index 63b84e1615c..8dde9c01b1a 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTypes/ConfigTest.php @@ -28,23 +28,23 @@ class ConfigTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_readerMock; + protected $readerMock; /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_cacheMock; + protected $cacheMock; /** * @var \Magento\Catalog\Model\ProductTypes\Config */ - protected $_model; + protected $model; protected function setUp() { - $this->_readerMock = $this->getMock( + $this->readerMock = $this->getMock( 'Magento\Catalog\Model\ProductTypes\Config\Reader', array(), array(), '', false); - $this->_cacheMock = $this->getMock('Magento\Config\CacheInterface'); + $this->cacheMock = $this->getMock('Magento\Config\CacheInterface'); } /** @@ -55,10 +55,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ public function testGetType($value, $expected) { - $this->_cacheMock->expects($this->any())->method('load')->will($this->returnValue(serialize($value))); - $this->_model = new \Magento\Catalog\Model\ProductTypes\Config($this->_readerMock, - $this->_cacheMock, 'cache_id'); - $this->assertEquals($expected, $this->_model->getType('global')); + $this->cacheMock->expects($this->any())->method('load')->will($this->returnValue(serialize($value))); + $this->model = new \Magento\Catalog\Model\ProductTypes\Config($this->readerMock, + $this->cacheMock, 'cache_id'); + $this->assertEquals($expected, $this->model->getType('global')); } public function getTypeDataProvider() @@ -72,12 +72,26 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testGetAll() { $expected = array('Expected Data'); - $this->_cacheMock->expects($this->once())->method('load')->will($this->returnValue(serialize($expected))); - $this->_model = new \Magento\Catalog\Model\ProductTypes\Config( - $this->_readerMock, - $this->_cacheMock, + $this->cacheMock->expects($this->once())->method('load')->will($this->returnValue(serialize($expected))); + $this->model = new \Magento\Catalog\Model\ProductTypes\Config( + $this->readerMock, + $this->cacheMock, 'cache_id' ); - $this->assertEquals($expected, $this->_model->getAll()); + $this->assertEquals($expected, $this->model->getAll()); } + + public function testIsProductSet() + { + $this->cacheMock->expects($this->once())->method('load')->will($this->returnValue(serialize(array()))); + $this->model = new \Magento\Catalog\Model\ProductTypes\Config( + $this->readerMock, + $this->cacheMock, + 'cache_id' + ); + + $this->assertEquals(false, $this->model->isProductSet('typeId')); + + } + } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/LinkTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/LinkTest.php new file mode 100644 index 00000000000..eb009daa6ae --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/LinkTest.php @@ -0,0 +1,162 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Resource\Product; + +class LinkTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Resource\Product\Link + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $resource; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $readAdapter; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $writeAdapter; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $dbSelect; + + protected function setUp() + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->resource = $this->getMock('Magento\App\Resource', array(), array(), '', false); + $this->readAdapter = $this->getMock('\Magento\DB\Adapter\AdapterInterface', array(), array(), '', false); + $this->writeAdapter = $this->getMock('\Magento\DB\Adapter\AdapterInterface', array(), array(), '', false); + $this->model = $objectManager->getObject( + 'Magento\Catalog\Model\Resource\Product\Link', + array('resource' => $this->resource) + ); + } + + protected function prepareReadAdapter() + { + $this->dbSelect = $this->getMock('Magento\DB\Select', array(), array(), '', false); + + // method flow + $this->resource->expects($this->at(0))->method('getConnection') + ->with('core_write')->will($this->returnValue($this->writeAdapter)); + $this->resource->expects($this->at(1))->method('getConnection') + ->with('core_read')->will($this->returnValue($this->readAdapter)); + + $this->readAdapter->expects($this->once())->method('select')->will($this->returnValue($this->dbSelect)); + } + + public function testGetAttributesByType() + { + $typeId = 4; + $result = array(100, 200, 300, 400); + + $this->prepareReadAdapter(); + $this->dbSelect->expects($this->once())->method('from')->will($this->returnValue($this->dbSelect)); + $this->dbSelect->expects($this->atLeastOnce())->method('where') + ->with('link_type_id = ?', $typeId) + ->will($this->returnValue($this->dbSelect)); + $this->readAdapter->expects($this->once()) + ->method('fetchAll') + ->will($this->returnValue($result)); + $this->assertEquals($result, $this->model->getAttributesByType($typeId)); + } + + public function testGetAttributeTypeTable() + { + $inputTable = 'megatable'; + $resultTable = 'advancedTable'; + + $this->resource->expects($this->once())->method('getTableName') + ->with('catalog_product_link_attribute_' . $inputTable)->will($this->returnValue($resultTable)); + $this->assertEquals($resultTable, $this->model->getAttributeTypeTable($inputTable)); + } + + public function testGetChildrenIds() + { + //prepare mocks and data + $parentId = 100; + $typeId = 4; + $bind = array( + ':product_id' => $parentId, + ':link_type_id' => $typeId + ); + + $fetchedData = array( + array('linked_product_id' => 100), + array('linked_product_id' => 500), + ); + + $result = array( + $typeId => array( + 100 => 100, + 500 => 500, + ) + ); + + // method flow + $this->prepareReadAdapter(); + $this->dbSelect->expects($this->once())->method('from')->will($this->returnValue($this->dbSelect)); + $this->dbSelect->expects($this->atLeastOnce())->method('where')->will($this->returnValue($this->dbSelect)); + $this->readAdapter->expects($this->once()) + ->method('fetchAll') + ->with($this->dbSelect, $bind) + ->will($this->returnValue($fetchedData)); + + $this->assertEquals($result, $this->model->getChildrenIds($parentId, $typeId)); + } + + public function testGetParentIdsByChild() + { + $childId = 234; + $typeId = 4; + $fetchedData = array( + array('product_id' => 55), + array('product_id' => 66), + ); + $result = array(55, 66); + + // method flow + $this->prepareReadAdapter(); + $this->dbSelect->expects($this->once())->method('from')->will($this->returnValue($this->dbSelect)); + $this->dbSelect->expects($this->any())->method('where') + ->will($this->returnValue($this->dbSelect)); + + $this->readAdapter->expects($this->once()) + ->method('fetchAll') + ->with($this->dbSelect) + ->will($this->returnValue($fetchedData)); + + $this->assertEquals($result, $this->model->getParentIdsByChild($childId, $typeId)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Product/CopyConstructor/CatalogInventoryTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Product/CopyConstructor/CatalogInventoryTest.php new file mode 100644 index 00000000000..44bb6890cba --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Product/CopyConstructor/CatalogInventoryTest.php @@ -0,0 +1,108 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\CatalogInventory\Model\Product\CopyConstructor; + +class CatalogInventoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\CatalogInventory\Model\Product\CopyConstructor\CatalogInventory + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_duplicateMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_stockItemMock; + + protected function setUp() + { + $this->_model = new \Magento\CatalogInventory\Model\Product\CopyConstructor\CatalogInventory(); + + $this->_productMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array('__wakeup', 'getStockItem'), array(), '', false + ); + + $this->_duplicateMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array('setStockData', 'unsStockItem', '__wakeup'), array(), '', false + ); + + $this->_stockItemMock = $this->getMock( + 'Magento\CatalogInventory\Model\Stock\Item', array(), array(), '', false + ); + } + + public function testBuildWithoutCurrentProductStockItem() + { + $expectedData = array( + 'use_config_min_qty' => 1, + 'use_config_min_sale_qty' => 1, + 'use_config_max_sale_qty' => 1, + 'use_config_backorders' => 1, + 'use_config_notify_stock_qty' => 1 + ); + $this->_duplicateMock->expects($this->once())->method('unsStockItem'); + $this->_productMock->expects($this->once())->method('getStockItem')->will($this->returnValue(null)); + + $this->_duplicateMock->expects($this->once())->method('setStockData')->with($expectedData); + + $this->_model->build($this->_productMock, $this->_duplicateMock); + } + + public function testBuildWithCurrentProductStockItem() + { + $expectedData = array( + 'use_config_min_qty' => 1, + 'use_config_min_sale_qty' => 1, + 'use_config_max_sale_qty' => 1, + 'use_config_backorders' => 1, + 'use_config_notify_stock_qty' => 1, + 'use_config_enable_qty_inc' => 'use_config_enable_qty_inc', + 'enable_qty_increments' => 'enable_qty_increments', + 'use_config_qty_increments' => 'use_config_qty_increments', + 'qty_increments' => 'qty_increments', + ); + $this->_duplicateMock->expects($this->once())->method('unsStockItem'); + $this->_productMock->expects($this->once()) + ->method('getStockItem')->will($this->returnValue($this->_stockItemMock)); + + $this->_stockItemMock->expects($this->any())->method('getData')->will($this->returnArgument(0)); + + $this->_duplicateMock->expects($this->once())->method('setStockData')->with($expectedData); + + $this->_model->build($this->_productMock, $this->_duplicateMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php index 00591459664..1c2b769315d 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/SessionTest.php @@ -46,7 +46,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase ->method('create') ->will($this->returnValue($orderMock)); - $messageCollFactory = $this->getMockBuilder('Magento\Message\CollectionFactory') + $messageCollectionFactory = $this->getMockBuilder('Magento\Message\CollectionFactory') ->disableOriginalConstructor() ->getMock(); $quoteFactory = $this->getMockBuilder('Magento\Sales\Model\QuoteFactory') @@ -65,7 +65,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase array( 'request' => $this->getMock('Magento\App\RequestInterface', array(), array(), '', false), 'orderFactory' => $orderFactory, - 'messageCollFactory' => $messageCollFactory, + 'messageCollectionFactory' => $messageCollectionFactory, 'quoteFactory' => $quoteFactory, 'storage' => new \Magento\Session\Storage ) diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php index a86a17152b1..ea791957dee 100644 --- a/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php @@ -29,6 +29,12 @@ namespace Magento\Cms\Model\Wysiwyg\Images; */ class StorageTest extends \PHPUnit_Framework_TestCase { + /** + * Directory paths samples + */ + const STORAGE_ROOT_DIR = '/storage/root/dir'; + const INVALID_DIRECTORY_OVER_ROOT = '/storage/some/another/dir'; + /** * @var \Magento\Cms\Model\Wysiwyg\Images\Storage */ @@ -94,14 +100,49 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ protected $_backendUrlMock; + /** + * @var \Magento\Filesystem\Directory\Write|PHPUnit_Framework_MockObject_MockObject + */ + protected $_directoryMock; + + /** + * @var \Magento\Filesystem\DriverInterface|PHPUnit_Framework_MockObject_MockObject + */ + protected $_driverMock; + protected function setUp() { - $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); + $this->_driverMock = $this->getMockForAbstractClass( + 'Magento\Filesystem\DriverInterface', array(), '', false, false, true, array('getRealPath') + ); + $this->_driverMock->expects($this->any())->method('getRealPath') + ->will($this->returnArgument(0)); + + $this->_directoryMock = $this->getMock( + 'Magento\Filesystem\Directory\Write', array('delete', 'getDriver'), array(), '', false + ); + $this->_directoryMock->expects($this->any())->method('getDriver') + ->will($this->returnValue($this->_driverMock)); + + $this->_filesystemMock = $this->getMock( + 'Magento\App\Filesystem', array('getDirectoryWrite'), array(), '', false + ); + $this->_filesystemMock->expects($this->any()) + ->method('getDirectoryWrite') + ->with(\Magento\App\Filesystem::MEDIA_DIR) + ->will($this->returnValue($this->_directoryMock)); + $this->_adapterFactoryMock = $this->getMock( 'Magento\Image\AdapterFactory', array(), array(), '', false ); $this->_viewUrlMock = $this->getMock('Magento\View\Url', array(), array(), '', false); - $this->_imageHelperMock = $this->getMock('Magento\Cms\Helper\Wysiwyg\Images', array(), array(), '', false); + $this->_imageHelperMock = $this->getMock( + 'Magento\Cms\Helper\Wysiwyg\Images', array('getStorageRoot'), array(), '', false + ); + $this->_imageHelperMock->expects($this->any())->method('getStorageRoot') + ->will($this->returnValue(self::STORAGE_ROOT_DIR)); + $this->_resizeParameters = array('width' => 100, 'height' => 50); $this->_storageCollectionFactoryMock = $this->getMock( @@ -148,4 +189,28 @@ class StorageTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(50, $this->_model->getResizeHeight()); } + + /** + * @covers \Magento\Cms\Model\Wysiwyg\Images\Storage::deleteDirectory + */ + public function testDeleteDirectoryOverRoot() + { + $this->setExpectedException( + '\Magento\Core\Exception', + sprintf('Directory %s is not under storage root path.', self::INVALID_DIRECTORY_OVER_ROOT) + ); + $this->_model->deleteDirectory(self::INVALID_DIRECTORY_OVER_ROOT); + } + + /** + * @covers \Magento\Cms\Model\Wysiwyg\Images\Storage::deleteDirectory + */ + public function testDeleteRootDirectory() + { + $this->setExpectedException( + '\Magento\Core\Exception', + sprintf('We cannot delete root directory %s.', self::STORAGE_ROOT_DIR) + ); + $this->_model->deleteDirectory(self::STORAGE_ROOT_DIR); + } } diff --git a/dev/tests/unit/testsuite/Magento/Code/GeneratorTest.php b/dev/tests/unit/testsuite/Magento/Code/GeneratorTest.php index aca7b35e73f..93d06afe568 100644 --- a/dev/tests/unit/testsuite/Magento/Code/GeneratorTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/GeneratorTest.php @@ -68,7 +68,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase protected $_ioObjectMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Filesystem + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Filesystem */ protected $_filesystemMock; @@ -84,7 +84,7 @@ class GeneratorTest extends \PHPUnit_Framework_TestCase $this->_ioObjectMock = $this->getMockBuilder('\Magento\Code\Generator\Io') ->disableOriginalConstructor() ->getMock(); - $this->_filesystemMock = $this->getMockBuilder('\Magento\Filesystem') + $this->_filesystemMock = $this->getMockBuilder('\Magento\App\Filesystem') ->disableOriginalConstructor() ->getMock(); } diff --git a/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/GenerateTest.php b/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/GenerateTest.php index e87b01b3045..c8d7b0b3e4c 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/GenerateTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/GenerateTest.php @@ -24,7 +24,7 @@ namespace Magento\Code\Minifier\Strategy; -use Magento\Filesystem, +use Magento\App\Filesystem, Magento\Filesystem\Directory\Write, Magento\Filesystem\Directory\Read; @@ -64,17 +64,17 @@ class GenerateTest extends \PHPUnit_Framework_TestCase array(), array(), '', false ); $this->filesystem = $this->getMock( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('getDirectoryWrite', 'getDirectoryRead', '__wakeup'), array(), '', false ); $this->filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::ROOT) + ->with(\Magento\App\Filesystem::ROOT_DIR) ->will($this->returnValue($this->rootDirectory)); $this->filesystem->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::PUB_VIEW_CACHE) + ->with(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR) ->will($this->returnValue($this->pubViewCacheDir)); $this->adapter = $this->getMockForAbstractClass('Magento\Code\Minifier\AdapterInterface', array(), '', false); } diff --git a/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/LiteTest.php b/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/LiteTest.php index e4fd0b4f991..736b4b7489b 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/LiteTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Minifier/Strategy/LiteTest.php @@ -24,7 +24,7 @@ namespace Magento\Code\Minifier\Strategy; -use Magento\Filesystem, +use Magento\App\Filesystem, Magento\Filesystem\Directory\Read, Magento\Filesystem\Directory\Write; @@ -64,17 +64,17 @@ class LiteTest extends \PHPUnit_Framework_TestCase array(), array(), '', false ); $this->filesystem = $this->getMock( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('getDirectoryWrite', 'getDirectoryRead', '__wakeup'), array(), '', false ); $this->filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::ROOT) + ->with(\Magento\App\Filesystem::ROOT_DIR) ->will($this->returnValue($this->rootDirectory)); $this->filesystem->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::PUB_VIEW_CACHE) + ->with(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR) ->will($this->returnValue($this->pubViewCacheDir)); $this->adapter = $this->getMockForAbstractClass('Magento\Code\Minifier\AdapterInterface', array(), '', false); } diff --git a/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php b/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php index f5281bde15f..9dff1a7bf54 100644 --- a/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/MinifierTest.php @@ -32,7 +32,7 @@ class MinifierTest extends \PHPUnit_Framework_TestCase protected $strategy; /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $filesystem; @@ -63,7 +63,7 @@ class MinifierTest extends \PHPUnit_Framework_TestCase { $this->strategy = $this->getMockForAbstractClass('Magento\Code\Minifier\StrategyInterface'); $this->filesystem = $this->getMock( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', @@ -82,11 +82,11 @@ class MinifierTest extends \PHPUnit_Framework_TestCase ); $this->filesystem->expects($this->at(0)) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::ROOT) + ->with(\Magento\App\Filesystem::ROOT_DIR) ->will($this->returnValue($this->rootDirectory)); $this->filesystem->expects($this->at(1)) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::PUB_VIEW_CACHE) + ->with(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR) ->will($this->returnValue($this->pubViewCacheDir)); $this->minifier = new Minifier($this->strategy, $this->filesystem, $this->minifyDir); } diff --git a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php b/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php index cc54d51a7c2..4819d66bebe 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/App/FrontController/Plugin/DispatchExceptionHandlerTest.php @@ -43,7 +43,7 @@ class DispatchExceptionHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_storeManagerMock = $this->getMock('\Magento\Core\Model\StoreManager', array(), array(), '', false); - $this->_filesystemMock = $this->getMock('\Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('\Magento\App\Filesystem', array(), array(), '', false); $this->_model = new DispatchExceptionHandler( $this->_storeManagerMock, $this->_filesystemMock diff --git a/dev/tests/unit/testsuite/Magento/Core/App/MediaTest.php b/dev/tests/unit/testsuite/Magento/Core/App/MediaTest.php index 232c3257d7c..64e24261e47 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/MediaTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/App/MediaTest.php @@ -76,7 +76,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase protected $_responseMock; /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $filesystemMock; @@ -96,21 +96,21 @@ class MediaTest extends \PHPUnit_Framework_TestCase $this->_configMock = $this->getMock('Magento\Core\Model\File\Storage\Config', array(), array(), '', false); $this->_sync= $this->getMock('Magento\Core\Model\File\Storage\Synchronization', array(), array(), '', false); $this->_dirVerificationMock = $this->getMock( - 'Magento\Filesystem\DirectoryList\Verification', array(), array(), '', false + 'Magento\App\Filesystem\DirectoryList\Verification', array(), array(), '', false ); - $this->filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->directoryReadMock = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); $this->filesystemMock->expects($this->any()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::MEDIA) + ->with(\Magento\App\Filesystem::MEDIA_DIR) ->will($this->returnValue($this->directoryReadMock)); $this->_responseMock = $this->getMock('Magento\Core\Model\File\Storage\Response', array(), array(), '', false); $map = array( - array('Magento\Filesystem\DirectoryList\Verification', $this->_dirVerificationMock), + array('Magento\App\Filesystem\DirectoryList\Verification', $this->_dirVerificationMock), array('Magento\App\State', $this->_appState), array('Magento\Core\Model\File\Storage\Request', $this->_requestMock), array('Magento\Core\Model\File\Storage\Synchronization', $this->_sync), @@ -138,9 +138,9 @@ class MediaTest extends \PHPUnit_Framework_TestCase public function testProcessRequestDoesNothingIfApplicationIsNotInstalled() { $this->_appState->expects($this->once())->method('isInstalled')->will($this->returnValue(false)); - $this->_responseMock->expects($this->once())->method('sendNotFound'); + $this->_responseMock->expects($this->once())->method('setHttpResponseCode')->with(404); $this->_requestMock->expects($this->never())->method('getPathInfo'); - $this->assertEquals(-1, $this->_model->execute()); + $this->assertEquals($this->_responseMock, $this->_model->execute()); } public function testProcessRequestCreatesConfigFileMediaDirectoryIsNotProvided() @@ -162,8 +162,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase ->with('Magento\Core\Model\File\Storage\Config') ->will($this->returnValue($this->_configMock)); $this->_configMock->expects($this->once())->method('save'); - $this->assertEquals(-1, $this->_model->execute()); - + $this->assertEquals($this->_responseMock, $this->_model->execute()); } public function testProcessRequestReturnsNotFoundResponseIfResourceIsNotAllowed() @@ -184,13 +183,13 @@ class MediaTest extends \PHPUnit_Framework_TestCase $this->filesystemMock ); $this->_appState->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); - $this->_responseMock->expects($this->once())->method('sendNotFound'); + $this->_responseMock->expects($this->once())->method('setHttpResponseCode')->with(404); $this->_requestMock->expects($this->once())->method('getPathInfo'); $this->_objectManagerMock->expects($this->once())->method('create') ->with('Magento\Core\Model\File\Storage\Config') ->will($this->returnValue($this->_configMock)); $this->_configMock->expects($this->once())->method('getAllowedResources')->will($this->returnValue(false)); - $this->assertEquals(-1, $this->_model->execute()); + $this->assertEquals($this->_responseMock, $this->_model->execute()); } @@ -199,9 +198,9 @@ class MediaTest extends \PHPUnit_Framework_TestCase $this->_appState->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->_configMock->expects($this->never())->method('save'); $this->_requestMock->expects($this->once())->method('getPathInfo'); - $this->_responseMock->expects($this->once())->method('sendNotFound'); + $this->_responseMock->expects($this->once())->method('setHttpResponseCode')->with(404); $this->_requestMock->expects($this->never())->method('getFilePath'); - $this->assertEquals(-1, $this->_model->execute()); + $this->assertEquals($this->_responseMock, $this->_model->execute()); } public function testProcessRequestReturnsFileIfItsProperlySynchronized() @@ -226,12 +225,9 @@ class MediaTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(true)); $this->_responseMock ->expects($this->once()) - ->method('sendFile') + ->method('setFilePath') ->with($filePath); - $this->_responseMock - ->expects($this->never()) - ->method('sendNotFound'); - $this->assertEquals(0, $this->_model->execute()); + $this->assertEquals($this->_responseMock, $this->_model->execute()); } public function testProcessRequestReturnsNotFoundIfFileIsNotSynchronized() @@ -242,8 +238,7 @@ class MediaTest extends \PHPUnit_Framework_TestCase $this->_sync->expects($this->once())->method('synchronize'); $this->_requestMock->expects($this->any()) ->method('getFilePath')->will($this->returnValue('non_existing_file_name')); - $this->_responseMock->expects($this->never())->method('sendFile'); - $this->_responseMock->expects($this->once())->method('sendNotFound'); - $this->assertEquals(-1, $this->_model->execute()); + $this->_responseMock->expects($this->once())->method('setHttpResponseCode')->with(404); + $this->assertEquals($this->_responseMock, $this->_model->execute()); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/PostDataTest.php b/dev/tests/unit/testsuite/Magento/Core/Helper/PostDataTest.php new file mode 100644 index 00000000000..92333a3ab20 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Core/Helper/PostDataTest.php @@ -0,0 +1,75 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Core + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Core\Helper; + + +class PostDataTest extends \PHPUnit_Framework_TestCase +{ + public function testGetPostData() + { + $url = '/controller/sample/action/url/'; + $formKey = 'formKey16bit'; + $product = ['product' => new \Magento\Object(['id' => 1])]; + $expected = json_encode([ + 'action' => $url, + 'data' => [ + 'product' => new \Magento\Object(['id' => 1]), + 'form_key' => $formKey, + \Magento\App\Action\Action::PARAM_NAME_URL_ENCODED => + strtr(base64_encode($url . 'for_uenc'), '+/=', '-_,') + ] + ]); + + $contextMock = $this->getMock('Magento\App\Helper\Context', ['getUrlBuilder'], [], '', false); + $urlBuilderMock = $this->getMockForAbstractClass( + 'Magento\UrlInterface', + [], + '', + true, + true, + true, + ['getCurrentUrl'] + ); + $formKeyMock = $this->getMock('Magento\Data\Form\FormKey', ['getFormKey'], [], '', false); + + $contextMock->expects($this->once()) + ->method('getUrlBuilder') + ->will($this->returnValue($urlBuilderMock)); + $formKeyMock->expects($this->once()) + ->method('getFormKey') + ->will($this->returnValue($formKey)); + $urlBuilderMock->expects($this->once()) + ->method('getCurrentUrl') + ->will($this->returnValue($url . 'for_uenc')); + + $model = new \Magento\Core\Helper\PostData($contextMock, $formKeyMock); + + $actual = $model->getPostData($url, $product); + $this->assertEquals($expected, $actual); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Core/Helper/ThemeTest.php b/dev/tests/unit/testsuite/Magento/Core/Helper/ThemeTest.php index a1bcf48c7e1..d8e03a009aa 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Helper/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Helper/ThemeTest.php @@ -481,22 +481,22 @@ class ThemeTest extends \PHPUnit_Framework_TestCase } /** - * @return \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @return \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected function _getFilesystem() { - /** @var $filesystem \Magento\Filesystem */ - $filesystem = $this->getMock('Magento\Filesystem', + /** @var $filesystem \Magento\App\Filesystem */ + $filesystem = $this->getMock('Magento\App\Filesystem', array('getPath', '__wakeup', 'getDirectoryRead'), array(), '', false ); $filesystem->expects($this->any()) ->method('getPath') ->will($this->returnValueMap(array( - array(\Magento\Filesystem::ROOT, self::ROOT), - array(\Magento\Filesystem::APP, self::APP), - array(\Magento\Filesystem::MODULES, self::MODULES), - array(\Magento\Filesystem::THEMES, self::THEMES), - array(\Magento\Filesystem::PUB_LIB, self::PUB_LIB), + array(\Magento\App\Filesystem::ROOT_DIR, self::ROOT), + array(\Magento\App\Filesystem::APP_DIR, self::APP), + array(\Magento\App\Filesystem::MODULES_DIR, self::MODULES), + array(\Magento\App\Filesystem::THEMES_DIR, self::THEMES), + array(\Magento\App\Filesystem::PUB_LIB_DIR, self::PUB_LIB), ))); return $filesystem; diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php index 92c0f28a66d..fbe3c2ef34c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/FileResolverTest.php @@ -35,7 +35,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase /** * Filesystem * - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $filesystem; @@ -60,7 +60,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase '', false ); - $this->filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); + $this->filesystem = $this->getMock('Magento\App\Filesystem', array('getDirectoryRead'), array(), '', false); $this->moduleReader = $this->getMock( 'Magento\Module\Dir\Reader', array(), @@ -99,7 +99,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($fileList)); $this->filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::CONFIG) + ->with(\Magento\App\Filesystem::CONFIG_DIR) ->will($this->returnValue($directory)); $this->iteratorFactory->expects($this->once()) ->method('create') diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ReaderTest.php index a373dabd13c..462e317dfe8 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Config/Initial/ReaderTest.php @@ -23,7 +23,7 @@ */ namespace Magento\Core\Model\Config\Initial; -use Magento\Filesystem; +use Magento\App\Filesystem; class ReaderTest extends \PHPUnit_Framework_TestCase { diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php deleted file mode 100644 index 560753abb72..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/** - * \Magento\Core\Model\DataService\Config\Reader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService\Config; - -class ReaderTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Core\Model\DataService\Config\Reader */ - private $_configReader; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_modulesReaderMock; - - /** - * Prepare object manager with mocks of objects required by config reader. - */ - protected function setUp() - { - $path = array(__DIR__, '..', '_files', 'service_calls.xml'); - $path = realpath(implode('/', $path)); - $this->_modulesReaderMock = $this->getMockBuilder('Magento\Module\Dir\Reader') - ->disableOriginalConstructor() - ->getMock(); - $directoryMock = $this->getMockBuilder('\Magento\Filesystem\Directory\Read') - ->disableOriginalConstructor() - ->getMock(); - - $directoryMock->expects($this->any()) - ->method('readFile') - ->will($this->returnValue(file_get_contents($path))); - - $this->_configReader = new \Magento\Core\Model\DataService\Config\Reader( - new \Magento\Config\FileIterator($directoryMock, array($path)), - $this->_modulesReaderMock - ); - } - - /** - * Verify correct schema file is returned. - */ - public function testGetSchemaFile() - { - $etcDir = 'app/code/Magento/Core/etc'; - $expectedPath = $etcDir . '/service_calls.xsd'; - $this->_modulesReaderMock->expects($this->any())->method('getModuleDir') - ->with('etc', 'Magento_Core') - ->will($this->returnValue($etcDir)); - $result = $this->_configReader->getSchemaFile(); - $this->assertNotNull($result); - $this->assertEquals($expectedPath, $result, 'returned schema file is wrong'); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/ConfigTest.php deleted file mode 100644 index 0fdd68c517e..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/ConfigTest.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php -/** - * \Magento\Core\Model\DataService\Config - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class ConfigTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\DataService\Config - */ - protected $_dataServiceConfig; - - /** @var \Magento\Core\Model\DataService\Config\Reader\Factory */ - private $_readersFactoryMock; - - protected function setUp() - { - $reader = $this->getMockBuilder('Magento\Core\Model\DataService\Config\Reader') - ->disableOriginalConstructor() - ->getMock(); - - $configXml = file_get_contents(__DIR__ . '/_files/service_calls.xml'); - $config = new \Magento\Config\Dom($configXml); - $reader->expects($this->any()) - ->method('getServiceCallConfig') - ->will($this->returnValue($config->getDom())); - - $this->_readersFactoryMock = $this->getMockBuilder('Magento\Core\Model\DataService\Config\Reader\Factory') - ->disableOriginalConstructor() - ->getMock(); - - $this->_readersFactoryMock->expects($this->any()) - ->method('createReader') - ->will($this->returnValue($reader)); - - /** @var \Magento\Module\Dir\Reader $modulesReaderMock */ - $modulesReaderMock = $this->getMockBuilder('Magento\Module\Dir\Reader') - ->disableOriginalConstructor() - ->getMock(); - $modulesReaderMock->expects($this->any()) - ->method('getConfigurationFiles') - ->will($this->returnValue(array())); - - $this->_dataServiceConfig = new \Magento\Core\Model\DataService\Config( - $this->_readersFactoryMock, $modulesReaderMock); - } - - public function testGetClassByAlias() - { - // result should match the config.xml file - $result = $this->_dataServiceConfig->getClassByAlias('alias'); - $this->assertNotNull($result); - $this->assertEquals('some_class_name', $result['class']); - $this->assertEquals('some_method_name', $result['retrieveMethod']); - $this->assertEquals('foo', $result['methodArguments']['some_arg_name']); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Service call with name - */ - public function testGetClassByAliasNotFound() - { - $this->_dataServiceConfig->getClassByAlias('none'); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage - */ - public function testGetClassByAliasInvalidCall() - { - $this->_dataServiceConfig->getClassByAlias('missing_service'); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage - */ - public function testGetClassByAliasMethodNotFound() - { - $this->_dataServiceConfig->getClassByAlias('missing_retrieval_method'); - } - -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/GraphTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/GraphTest.php deleted file mode 100644 index 5e2a0dccb69..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/GraphTest.php +++ /dev/null @@ -1,163 +0,0 @@ -<?php -/** - * \Magento\Core\Model\DataService\Invoker - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class GraphTest extends \PHPUnit_Framework_TestCase -{ - /** - * Fake info for service and classes. - */ - const TEST_CLASS_NAME = 'TEST_CLASS_NAME'; - - const TEST_DATA_SERVICE_NAME = 'TEST_DATA_SERVICE_NAME'; - - const TEST_NAMESPACE = 'TEST_NAMESPACE'; - - const TEST_NAMESPACE_ALIAS = 'TEST_NAMESPACE_ALIAS'; - - /** - * @var \Magento\Core\Model\DataService\Graph - */ - protected $_graph; - - /** - * @var object $_dataServiceMock - */ - protected $_dataServiceMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_invokerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_repositoryMock; - - protected function setUp() - { - $this->_invokerMock = $this->getMock('Magento\Core\Model\DataService\Invoker', array(), array(), "", false); - $this->_repositoryMock = $this->getMock( - 'Magento\Core\Model\DataService\Repository', array(), array(), "", false - ); - $this->_graph = new \Magento\Core\Model\DataService\Graph($this->_invokerMock, $this->_repositoryMock); - $this->_dataServiceMock = (object)array(); - } - - public function testInit() - { - $this->_repositoryMock->expects($this->once())->method('setAlias')->with( - self::TEST_NAMESPACE, - self::TEST_DATA_SERVICE_NAME, - self::TEST_NAMESPACE_ALIAS - ); - $namespaceConfig - = array('namespaces' => array(self::TEST_NAMESPACE => - \Magento\Core\Model\DataService\GraphTest::TEST_NAMESPACE_ALIAS)); - $this->_repositoryMock->expects($this->once())->method("get")->with( - $this->equalTo(self::TEST_DATA_SERVICE_NAME) - )->will($this->returnValue(null)); - $this->_invokerMock->expects($this->once())->method('getServiceData')->with( - $this->equalTo(self::TEST_DATA_SERVICE_NAME) - )->will($this->returnValue($this->_dataServiceMock)); - $this->_repositoryMock->expects($this->once())->method("add")->with( - $this->equalTo(self::TEST_DATA_SERVICE_NAME), - $this->equalTo($this->_dataServiceMock) - ); - $this->_graph->init( - array(self::TEST_DATA_SERVICE_NAME => $namespaceConfig) - ); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Data reference configuration doesn't have a block to link to - */ - public function testInitMissingNamespaces() - { - $namespaceConfig = array(); - $this->_repositoryMock->expects($this->any())->method("get")->with( - $this->equalTo(self::TEST_DATA_SERVICE_NAME) - )->will($this->returnValue(null)); - $this->_invokerMock->expects($this->any())->method('getServiceData')->with( - $this->equalTo(self::TEST_DATA_SERVICE_NAME) - )->will($this->returnValue($this->_dataServiceMock)); - $this->_repositoryMock->expects($this->any())->method("add")->with( - $this->equalTo(self::TEST_DATA_SERVICE_NAME), - $this->equalTo($this->_dataServiceMock) - ); - $this->_graph->init( - array(self::TEST_DATA_SERVICE_NAME => $namespaceConfig) - ); - } - - public function testGet() - { - $this->_dataServiceMock = (object)array(); - $this->_repositoryMock->expects($this->once())->method("get")->with( - $this->equalTo(self::TEST_DATA_SERVICE_NAME) - )->will($this->returnValue($this->_dataServiceMock)); - $this->assertEquals( - $this->_dataServiceMock, - $this->_graph->get(self::TEST_DATA_SERVICE_NAME) - ); - } - - public function testGetChild() - { - $this->_dataServiceMock = (object)array(); - $this->_repositoryMock->expects($this->once())->method("get")->with( - $this->equalTo(self::TEST_DATA_SERVICE_NAME) - )->will($this->returnValue($this->_dataServiceMock)); - $this->assertEquals( - $this->_dataServiceMock, - $this->_graph->getChildNode(self::TEST_DATA_SERVICE_NAME) - ); - } - - public function testGetByNamespace() - { - $this->_repositoryMock->expects($this->once())->method('getByNamespace')->with( - self::TEST_NAMESPACE - )->will($this->returnValue(self::TEST_DATA_SERVICE_NAME)); - $this->assertEquals( - self::TEST_DATA_SERVICE_NAME, - $this->_graph->getByNamespace(self::TEST_NAMESPACE) - ); - } - - public function testGetArgumentValue() - { - $this->_invokerMock->expects($this->once())->method('getArgumentValue')->with( - $this->equalTo(self::TEST_DATA_SERVICE_NAME) - )->will($this->returnValue($this->_dataServiceMock)); - - $argValue = $this->_graph->getArgumentValue(self::TEST_DATA_SERVICE_NAME); - - $this->assertEquals($this->_dataServiceMock, $argValue); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/InvokerTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/InvokerTest.php deleted file mode 100644 index d2d741be3ee..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/InvokerTest.php +++ /dev/null @@ -1,218 +0,0 @@ -<?php -/** - * \Magento\Core\Model\DataService\Invoker - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class InvokerTest extends \PHPUnit_Framework_TestCase -{ - /** - * Fake info for service and classes. - */ - const TEST_CLASS_NAME = 'TEST_CLASS_NAME'; - - const TEST_DATA_SERVICE_NAME = 'TEST_DATA_SERVICE_NAME'; - - const TEST_NAMESPACE = 'TEST_NAMESPACE'; - - const TEST_NAMESPACE_ALIAS = 'TEST_NAMESPACE_ALIAS'; - - /** - * @var \Magento\Core\Model\DataService\Invoker - */ - protected $_invoker; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_configMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManagerMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_compositeMock; - - /** - * Empty data service array - * - * @var array - */ - protected $_dataServiceMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $_navigator; - - /** - * Get the data service mock - * - * @return array - */ - public function retrieveMethod() - { - return $this->_dataServiceMock; - } - - protected function setUp() - { - $this->_configMock = $this->getMockBuilder('Magento\Core\Model\DataService\ConfigInterface') - ->disableOriginalConstructor() - ->getMock(); - $this->_objectManagerMock = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->getMock(); - $this->_compositeMock = $this->getMockBuilder('Magento\Core\Model\DataService\Path\Composite') - ->disableOriginalConstructor() - ->getMock(); - $this->_navigator = $this->getMockBuilder('Magento\Core\Model\DataService\Path\Navigator') - ->disableOriginalConstructor() - ->getMock(); - $this->_invoker = new \Magento\Core\Model\DataService\Invoker( - $this->_configMock, - $this->_objectManagerMock, - $this->_compositeMock, - $this->_navigator - ); - $this->_dataServiceMock = array(); - } - - public function testGetServiceData() - { - $classInformation = array( - 'class' => self::TEST_CLASS_NAME, - 'retrieveMethod' => 'retrieveMethod', 'methodArguments' => array()); - $this->_configMock - ->expects($this->once()) - ->method("getClassByAlias") - ->with($this->equalTo(self::TEST_DATA_SERVICE_NAME)) - ->will($this->returnValue($classInformation)); - $this->_objectManagerMock - ->expects($this->once()) - ->method("get") - ->with($this->equalTo(self::TEST_CLASS_NAME)) - ->will($this->returnValue($this)); - - $this->assertSame( - $this->_dataServiceMock, - $this->_invoker->getServiceData(self::TEST_DATA_SERVICE_NAME) - ); - } - - public function testGetServiceDataWithArguments() - { - $classInformation = array( - 'class' => self::TEST_CLASS_NAME, - 'retrieveMethod' => 'retrieveMethod', 'methodArguments' => array('something')); - $this->_configMock - ->expects($this->once()) - ->method("getClassByAlias") - ->with($this->equalTo(self::TEST_DATA_SERVICE_NAME)) - ->will($this->returnValue($classInformation)); - $this->_objectManagerMock - ->expects($this->once()) - ->method("get") - ->with($this->equalTo(self::TEST_CLASS_NAME)) - ->will($this->returnValue($this)); - - $this->assertSame( - $this->_dataServiceMock, - $this->_invoker->getServiceData(self::TEST_DATA_SERVICE_NAME) - ); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage return an array - */ - public function testGetServiceDataFailsIfNotArray() - { - // This line makes sure we don't return an array - $this->_dataServiceMock = (object)array(); - $classInformation = array( - 'class' => self::TEST_CLASS_NAME, - 'retrieveMethod' => 'retrieveMethod', 'methodArguments' => array()); - $this->_configMock - ->expects($this->once()) - ->method("getClassByAlias") - ->with($this->equalTo(self::TEST_DATA_SERVICE_NAME)) - ->will($this->returnValue($classInformation)); - $this->_objectManagerMock - ->expects($this->once()) - ->method("get") - ->with($this->equalTo(self::TEST_CLASS_NAME)) - ->will($this->returnValue($this)); - - $this->_invoker->getServiceData(self::TEST_DATA_SERVICE_NAME); - } - - public function testGetArgumentValueNoReplace() - { - $expectedValue = 'simple_value'; - $this->_navigator->expects($this->never()) - ->method('search'); - - $argumentValue = $this->_invoker->getArgumentValue($expectedValue); - - $this->assertEquals($expectedValue, $argumentValue); - } - - public function testGetArgumentValueFullReplace() - { - $expectedValue = 'replacementValue'; - $this->_navigator->expects($this->once()) - ->method('search') - ->with($this->_compositeMock, array('first', 'second')) - ->will($this->returnValue($expectedValue)); - - $argumentValue = $this->_invoker->getArgumentValue('{{first.second}}'); - - $this->assertEquals($expectedValue, $argumentValue); - } - - public function testGetArgumentValueTwoReplace() - { - $replaceFirstSecond = 'replacementValue'; - $replaceAnother = 'anotherValue'; - $inputValue = 'prefix-{{first.second}}-middle-{{another}}-postfix'; - $expectedValue = 'prefix-replacementValue-middle-anotherValue-postfix'; - $this->_navigator->expects($this->at(0)) - ->method('search') - ->with($this->_compositeMock, array('first', 'second')) - ->will($this->returnValue($replaceFirstSecond)); - $this->_navigator->expects($this->at(1)) - ->method('search') - ->with($this->_compositeMock, array('another')) - ->will($this->returnValue($replaceAnother)); - - $argumentValue = $this->_invoker->getArgumentValue($inputValue); - - $this->assertEquals($expectedValue, $argumentValue); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/CompositeTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/CompositeTest.php deleted file mode 100644 index 9525cab5c55..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/CompositeTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -/** - * \Magento\Core\Model\DataService\Path\Composite - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService\Path; - -class CompositeTest extends \PHPUnit_Framework_TestCase -{ - /** - * Names to use for testing path composite - */ - const ITEM_ONE = 'ITEM_ONE'; - const ITEM_TWO = 'ITEM_TWO'; - const ITEM_THREE = 'ITEM_THREE'; - - /** @var \Magento\Core\Model\DataService\Path\Composite */ - protected $_composite; - - /** - * object map for mock object manager - * @var array - */ - protected $_map; - - protected function setUp() - { - /** @var $objectManagerMock \Magento\ObjectManager */ - $objectManagerMock = $this->getMockBuilder('Magento\ObjectManager')->disableOriginalConstructor()->getMock(); - $this->_map = array( - array(self::ITEM_ONE, (object)array('name' => self::ITEM_ONE)), - array(self::ITEM_TWO, (object)array('name' => self::ITEM_TWO)), - array(self::ITEM_THREE, (object)array('name' => self::ITEM_THREE)) - ); - $objectManagerMock->expects($this->any())->method('get')->will($this->returnValueMap($this->_map)); - $vector = array((self::ITEM_ONE) => (self::ITEM_ONE), - (self::ITEM_TWO) => (self::ITEM_TWO), - (self::ITEM_THREE) => (self::ITEM_THREE)); - $this->_composite - = new \Magento\Core\Model\DataService\Path\Composite($objectManagerMock, $vector); - } - - /** - * @dataProvider childrenProvider - */ - public function testGetChildNode($elementName, $expectedResult) - { - $child = $this->_composite->getChildNode($elementName); - - $this->assertEquals($expectedResult, $child); - } - - public function childrenProvider() - { - return array( - // elementName, expectedResult - array(self::ITEM_ONE, (object)array('name' => self::ITEM_ONE)), - array(self::ITEM_TWO, (object)array('name' => self::ITEM_TWO)), - array(self::ITEM_THREE, (object)array('name' => self::ITEM_THREE)), - array('none', null), - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/NavigatorTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/NavigatorTest.php deleted file mode 100644 index 0f9b59ddded..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/NavigatorTest.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php -/** - * \Magento\Core\Model\DataService\Path\Navigator - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService\Path; - -class NavigatorTest extends \PHPUnit_Framework_TestCase -{ - /** @var \PHPUnit_Framework_MockObject_MockObject \Magento\Core\Model\DataService\Path\NodeInterface */ - private $_rootNode; - - /** - * @var \Magento\Core\Model\DataService\Path\Navigator - */ - private $_navigator; - - protected function setUp() - { - $this->_navigator = new \Magento\Core\Model\DataService\Path\Navigator(); - } - - public function testSearch() - { - $this->_rootNode = $this->getMockBuilder('Magento\Core\Model\DataService\Path\NodeInterface') - ->disableOriginalConstructor()->getMock(); - $branch = $this->getMockBuilder('Magento\Core\Model\DataService\Path\NodeInterface') - ->disableOriginalConstructor()->getMock(); - $leaf = $this->getMockBuilder('Magento\Core\Model\DataService\Path\NodeInterface') - ->disableOriginalConstructor()->getMock(); - $this->_rootNode->expects($this->any()) - ->method('getChildNode') - ->with('branch') - ->will($this->returnValue($branch)); - $branch->expects($this->any()) - ->method('getChildNode') - ->with('leaf') - ->will($this->returnValue($leaf)); - - $nodeFound = $this->_navigator->search($this->_rootNode, explode('.', 'branch.leaf')); - - $this->assertEquals($leaf, $nodeFound); - } - - public function testSearchOfArray() - { - $this->_rootNode = $this->getMockBuilder('Magento\Core\Model\DataService\Path\NodeInterface') - ->disableOriginalConstructor()->getMock(); - $branch = array(); - $leaf = 'a leaf node can be anything'; - $branch['leaf'] = $leaf; - $this->_rootNode->expects($this->any()) - ->method('getChildNode') - ->with('branch') - ->will($this->returnValue($branch)); - - $nodeFound = $this->_navigator->search($this->_rootNode, explode('.', 'branch.leaf')); - - $this->assertEquals($leaf, $nodeFound); - } - - public function testSearchOfEmptyArray() - { - $this->_rootNode = $this->getMockBuilder('Magento\Core\Model\DataService\Path\NodeInterface') - ->disableOriginalConstructor()->getMock(); - $branch = array(); - $this->_rootNode->expects($this->any()) - ->method('getChildNode') - ->with('branch') - ->will($this->returnValue($branch)); - - $nodeFound = $this->_navigator->search($this->_rootNode, explode('.', 'branch.leaf')); - - $this->assertEquals(null, $nodeFound); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage invalid.leaf - */ - public function testSearchWithInvalidPath() - { - $this->_rootNode = $this->getMockBuilder('Magento\Core\Model\DataService\Path\NodeInterface') - ->disableOriginalConstructor()->getMock(); - $leaf = $this->getMockBuilder('Magento\Core\Model\DataService\Path\NodeInterface') - ->disableOriginalConstructor()->getMock(); - - $nodeFound = $this->_navigator->search($this->_rootNode, explode('.', 'invalid.leaf')); - - $this->assertEquals($leaf, $nodeFound); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/RequestTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/RequestTest.php deleted file mode 100644 index 4e7f38902bb..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Path/RequestTest.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * \Magento\Core\Model\DataService\Path\Request - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService\Path; - -class RequestTest extends \PHPUnit_Framework_TestCase -{ - - /** - * Test data for params - */ - const SOME_INTERESTING_PARAMS = 'Some interesting params.'; - - public function testGetChild() - { - $requestMock = $this->getMockBuilder('Magento\App\Request\Http') - ->disableOriginalConstructor() - ->getMock(); - $requestMock->expects($this->once()) - ->method('getParams') - ->will($this->returnValue(self::SOME_INTERESTING_PARAMS)); - $requestVisitor = new \Magento\Core\Model\DataService\Path\Request($requestMock); - $this->assertEquals(self::SOME_INTERESTING_PARAMS, $requestVisitor->getChildNode('params')); - } - - public function testNotFound() - { - $requestMock = $this->getMockBuilder('Magento\App\Request\Http') - ->disableOriginalConstructor() - ->getMock(); - - $requestVisitor = new \Magento\Core\Model\DataService\Path\Request($requestMock); - $this->assertEquals(null, $requestVisitor->getChildNode('foo')); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/RepositoryTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/RepositoryTest.php deleted file mode 100644 index 7eda760efa2..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/RepositoryTest.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php -/** - * \Magento\Core\Model\DataService\Repository - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model\DataService; - -class RepositoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\DataService\Repository - */ - protected $_repository; - - protected function setUp() - { - $this->_repository = new \Magento\Core\Model\DataService\Repository(); - } - - public function testAddGet() - { - $data = array(); - $serviceName = 'service_name'; - $this->assertEquals($data, $this->_repository->add($serviceName, $data)->get($serviceName)); - } - - public function testGet() - { - $this->assertEquals(null, $this->_repository->get('unknown_service_name')); - } - - public function testGetByNamespace() - { - $result = $this->_repository->getByNamespace('unknown_namespace'); - $this->assertEquals(array(), $result); - } - - public function testAddGetNamespace() - { - $data = array(); - $alias = 'alias'; - $namespace = 'namespace'; - $serviceName = 'service_name'; - $namespaceResults = $this->_repository->add($serviceName, $data) - ->setAlias($namespace, $serviceName, $alias) - ->getByNamespace($namespace); - $this->assertEquals($data, $namespaceResults[$alias]); - } - - public function testAddGetNamespaceAgain() - { - $data = array(); - $alias = 'alias'; - $namespace = 'namespace'; - $serviceName = 'service_name'; - $namespaceResults = $this->_repository->add($serviceName, $data) - ->setAlias($namespace, $serviceName, 'something_different') - ->setAlias($namespace, $serviceName, $alias) - ->getByNamespace($namespace); - $this->assertEquals($data, $namespaceResults[$alias]); - } - - public function testGetChild() - { - $data = array(); - $serviceName = 'service_name'; - $this->_repository->add($serviceName, $data); - $this->assertEquals($data, $this->_repository->getChildNode($serviceName)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/_files/second_service_calls.xml b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/_files/second_service_calls.xml deleted file mode 100644 index 3588ee03078..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/_files/second_service_calls.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<service_calls> - <service_call name='another_alias' service='another_class_name' method='another_method_name'> - <arg name="another_arg_name">foo</arg> - </service_call> -</service_calls> \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/_files/service_calls.xml b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/_files/service_calls.xml deleted file mode 100644 index 47239b1c204..00000000000 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/_files/service_calls.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<service_calls> - <service_call name='alias' service='some_class_name' method='some_method_name'> - <arg name="some_arg_name">foo</arg> - </service_call> - - <service_call name='missing_service' method='some_method_name'> - <arg name="some_arg_name">foo</arg> - </service_call> - - <service_call name='missing_retrieval_method'> - <arg name="some_arg_name">foo</arg> - </service_call> -</service_calls> \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/ConfigTest.php index 6f33b8b68fb..1a6f2d3266c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/ConfigTest.php @@ -59,10 +59,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->method('openFile') ->with('cacheFile') ->will($this->returnValue($file)); - $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite'), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array('getDirectoryWrite'), array(), '', false); $filesystem->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::PUB) + ->with(\Magento\App\Filesystem::PUB_DIR) ->will($this->returnValue($directory)); $model = new \Magento\Core\Model\File\Storage\Config( $fileStorageMock, diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/SynchronizationTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/SynchronizationTest.php index a7a6758bc97..e89664af9f9 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/SynchronizationTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/SynchronizationTest.php @@ -76,10 +76,10 @@ class SynchronizationTest extends \PHPUnit_Framework_TestCase ->method('openFile') ->with($filePath) ->will($this->returnValue($file)); - $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite'), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array('getDirectoryWrite'), array(), '', false); $filesystem->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::PUB) + ->with(\Magento\App\Filesystem::PUB_DIR) ->will($this->returnValue($directory)); $model = new Synchronization($storageFactoryMock, $filesystem); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php index a490e838f5e..1075daaefa6 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php @@ -106,7 +106,7 @@ class MergeTest extends \PHPUnit_Framework_TestCase $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false, false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false, false); $directory = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false, false); $directory->expects($this->any())->method('getRelativePath')->will($this->returnArgument(0)); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Locale/Hierarchy/Config/FileResolverTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Locale/Hierarchy/Config/FileResolverTest.php index 2cb091b5adc..9ab6a9e3bc1 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Locale/Hierarchy/Config/FileResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Locale/Hierarchy/Config/FileResolverTest.php @@ -42,7 +42,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array('getDirectoryRead'), array(), '', false); $this->_directoryMock = $this->getMock( '\Magento\Filesystem\Directory\Read', array('isExist', 'search'), @@ -52,7 +52,7 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase ); $filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::APP) + ->with(\Magento\App\Filesystem::APP_DIR) ->will($this->returnValue($this->_directoryMock)); $this->_directoryMock->expects($this->once()) ->method('isExist') diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php index d6c5a3a468b..c995bd10d93 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php @@ -75,7 +75,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase */ public function testGetConnectionInMemoryCaching() { - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $string = $this->getMock('Magento\Stdlib\String', array(), array(), '', false); $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); $connection = new \Magento\DB\Adapter\Pdo\Mysql($filesystem, $string, $dateTime, array( diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/File/Storage/FileTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/File/Storage/FileTest.php index 48130a2d445..e86ed68a6df 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/File/Storage/FileTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/File/Storage/FileTest.php @@ -38,7 +38,7 @@ class FileTest extends \PHPUnit_Framework_TestCase protected $loggerMock; /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $filesystemMock; @@ -55,7 +55,7 @@ class FileTest extends \PHPUnit_Framework_TestCase $this->loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); $this->filesystemMock = - $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); + $this->getMock('Magento\App\Filesystem', array('getDirectoryRead'), array(), '', false); $this->directoryReadMock = $this->getMock('Magento\Filesystem\Directory\Read', array('isDirectory', 'readRecursively'), array(), '', false); @@ -78,7 +78,7 @@ class FileTest extends \PHPUnit_Framework_TestCase { $this->filesystemMock->expects($this->once()) ->method('getDirectoryRead') - ->with($this->equalTo(\Magento\FileSystem::MEDIA)) + ->with($this->equalTo(\Magento\App\Filesystem::MEDIA_DIR)) ->will($this->returnValue($this->directoryReadMock)); $this->directoryReadMock->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php index 13039f98717..357f5f052a9 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Setup/MigrationTest.php @@ -157,7 +157,7 @@ class MigrationTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(array())); $contextMock = $this->getMock('Magento\Core\Model\Resource\Setup\Context', array(), array(), '', false); - $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $contextMock->expects($this->any()) ->method('getFilesystem') ->will($this->returnValue($filesystemMock)); @@ -188,7 +188,7 @@ class MigrationTest extends \PHPUnit_Framework_TestCase $contextMock, 'core_setup', $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), - $this->getMock('Magento\Filesystem', array(), array(), '', false), + $this->getMock('Magento\App\Filesystem', array(), array(), '', false), '' ); @@ -241,7 +241,7 @@ class MigrationTest extends \PHPUnit_Framework_TestCase $setupModel = new \Magento\Core\Model\Resource\Setup\Migration( $this->getMock('Magento\App\Resource', array(), array(), '', false, false), - $this->getMock('Magento\Filesystem', array(), array(), '', false), + $this->getMock('Magento\App\Filesystem', array(), array(), '', false), $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false), $this->getMock('Magento\Logger', array(), array(), '', false), $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), @@ -310,11 +310,11 @@ class MigrationTest extends \PHPUnit_Framework_TestCase } /** - * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Filesystem + * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Filesystem */ protected function _getFilesystemMock() { - $mock = $this->getMockBuilder('Magento\Filesystem') + $mock = $this->getMockBuilder('Magento\App\Filesystem') ->disableOriginalConstructor() ->getMock(); return $mock; diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php index a667650fa95..c0e5b03936b 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Session/ConfigTest.php @@ -60,7 +60,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $_appState; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -83,7 +83,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ->method('getHttpHost')->will($this->returnValue('init.host')); $this->_appState = $this->getMock('\Magento\App\State', array('isInstalled'), array(), '', false, false); $this->_appState->expects($this->atLeastOnce())->method('isInstalled')->will($this->returnValue(true)); - $this->_filesystem = $this->getMock('\Magento\Filesystem', array(), array(), '', false, false); + $this->_filesystem = $this->getMock('\Magento\App\Filesystem', array(), array(), '', false, false); $this->config = new \Magento\Core\Model\Session\Config( $this->_configMock, diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Image/PathTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Image/PathTest.php index 0311e6b8c8a..5cf989426df 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Image/PathTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Image/PathTest.php @@ -54,11 +54,11 @@ class PathTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_viewUrlMock = $this->getMock('Magento\View\Url', array(), array(), '', false); $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - $this->_filesystem->expects($this->any())->method('getPath')->with(\Magento\Filesystem::MEDIA) + $this->_filesystem->expects($this->any())->method('getPath')->with(\Magento\App\Filesystem::MEDIA_DIR) ->will($this->returnValue('/media')); $this->_model = new Path( diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/ThemeTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/ThemeTest.php index d492be2bff4..3a71d7ea142 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Block/Adminhtml/ThemeTest.php @@ -29,9 +29,9 @@ namespace Magento\DesignEditor\Block\Adminhtml; class ThemeTest extends \PHPUnit_Framework_TestCase { /** - * @cover \Magento\DesignEditor\Block\Adminhtml\Theme::addButton - * @cover \Magento\DesignEditor\Block\Adminhtml\Theme::clearButtons - * @cover \Magento\DesignEditor\Block\Adminhtml\Theme::getButtonsHtml + * @covers \Magento\DesignEditor\Block\Adminhtml\Theme::addButton + * @covers \Magento\DesignEditor\Block\Adminhtml\Theme::clearButtons + * @covers \Magento\DesignEditor\Block\Adminhtml\Theme::getButtonsHtml */ public function testButtons() { diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Editor/QuickStyles/Renderer/BackgroundImageTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Editor/QuickStyles/Renderer/BackgroundImageTest.php index fae070343b4..dbe92360472 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Editor/QuickStyles/Renderer/BackgroundImageTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Editor/QuickStyles/Renderer/BackgroundImageTest.php @@ -34,7 +34,7 @@ class BackgroundImageTest extends \PHPUnit_Framework_TestCase { /** - * @cover \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Renderer\BackgroundImage::toCss + * @covers \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Renderer\BackgroundImage::toCss * @dataProvider backgroundImageData */ public function testToCss($expectedResult, $data) @@ -48,7 +48,7 @@ class BackgroundImageTest } /** - * @cover \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Renderer\BackgroundImage::toCss + * @covers \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Renderer\BackgroundImage::toCss * @dataProvider backgroundImageDataClearDefault */ public function testToCssClearDefault($expectedResult, $data) diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Editor/QuickStyles/Renderer/DefaultTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Editor/QuickStyles/Renderer/DefaultTest.php index 53514b263b3..34559a7112b 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Editor/QuickStyles/Renderer/DefaultTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Editor/QuickStyles/Renderer/DefaultTest.php @@ -34,7 +34,7 @@ class DefaultTest extends \PHPUnit_Framework_TestCase { /** - * @cover \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Renderer\DefaultRenderer::toCss + * @covers \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Renderer\DefaultRenderer::toCss * @dataProvider colorPickerData */ public function testToCss($expectedResult, $data) diff --git a/dev/tests/unit/testsuite/Magento/Directory/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Directory/Helper/DataTest.php index d3dbb23f7e6..f0e8c86a87a 100644 --- a/dev/tests/unit/testsuite/Magento/Directory/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Directory/Helper/DataTest.php @@ -63,9 +63,14 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->_regionCollection = $this->getMock('Magento\Directory\Model\Resource\Region\Collection', array(), array(), '', false); - $regCollFactory = $this->getMock('Magento\Directory\Model\Resource\Region\CollectionFactory', array('create'), - array(), '', false); - $regCollFactory->expects($this->any()) + $regCollectionFactory = $this->getMock( + 'Magento\Directory\Model\Resource\Region\CollectionFactory', + array('create'), + array(), + '', + false + ); + $regCollectionFactory->expects($this->any()) ->method('create') ->will($this->returnValue($this->_regionCollection)); @@ -83,7 +88,7 @@ class DataTest extends \PHPUnit_Framework_TestCase 'context' => $context, 'configCacheType' => $configCacheType, 'countryCollection' => $this->_countryCollection, - 'regCollFactory' => $regCollFactory, + 'regCollectionFactory' => $regCollectionFactory, 'coreHelper' => $this->_coreHelper, 'storeManager' => $storeManager, 'currencyFactory' => $currencyFactory, diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/DownloadableTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/DownloadableTest.php new file mode 100644 index 00000000000..91b1960d5d0 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Controller/Adminhtml/Product/Initialization/Helper/Plugin/DownloadableTest.php @@ -0,0 +1,76 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Downloadable\Controller\Adminhtml\Product\Initialization\Helper\Plugin; + +class DownloadableTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Downloadable\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Downloadable + */ + protected $downloadablePlugin; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $requestMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + protected function setUp() + { + $this->requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $this->productMock = $this->getMock('Magento\Catalog\Model\Product', + array('setDownloadableData', '__wakeup'), array(), '', false); + $this->downloadablePlugin = + new \Magento\Downloadable\Controller\Adminhtml\Product\Initialization\Helper\Plugin\Downloadable( + $this->requestMock + ); + } + + public function testAfterInitializeIfDownloadableExist() + { + $this->requestMock + ->expects($this->once()) + ->method('getPost') + ->with('downloadable') + ->will($this->returnValue('downloadable')); + $this->productMock->expects($this->once())->method('setDownloadableData')->with('downloadable'); + $this->downloadablePlugin->afterInitialize($this->productMock); + } + + public function testAfterInitializeIfDownloadableNotExist() + { + $this->requestMock + ->expects($this->once()) + ->method('getPost') + ->with('downloadable') + ->will($this->returnValue(false)); + $this->productMock->expects($this->never())->method('setDownloadableData'); + $this->downloadablePlugin->afterInitialize($this->productMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php index e30fd331e9c..0914244383f 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php @@ -24,7 +24,7 @@ namespace Magento\Downloadable\Helper; use Magento\Downloadable\Helper\Download as DownloadHelper; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\Filesystem\File\ReadInterface as FileReadInterface; use Magento\Filesystem\Directory\ReadInterface as DirReadInterface; use Magento\Downloadable\Helper\File as DownloadableFile; @@ -67,7 +67,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase self::$functionExists = true; self::$mimeContentType = self::MIME_TYPE; - $this->_filesystemMock = $this->getMock('Magento\Filesystem', [], [], '', false); + $this->_filesystemMock = $this->getMock('Magento\App\Filesystem', [], [], '', false); $this->_handleMock = $this->getMock('Magento\Filesystem\File\ReadInterface', [], [], '', false); $this->_workingDirectoryMock = $this->getMock('Magento\Filesystem\Directory\ReadInterface', [], [], '', false); $this->_downloadableFileMock = $this->getMock('Magento\Downloadable\Helper\File', [], [], '', false); @@ -208,7 +208,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase $this->_filesystemMock ->expects($this->any()) ->method('getDirectoryRead') - ->with(Filesystem::MEDIA) + ->with(Filesystem::MEDIA_DIR) ->will($this->returnValue($this->_workingDirectoryMock)); $this->_helper->setResource($path, DownloadHelper::LINK_TYPE_FILE); diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php deleted file mode 100644 index 43c007ef29f..00000000000 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Model/ObserverTest.php +++ /dev/null @@ -1,283 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Downloadable - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Downloadable\Model; - -class ObserverTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Event\Observer - */ - protected $_observer; - - /** - * @var \Magento\Downloadable\Model\Observer - */ - protected $_model; - - /** - * @var \Magento\Core\Helper\Data - */ - protected $_helperJsonEncode; - - protected function setUp() - { - $this->_helperJsonEncode = $this->getMockBuilder('Magento\Core\Helper\Data') - ->setMethods(array('jsonEncode')) - ->disableOriginalConstructor() - ->getMock(); - $itemsFactory = $this->getMock('Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory', - array(), array(), '', false - ); - $this->_model = new \Magento\Downloadable\Model\Observer( - $this->_helperJsonEncode, - $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false), - $this->getMock('Magento\Downloadable\Model\Link\PurchasedFactory', array(), array(), '', false), - $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false), - $this->getMock('Magento\Downloadable\Model\Link\Purchased\ItemFactory', array(), array(), '', false), - $this->getMock('Magento\Checkout\Model\Session', array(), array(), '', false), - $itemsFactory, - $this->getMock('\Magento\Object\Copy', array(), array(), '', false) - ); - } - - protected function tearDown() - { - $this->_helperJsonEncode = null; - $this->_model = null; - $this->_observer = null; - } - - /** - * @return \PHPUnit_Framework_MockObject_MockObject|\Magento\Catalog\Model\Product - */ - protected function getProductMock() - { - return $this->getMock( - 'Magento\Catalog\Model\Product', - array('getTypeId', 'getTypeInstance', '__wakeup'), - array(), - '', - false - ); - } - - public function testDuplicateProductNotDownloadable() - { - $currentProduct = $this->getProductMock(); - - $currentProduct->expects($this->once()) - ->method('getTypeId') - ->will($this->returnValue(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE)); - $currentProduct->expects($this->never()) - ->method('getTypeInstance'); - - $this->_setObserverExpectedMethods($currentProduct, new \Magento\Object()); - - $this->_model->duplicateProduct($this->_observer); - } - - public function testDuplicateProductEmptyLinks() - { - $currentProduct = $this->getProductMock(); - $currentProduct->expects($this->once()) - ->method('getTypeId') - ->will($this->returnValue(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE)); - $newProduct = $this->getProductMock(); - - $typeInstance = $this->getMock('Magento\Downloadable\Model\Product\Type', - array('getLinks', 'getSamples'), array(), '', false); - $typeInstance->expects($this->once()) - ->method('getLinks') - ->will($this->returnValue(array())); - $typeInstance->expects($this->once()) - ->method('getSamples') - ->will($this->returnValue(new \Magento\Object())); - - $currentProduct->expects($this->once()) - ->method('getTypeInstance') - ->will($this->returnValue($typeInstance)); - - $this->_setObserverExpectedMethods($currentProduct, $newProduct); - - $this->assertNull($newProduct->getDownloadableData()); - $this->_model->duplicateProduct($this->_observer); - $this->assertEmpty($newProduct->getDownloadableData()); - } - - public function testDuplicateProductTypeFile() - { - $currentProduct = $this->getProductMock(); - $currentProduct->expects($this->once()) - ->method('getTypeId') - ->will($this->returnValue(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE)); - - $newProduct = $this->getProductMock(); - - $links = $this->_getLinks(); - - $samples = $this->_getSamples(); - - $getLinks = new \Magento\Object($links); - - $getSamples = new \Magento\Object($samples); - - $typeInstance = $this->getMock('Magento\Downloadable\Model\Product\Type', - array('getLinks', 'getSamples'), array(), '', false); - $typeInstance->expects($this->atLeastOnce()) - ->method('getLinks') - ->will($this->returnValue(array($getLinks))); - $typeInstance->expects($this->atLeastOnce()) - ->method('getSamples') - ->will($this->returnValue(array($getSamples))); - - $currentProduct->expects($this->atLeastOnce()) - ->method('getTypeInstance') - ->will($this->returnValue($typeInstance)); - - $this->_setObserverExpectedMethods($currentProduct, $newProduct); - - $callbackJsonEncode = function ($arg) { - return json_encode($arg); - }; - $this->_helperJsonEncode->expects($this->atLeastOnce()) - ->method('jsonEncode') - ->will($this->returnCallback($callbackJsonEncode)); - - $this->assertNull($newProduct->getDownloadableData($newProduct)); - $this->_model->duplicateProduct($this->_observer); - - $newDownloadableData = $newProduct->getDownloadableData(); - $fileData = json_decode($newDownloadableData['link'][0]['file'], true); - - $this->assertEquals($links['price'], $newDownloadableData['link'][0]['price']); - $this->assertEquals($links['link_file'][0], $fileData[0]['file'][0]); - $this->assertEquals($samples['title'], $newDownloadableData['sample'][0]['title']); - $this->assertEquals(false, $newDownloadableData['link'][0]['is_delete']); - $this->assertEquals($links['number_of_downloads'], $newDownloadableData['link'][0]['number_of_downloads']); - } - - /** - * Get downloadable data without is_delete flag - * - * @return array - */ - protected function _getDownloadableData() - { - return array( - 'sample' => array(array('id' => 1, 'is_delete' => '')), - 'link' => array(array('id' => 2, 'is_delete' => '')) - ); - } - - /** - * Get downloadable data with set is_delete flag - * - * @return array - */ - protected function _getDownloadableDataForDelete() - { - return array( - 'sample' => array(array('id' => 1, 'is_delete' => '1')), - 'link' => array(array('id' => 2, 'is_delete' => '1')) - ); - } - - /** - * Set products to observer - * - * @param array $currentProduct - * @param array $newProduct - */ - protected function _setObserverExpectedMethods($currentProduct, $newProduct) - { - $this->_observer = $this->getMock('Magento\Event\Observer', - array('getCurrentProduct', 'getNewProduct'), array(), '', false); - $this->_observer->expects($this->once()) - ->method('getCurrentProduct') - ->will($this->returnValue($currentProduct)); - $this->_observer->expects($this->once()) - ->method('getNewProduct') - ->will($this->returnValue($newProduct)); - } - - /** - * Get Downloadable Link Data - * - * @return array - */ - protected function _getLinks() - { - return array( - 'link_id' => '36', - 'product_id' => '141', - 'sort_order' => '0', - 'number_of_downloads' => '0', - 'is_shareable' => '2', - 'link_url' => null, - 'link_file' => array(array( - 'file' => '/l/i/lighthouse_3.jpg', - 'name' => 'lighthouse_3.jpg', - 'size' => 56665, - 'status' => 'new', - )), - 'link_type' => 'file', - 'sample_url' => null, - 'sample_file' => array(array( - 'file' => '/a/b/lighthouse_3.jpg', - 'name' => 'lighthouse_3.jpg', - 'size' => 56665, - 'status' => 'new', - )), - 'sample_type' => 'file', - 'title' =>'Link Title', - 'price' =>'15.00', - ); - } - - /** - * Get Downloadable Sample Data - * - * @return array - */ - protected function _getSamples() - { - return array( - 'sample_id' => '42', - 'sample_url' => null, - 'sample_file' => array(array( - 'file' => '/b/r/lighthouse_3.jpg', - 'name' => 'lighthouse_3.jpg', - 'size' => 56665, - 'status' => 'new', - )), - 'sample_type' => 'file', - 'sort_order' => '0', - 'title' => 'Sample Title', - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/CopyConstructor/DownloadableTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/CopyConstructor/DownloadableTest.php new file mode 100644 index 00000000000..4e2b5af94b3 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/CopyConstructor/DownloadableTest.php @@ -0,0 +1,152 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Downloadable\Model\Product\CopyConstructor; + +class DownloadableTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Downloadable\Model\Product\CopyConstructor\Downloadable + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_duplicateMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_sampleMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkCollectionMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_encoderMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_productTypeMock; + + protected function setUp() + { + $this->_encoderMock = $this->getMock('\Magento\Core\Helper\Data', array(), array(), '', false); + $this->_model = new \Magento\Downloadable\Model\Product\CopyConstructor\Downloadable($this->_encoderMock); + + $this->_productMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array(), array(), '', false + ); + + $this->_duplicateMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array('setDownloadableData', '__wakeup'), array(), '', false + ); + + $this->_linkMock = $this->getMock('\Magento\Downloadable\Model\Link', + array(), array(), '', false + ); + + $this->_sampleMock = $this->getMock('\Magento\Downloadable\Model\Sample', + array(), array(), '', false + ); + + $this->_productTypeMock = $this->getMock('\Magento\Downloadable\Model\Product\Type', + array(), array(), '', false + ); + + $this->_encoderMock->expects($this->any())->method('jsonEncode')->will($this->returnArgument(0)); + } + + public function testBuildWithNonDownloadableProductType() + { + $this->_productMock->expects($this->once())->method('getTypeId')->will($this->returnValue('some value')); + + $this->_duplicateMock->expects($this->never())->method('setDownloadableData'); + + $this->_model->build($this->_productMock, $this->_duplicateMock); + } + + public function testBuild() + { + $expectedData = include __DIR__ . '/_files/expected_data.php'; + + $this->_productMock->expects($this->once()) + ->method('getTypeId') + ->will($this->returnValue(\Magento\Downloadable\Model\Product\Type::TYPE_DOWNLOADABLE)); + + $this->_productMock->expects($this->once()) + ->method('getTypeInstance')->will($this->returnValue($this->_productTypeMock)); + + $this->_productTypeMock->expects($this->once())->method('getLinks') + ->with($this->_productMock)->will($this->returnValue(array($this->_linkMock))); + + $this->_productTypeMock->expects($this->once())->method('getSamples') + ->with($this->_productMock)->will($this->returnValue(array($this->_sampleMock))); + + $linkData = array( + 'title' => 'title', + 'is_shareable' => 'is_shareable', + 'sample_type' => 'sample_type', + 'sample_url' => 'sample_url', + 'sample_file' => 'sample_file', + 'link_file' => 'link_file', + 'link_type' => 'link_type', + 'link_url' => 'link_url', + 'sort_order' => 'sort_order', + 'price' => 'price', + 'number_of_downloads' => 'number_of_downloads', + ); + + $sampleData = array( + 'title' => 'title', + 'sample_type' => 'sample_type', + 'sample_file' => 'sample_file', + 'sample_url' => 'sample_url', + 'sort_order' => 'sort_order', + ); + + $this->_linkMock->expects($this->once())->method('getData')->will($this->returnValue($linkData)); + $this->_sampleMock->expects($this->once())->method('getData')->will($this->returnValue($sampleData)); + + $this->_duplicateMock->expects($this->once())->method('setDownloadableData')->with($expectedData); + $this->_model->build($this->_productMock, $this->_duplicateMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/CopyConstructor/_files/expected_data.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/CopyConstructor/_files/expected_data.php new file mode 100644 index 00000000000..0c0b62a3d20 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/CopyConstructor/_files/expected_data.php @@ -0,0 +1,81 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +return array( + 'link' => + array( + array( + 'is_delete' => false, + 'link_id' => null, + 'title' => 'title', + 'is_shareable' => 'is_shareable', + 'sample' => array( + 'type' => 'sample_type', + 'url' => 'sample_url', + 'file' => + array( + array( + 'file' => 'sample_file', + 'name' => 'sample_file', + 'size' => 0, + 'status' => null, + ), + ), + ), + 'file' => + array( + array( + 'file' => 'link_file', + 'name' => 'link_file', + 'size' => 0, + 'status' => null, + ), + ), + 'type' => 'link_type', + 'link_url' => 'link_url', + 'sort_order' => 'sort_order', + 'number_of_downloads' => 'number_of_downloads', + 'price' => 'price', + ), + ), + 'sample' => + array( + array( + 'is_delete' => false, + 'sample_id' => NULL, + 'title' => 'title', + 'type' => 'sample_type', + 'file' => + array( + array( + 'file' => 'sample_file', + 'name' => 'sample_file', + 'size' => 0, + 'status' => NULL, + ), + ), + 'sample_url' => 'sample_url', + 'sort_order' => 'sort_order', + ), + ), +); diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php index 27d35c12520..f461449d92f 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Product/TypeTest.php @@ -43,7 +43,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase $coreData = $this->getMockBuilder('Magento\Core\Helper\Data')->disableOriginalConstructor()->getMock(); $fileStorageDb = $this->getMockBuilder('Magento\Core\Helper\File\Storage\Database') ->disableOriginalConstructor()->getMock(); - $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); + $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock(); $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php index 5a57ec4abfa..ffa08a36453 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Model/Sales/Order/Pdf/Items/CreditmemoTest.php @@ -57,7 +57,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase 'emailInfoFactory' => $this->getMock( 'Magento\Email\Model\InfoFactory', array(), array(), '', false ), - 'orderItemCollFactory' => $this->getMock( + 'orderItemCollectionFactory' => $this->getMock( 'Magento\Sales\Model\Resource\Order\Item\CollectionFactory', array(), array(), '', false ), 'serviceOrderFactory' => $this->getMock( @@ -69,7 +69,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase 'orderHistoryFactory' => $this->getMock( 'Magento\Sales\Model\Order\Status\HistoryFactory', array(), array(), '', false ), - 'orderTaxCollFactory' => $this->getMock( + 'orderTaxCollectionFactory' => $this->getMock( 'Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory', array(), array(), '', false ), ); diff --git a/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php b/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php index 755275cb5d6..ced72f5ce98 100644 --- a/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php +++ b/dev/tests/unit/testsuite/Magento/Email/Block/Adminhtml/Template/EditTest.php @@ -97,7 +97,7 @@ class EditTest extends \PHPUnit_Framework_TestCase 'Magento\Email\Model\Template\Config', array(), array(), '', false ); - $this->filesystemMock = $this->getMock('\Magento\Filesystem', + $this->filesystemMock = $this->getMock('\Magento\App\Filesystem', array('getFilesystem', '__wakeup', 'getPath', 'getDirectoryRead'), array(), '', false); $viewFilesystem = $this->getMock('\Magento\View\Filesystem', @@ -209,9 +209,9 @@ class EditTest extends \PHPUnit_Framework_TestCase public function testGetDefaultTemplatesAsOptionsArray() { $dirValueMap = array( - array(\Magento\Filesystem::ROOT, 'var/www/magento\rootdir/'), - array(\Magento\Filesystem::APP, 'var/www/magento\rootdir\app/'), - array(\Magento\Filesystem::THEMES, 'var\www/magento\rootdir\app/themes/') + array(\Magento\App\Filesystem::ROOT_DIR, 'var/www/magento\rootdir/'), + array(\Magento\App\Filesystem::APP_DIR, 'var/www/magento\rootdir\app/'), + array(\Magento\App\Filesystem::THEMES_DIR, 'var\www/magento\rootdir\app/themes/') ); $this->directoryMock = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/Directory/WriteTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/Directory/WriteTest.php index 7c7774feac9..7a7fe7b7073 100644 --- a/dev/tests/unit/testsuite/Magento/Filesystem/Directory/WriteTest.php +++ b/dev/tests/unit/testsuite/Magento/Filesystem/Directory/WriteTest.php @@ -68,6 +68,15 @@ class WriteTest extends \PHPUnit_Framework_TestCase $this->write = null; } + public function testGetDriver() + { + $this->assertInstanceOf( + 'Magento\Filesystem\DriverInterface', + $this->write->getDriver(), + 'getDriver method expected to return instance of Magento\Filesystem\DriverInterface' + ); + } + public function testCreate() { $this->driver->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryListTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryListTest.php index 9322b0418ec..eb7fa71c79c 100644 --- a/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryListTest.php +++ b/dev/tests/unit/testsuite/Magento/Filesystem/DirectoryListTest.php @@ -23,7 +23,8 @@ */ namespace Magento\Filesystem; -use Magento\Filesystem; +use Magento\Filesystem, + Magento\App\Filesystem as AppFilesystem; class DirectoryListTest extends \PHPUnit_Framework_TestCase { @@ -45,6 +46,16 @@ class DirectoryListTest extends \PHPUnit_Framework_TestCase } } + /** + * @expectedException \Magento\Filesystem\FilesystemException + */ + public function testAddDefinedDirectory() + { + $directories = array(AppFilesystem::PUB_LIB_DIR => array('path' => '')); + $directoryList = new DirectoryList(__DIR__, $directories); + $directoryList->addDirectory(AppFilesystem::PUB_LIB_DIR, array('path' => '')); + } + /** * Data provider for testAddDirectoryGetConfig */ @@ -54,10 +65,10 @@ class DirectoryListTest extends \PHPUnit_Framework_TestCase 'pub_lib' => array( __DIR__, array( - Filesystem::PUB_LIB => array('path' => 'pub/lib_basic') + 'custom1_' . AppFilesystem::PUB_LIB_DIR => array('path' => 'pub/lib_basic') ), array( - Filesystem::PUB_LIB => array( + 'custom2_' . AppFilesystem::PUB_LIB_DIR => array( 'path' => 'pub/lib', 'uri' => 'pub/lib', 'permissions' => 0777, @@ -66,7 +77,7 @@ class DirectoryListTest extends \PHPUnit_Framework_TestCase ) ), array( - Filesystem::PUB_LIB => array( + 'custom2_' . AppFilesystem::PUB_LIB_DIR => array( 'path' => str_replace('\\', '/', __DIR__ . '/pub/lib'), 'uri' => 'pub/lib', 'permissions' => 0777, @@ -100,15 +111,15 @@ class DirectoryListTest extends \PHPUnit_Framework_TestCase public function invalidUriDataProvider() { return array( - array(Filesystem::MEDIA, '/'), - array(Filesystem::MEDIA, '//'), - array(Filesystem::MEDIA, '/value'), - array(Filesystem::MEDIA, 'value/'), - array(Filesystem::MEDIA, '/value/'), - array(Filesystem::MEDIA, 'one\\two'), - array(Filesystem::MEDIA, '../dir'), - array(Filesystem::MEDIA, './dir'), - array(Filesystem::MEDIA, 'one/../two'), + array(AppFilesystem::MEDIA_DIR, '/'), + array(AppFilesystem::MEDIA_DIR, '//'), + array(AppFilesystem::MEDIA_DIR, '/value'), + array(AppFilesystem::MEDIA_DIR, 'value/'), + array(AppFilesystem::MEDIA_DIR, '/value/'), + array(AppFilesystem::MEDIA_DIR, 'one\\two'), + array(AppFilesystem::MEDIA_DIR, '../dir'), + array(AppFilesystem::MEDIA_DIR, './dir'), + array(AppFilesystem::MEDIA_DIR, 'one/../two'), ); } @@ -118,14 +129,14 @@ class DirectoryListTest extends \PHPUnit_Framework_TestCase public function testGetUri() { $dir = new DirectoryList(__DIR__, array( - Filesystem::PUB => array('uri' => ''), - Filesystem::MEDIA => array('uri' => 'test'), + AppFilesystem::PUB_DIR => array('uri' => ''), + AppFilesystem::MEDIA_DIR => array('uri' => 'test'), 'custom' => array('uri' => 'test2') )); $this->assertEquals('test2', $dir->getConfig('custom')['uri']); - $this->assertEquals('', $dir->getConfig(Filesystem::PUB)['uri']); - $this->assertEquals('test', $dir->getConfig(Filesystem::MEDIA)['uri']); + $this->assertEquals('', $dir->getConfig(AppFilesystem::PUB_DIR)['uri']); + $this->assertEquals('test', $dir->getConfig(AppFilesystem::MEDIA_DIR)['uri']); } /** @@ -136,29 +147,13 @@ class DirectoryListTest extends \PHPUnit_Framework_TestCase $newRoot = __DIR__ . '/root'; $newMedia = __DIR__ . '/media'; $dir = new DirectoryList(__DIR__, array( - Filesystem::ROOT => array('path' => $newRoot), - Filesystem::MEDIA => array('path' => $newMedia), + AppFilesystem::ROOT_DIR => array('path' => $newRoot), + AppFilesystem::MEDIA_DIR => array('path' => $newMedia), 'custom' => array('path' => 'test2') )); $this->assertEquals('test2', $dir->getDir('custom')); - $this->assertEquals(str_replace('\\', '/', $newRoot), $dir->getConfig(Filesystem::ROOT)['path']); - $this->assertEquals(str_replace('\\', '/', $newMedia), $dir->getConfig(Filesystem::MEDIA)['path']); - } - - /** - * Test that dirs are not affected by custom URIs - */ - public function testGetDirIndependentOfUris() - { - $fixtureUris = array( - Filesystem::PUB => array('uri' => ''), - Filesystem::MEDIA => array('uri' => 'test') - ); - $default = new DirectoryList(__DIR__); - $custom = new DirectoryList(__DIR__, $fixtureUris); - foreach (array_keys($fixtureUris) as $dirCode ) { - $this->assertEquals($default->getConfig($dirCode)['path'], $custom->getConfig($dirCode)['path']); - } + $this->assertEquals(str_replace('\\', '/', $newRoot), $dir->getConfig(AppFilesystem::ROOT_DIR)['path']); + $this->assertEquals(str_replace('\\', '/', $newMedia), $dir->getConfig(AppFilesystem::MEDIA_DIR)['path']); } } diff --git a/dev/tests/unit/testsuite/Magento/Filesystem/Driver/HttpTest.php b/dev/tests/unit/testsuite/Magento/Filesystem/Driver/HttpTest.php index c0ca60889c5..39fb53cdf9e 100644 --- a/dev/tests/unit/testsuite/Magento/Filesystem/Driver/HttpTest.php +++ b/dev/tests/unit/testsuite/Magento/Filesystem/Driver/HttpTest.php @@ -128,13 +128,11 @@ class HttpTest extends \PHPUnit_Framework_TestCase $this->assertEquals($content, (new Http())->fileGetContents('')); } - /** - * @expectedException \Magento\Filesystem\FilesystemException - */ public function testFileGetContentsNoContent() { + $content = ''; self::$fileGetContents = ''; - (new Http())->fileGetContents(''); + $this->assertEquals($content, (new Http())->fileGetContents('')); } public function testFilePutContents() diff --git a/dev/tests/unit/testsuite/Magento/FilesystemTest.php b/dev/tests/unit/testsuite/Magento/FilesystemTest.php index 368d4ee1fb4..f662329737b 100644 --- a/dev/tests/unit/testsuite/Magento/FilesystemTest.php +++ b/dev/tests/unit/testsuite/Magento/FilesystemTest.php @@ -23,6 +23,8 @@ */ namespace Magento; +use Magento\App\Filesystem as AppFilesystem; + class FilesystemTest extends \PHPUnit_Framework_TestCase { /** @var Filesystem */ @@ -34,7 +36,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Filesystem\Directory\WriteFactory|\PHPUnit_Framework_MockObject_MockObject */ protected $_dirWriteFactoryMock; - /** @var \Magento\Filesystem\DirectoryList|\PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\App\Filesystem\DirectoryList|\PHPUnit_Framework_MockObject_MockObject */ protected $_directoryListMock; /** @var \Magento\Filesystem\File\ReadFactory|\PHPUnit_Framework_MockObject_MockObject */ @@ -43,7 +45,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase public function setUp() { $this->_dirReadFactoryMock = $this->getMock('Magento\Filesystem\Directory\ReadFactory', [], [], '', false); - $this->_directoryListMock = $this->getMock('Magento\Filesystem\DirectoryList', [], [], '', false); + $this->_directoryListMock = $this->getMock('Magento\App\Filesystem\DirectoryList', [], [], '', false); $this->_dirWriteFactoryMock = $this->getMock('Magento\Filesystem\Directory\WriteFactory', [], [], '', false); $this->_fileReadFactoryMock = $this->getMock('Magento\Filesystem\File\ReadFactory', [], [], '', false); @@ -61,7 +63,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Filesystem\Directory\ReadInterface $dirReadMock */ $dirReadMock = $this->getMock('Magento\Filesystem\Directory\ReadInterface'); $this->_dirReadFactoryMock->expects($this->once())->method('create')->will($this->returnValue($dirReadMock)); - $this->assertEquals($dirReadMock, $this->_filesystem->getDirectoryRead(Filesystem::ROOT)); + $this->assertEquals($dirReadMock, $this->_filesystem->getDirectoryRead(AppFilesystem::ROOT_DIR)); } /** @@ -70,7 +72,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase public function testGetDirectoryWriteReadOnly() { $this->_setupDirectoryListMock(['read_only' => true]); - $this->_filesystem->getDirectoryWrite(Filesystem::ROOT); + $this->_filesystem->getDirectoryWrite(AppFilesystem::ROOT_DIR); } public function testGetDirectoryWrite() @@ -79,7 +81,7 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Filesystem\Directory\WriteInterface $dirWriteMock */ $dirWriteMock = $this->getMock('Magento\Filesystem\Directory\WriteInterface'); $this->_dirWriteFactoryMock->expects($this->once())->method('create')->will($this->returnValue($dirWriteMock)); - $this->assertEquals($dirWriteMock, $this->_filesystem->getDirectoryWrite(Filesystem::ROOT)); + $this->assertEquals($dirWriteMock, $this->_filesystem->getDirectoryWrite(AppFilesystem::ROOT_DIR)); } public function testGetRemoteResource() @@ -95,17 +97,11 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $this->assertEquals($fileReadMock, $this->_filesystem->getRemoteResource('http://example.com')); } - public function testGetPath() - { - $this->_setupDirectoryListMock(['path' => '\\some\\path']); - $this->assertEquals('/some/path', $this->_filesystem->getPath(Filesystem::ROOT)); - } - public function testGetUri() { $uri = 'http://example.com'; $this->_setupDirectoryListMock(['uri' => $uri]); - $this->assertEquals($uri, $this->_filesystem->getUri(Filesystem::ROOT)); + $this->assertEquals($uri, $this->_filesystem->getUri(AppFilesystem::ROOT_DIR)); } protected function _setupDirectoryListMock(array $config) diff --git a/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ServiceTest.php b/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ServiceTest.php new file mode 100644 index 00000000000..7ec929447d0 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ServiceTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\GoogleShopping\Model; + + +class ServiceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_helper; + + /** + * @var \Magento\GoogleShopping\Model\Service + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_contentMock; + + protected function setUp() + { + $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->_contentMock = $this->getMockBuilder('Magento\Gdata\Gshopping\Content') + ->disableOriginalConstructor() + ->getMock(); + $contentFactoryMock = $this->getMockBuilder('Magento\Gdata\Gshopping\ContentFactory') + ->disableOriginalConstructor() + ->setMethods(array('create')) + ->getMock(); + $contentFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_contentMock)); + + $coreRegistryMock = $this->getMockBuilder('Magento\Core\Model\Registry') + ->disableOriginalConstructor() + ->setMethods(array('registry')) + ->getMock(); + $coreRegistryMock->expects($this->any()) + ->method('registry') + ->will($this->returnValue(1)); + + $arguments = array( + 'contentFactory' => $contentFactoryMock, + 'coreRegistry' => $coreRegistryMock + ); + $this->_model = $this->_helper->getObject('\Magento\GoogleShopping\Model\Service', $arguments); + } + + public function testGetService() + { + $this->assertEquals('Magento\Gdata\Gshopping\Content', get_parent_class($this->_model->getService())); + } + + public function testSetService() + { + $this->_model->setService($this->_contentMock); + $this->assertSame($this->_contentMock, $this->_model->getService()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php new file mode 100644 index 00000000000..174dfe2b40c --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php @@ -0,0 +1,315 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset; + +class GroupedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped + */ + protected $block; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $registryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $coreHelperMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + protected function setUp() + { + $this->registryMock = $this->getMock('\Magento\Core\Model\Registry', array(), array(), '', false); + $this->productMock = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); + $this->coreHelperMock = $this->getMock('\Magento\Core\Helper\Data', array(), array(), '', false); + $this->storeManagerMock = $this->getMock( + '\Magento\Core\Model\StoreManagerInterface', array(), array(), '', false + + ); + + $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->block = $objectHelper->getObject( + 'Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped', + array( + 'registry' => $this->registryMock, + 'storeManager' => $this->storeManagerMock, + 'coreHelper' => $this->coreHelperMock, + 'data' => array( + 'product' => $this->productMock + ) + ) + ); + } + + /** + * @covers Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped::getProduct + */ + public function testGetProductPositive() + { + $instanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false + ); + $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + + $this->productMock->expects($this->any()) + ->method('getTypeInstance') + ->will($this->returnValue($instanceMock)); + + $instanceMock->expects($this->once()) + ->method('getStoreFilter') + ->will($this->returnValue($storeMock)); + + $instanceMock->expects($this->never()) + ->method('setStoreFilter'); + + $this->assertEquals($this->productMock, $this->block->getProduct()); + } + + /** + * @covers Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped::getProduct + */ + public function testGetProductNegative() + { + $storeId = 2; + $instanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false + ); + $storeMock = $this->getMock('\Magento\Core\Model\Store', array(), array(), '', false); + + $this->productMock->expects($this->any()) + ->method('getTypeInstance') + ->will($this->returnValue($instanceMock)); + + $instanceMock->expects($this->once()) + ->method('getStoreFilter') + ->with($this->productMock) + ->will($this->returnValue(null)); + + $this->productMock->expects($this->once()) + ->method('getStoreId') + ->will($this->returnValue($storeId)); + + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->with($storeId) + ->will($this->returnValue($storeMock)); + + $instanceMock->expects($this->once()) + ->method('setStoreFilter') + ->with($storeMock, $this->productMock); + + $this->assertEquals($this->productMock, $this->block->getProduct()); + } + + /** + * @covers Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped::getAssociatedProducts + */ + public function testGetAssociatedProducts() + { + $storeId = 2; + + $instanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false + ); + + $this->productMock->expects($this->any()) + ->method('getTypeInstance') + ->will($this->returnValue($instanceMock)); + + $associatedProduct = clone($this->productMock); + + $associatedProduct->expects($this->once()) + ->method('setStoreId') + ->with($storeId); + + $instanceMock->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->productMock) + ->will($this->returnValue(array($associatedProduct))); + + $this->productMock->expects($this->any()) + ->method('getStoreId') + ->will($this->returnValue($storeId)); + + $this->assertEquals(array($associatedProduct), $this->block->getAssociatedProducts()); + } + + /** + * @covers Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped::setPreconfiguredValue + */ + public function testSetPreconfiguredValue() + { + $storeId = 2; + + $objectMock = $this->getMock('\Magento\Object', array('getSuperGroup'), array(), '', false); + $instanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false + ); + + $objectMock->expects($this->once()) + ->method('getSuperGroup') + ->will($this->returnValue(array())); + + $this->productMock->expects($this->once()) + ->method('getPreconfiguredValues') + ->will($this->returnValue($objectMock)); + + $this->productMock->expects($this->any()) + ->method('getTypeInstance') + ->will($this->returnValue($instanceMock)); + + $associatedProduct = clone($this->productMock); + + $associatedProduct->expects($this->once()) + ->method('setStoreId') + ->with($storeId); + + $instanceMock->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->productMock) + ->will($this->returnValue(array($associatedProduct))); + + $this->productMock->expects($this->any()) + ->method('getStoreId') + ->will($this->returnValue($storeId)); + + $this->assertEquals($this->block, $this->block->setPreconfiguredValue()); + } + + /** + * @covers Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped::getCanShowProductPrice + */ + public function testGetCanShowProductPrice() + { + $this->assertEquals(true, $this->block->getCanShowProductPrice($this->productMock)); + } + + /** + * @covers Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped::getIsLastFieldset + */ + public function testGetIsLastFieldsetPositive() + { + $this->block->setData('is_last_fieldset', true); + + $this->productMock->expects($this->never()) + ->method('getOptions'); + + $this->assertEquals(true, $this->block->getIsLastFieldset()); + } + + /** + * @param array|bool $options + * @param bool $expectedResult + * + * @covers Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped::getIsLastFieldset + * @dataProvider getIsLastFieldsetDataProvider + */ + public function testGetIsLastFieldsetNegative($options, $expectedResult) + { + $instanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false + ); + + $this->block->setData('is_last_fieldset', false); + + $this->productMock->expects($this->once()) + ->method('getOptions') + ->will($this->returnValue($options)); + + $this->productMock->expects($this->any()) + ->method('getTypeInstance') + ->will($this->returnValue($instanceMock)); + + $instanceMock->expects($this->once()) + ->method('getStoreFilter') + ->will($this->returnValue(true)); + + $this->assertEquals($expectedResult, $this->block->getIsLastFieldset()); + } + + /** + * Data provider for testGetIsLastFieldsetNegative + * + * @return array + */ + public function getIsLastFieldsetDataProvider() + { + return array( + 'case1' => array( + 'options' => false, + 'expectedResult' => true + ), + 'case2' => array( + 'options' => array('option'), + 'expectedResult' => false + ) + ); + } + + /** + * @covers Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped::getCurrencyPrice + */ + public function testGetCurrencyPrice() + { + $storeId = 2; + $price = 1.22; + $expectedPrice = 1; + + $instanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false + ); + + $this->productMock->expects($this->any()) + ->method('getTypeInstance') + ->will($this->returnValue($instanceMock)); + + $instanceMock->expects($this->once()) + ->method('getStoreFilter') + ->will($this->returnValue(true)); + + $this->productMock->expects($this->once()) + ->method('getStore') + ->will($this->returnValue($storeId)); + + $this->coreHelperMock->expects($this->once()) + ->method('currencyByStore') + ->with($price, $storeId, false) + ->will($this->returnValue($expectedPrice)); + + $this->assertEquals($expectedPrice, $this->block->getCurrencyPrice($price)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php new file mode 100644 index 00000000000..b721ea04d0b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProducts/ListAssociatedProductsTest.php @@ -0,0 +1,154 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts; + +class ListAssociatedProductsTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $contextMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $registryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $typeInstanceMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $storeMock; + + /** + * @var \Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts + */ + protected $block; + + protected function setUp() + { + $this->contextMock = $this->getMock('Magento\Backend\Block\Template\Context', array(), array(), '', false); + $this->registryMock = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $this->productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $this->storeMock = $this->getMock('Magento\Core\Model\Store', array(), array(), '', false); + $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->typeInstanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false + ); + + $this->contextMock->expects($this->any()) + ->method('getStoreManager') + ->will($this->returnValue($this->storeManagerMock)); + + $this->block = new ListAssociatedProducts($this->contextMock, $this->registryMock); + } + + /** + * @covers Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts\ListAssociatedProducts + * ::getAssociatedProducts + */ + public function testGetAssociatedProducts() + { + $this->storeMock->expects($this->any()) + ->method('formatPrice') + ->with('1.00', false) + ->will($this->returnValue('1')); + + $this->storeManagerMock->expects($this->any()) + ->method('getStore') + ->will($this->returnValue($this->storeMock)); + + $this->productMock->expects($this->once()) + ->method('getTypeInstance') + ->will($this->returnValue($this->typeInstanceMock)); + + $this->registryMock->expects($this->once()) + ->method('registry') + ->with('current_product') + ->will($this->returnValue($this->productMock)); + + $this->typeInstanceMock->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->productMock) + ->will($this->returnValue(array($this->generateAssociatedProduct(1), $this->generateAssociatedProduct(2)))); + + $expectedResult = array( + '0' => array( + 'id' => 'id1', + 'sku' => 'sku1', + 'name' => 'name1', + 'qty' => 1, + 'position' => 1, + 'price' => '1' + ), + '1' => array( + 'id' => 'id2', + 'sku' => 'sku2', + 'name' => 'name2', + 'qty' => 2, + 'position' => 2, + 'price' => '1' + ) + ); + + $this->assertEquals($expectedResult, $this->block->getAssociatedProducts()); + } + + /** + * Generate associated product mock + * + * @param int $productKey + * @return \PHPUnit_Framework_MockObject_MockObject + */ + protected function generateAssociatedProduct($productKey = 0) + { + $associatedProduct = $this->getMock('Magento\Object', + array('getQty', 'getPosition', 'getId', 'getSku', 'getName', 'getPrice'), array(), '', false + ); + + $associatedProduct->expects($this->once())->method('getId')->will($this->returnValue('id' . $productKey)); + $associatedProduct->expects($this->once())->method('getSku')->will($this->returnValue('sku' . $productKey)); + $associatedProduct->expects($this->once())->method('getName')->will($this->returnValue('name' . $productKey)); + $associatedProduct->expects($this->once())->method('getQty')->will($this->returnValue($productKey)); + $associatedProduct->expects($this->once())->method('getPosition')->will($this->returnValue($productKey)); + $associatedProduct->expects($this->once())->method('getPrice')->will($this->returnValue('1.00')); + + return $associatedProduct; + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProductsTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProductsTest.php new file mode 100644 index 00000000000..6cc201d240d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/Grouped/AssociatedProductsTest.php @@ -0,0 +1,60 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Block\Product\Grouped; + +class AssociatedProductsTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $contextMock; + + /** + * @var \Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts + */ + protected $block; + + protected function setUp() + { + $this->contextMock = $this->getMock('\Magento\Backend\Block\Template\Context', array(), array(), '', false); + $this->block = new AssociatedProducts($this->contextMock); + } + + /** + * @covers Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts::getParentTab + */ + public function testGetParentTab() + { + $this->assertEquals('product-details', $this->block->getParentTab()); + } + + /** + * @covers Magento\GroupedProduct\Block\Product\Grouped\AssociatedProducts::getTabLabel + */ + public function testGetTabLabel() + { + $this->assertEquals('Grouped Products', $this->block->getTabLabel()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/View/Type/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/View/Type/GroupedTest.php new file mode 100644 index 00000000000..8a71935a662 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Product/View/Type/GroupedTest.php @@ -0,0 +1,194 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Block\Product\View\Type; + +class GroupedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\GroupedProduct\Block\Product\View\Type\Grouped + */ + protected $groupedView; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $typeInstanceMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $configuredValueMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $blockMock; + + /** + * @var string + */ + protected $defaultTemplate = 'product/view/tierprices.phtml'; + + protected function setUp() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $methodsProduct = array( + 'getId', 'setQty', 'getTypeInstance', 'getPreconfiguredValues', 'getTypeId', '__wakeup' + ); + $this->productMock = $this->getMock('Magento\Catalog\Model\Product', $methodsProduct, array(), '', false); + $this->typeInstanceMock = + $this->getMock('Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false); + $this->productMock + ->expects($this->any()) + ->method('getTypeInstance') + ->will($this->returnValue($this->typeInstanceMock)); + $this->configuredValueMock = $this->getMock('Magento\Object', array('getSuperGroup'), array(), '', false); + // mocks for getTierPriceHtml method + $methods = array('setTemplate', 'setProduct', 'setListClass', + 'setShowDetailedPrice', 'setCanDisplayQty','toHtml'); + $this->blockMock = $this->getMock('Magento\Catalog\Block\Product\Price', $methods, array(), '', false); + $layout = $this->getMock('Magento\View\LayoutInterface'); + $layout->expects($this->any())->method('createBlock')->will($this->returnValue($this->blockMock)); + $this->groupedView = $helper->getObject('Magento\GroupedProduct\Block\Product\View\Type\Grouped', array( + 'data' => array('product' => $this->productMock, + 'tier_price_template' => $this->defaultTemplate), + 'priceBlockTypes' => array('product_id' => array('block' => $this->blockMock)), + 'layout' => $layout + ) + ); + } + + public function testGetAssociatedProducts() + { + + $this->typeInstanceMock + ->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->productMock) + ->will($this->returnValue('expected')); + + $this->assertEquals('expected', $this->groupedView->getAssociatedProducts()); + } + + /** + * @param string $id + * @dataProvider setPreconfiguredValueDataProvider + */ + public function testSetPreconfiguredValue($id) + { + $configValue = array('id_one' => 2); + $associatedProduct = array('key' => $this->productMock); + $this->configuredValueMock + ->expects($this->once()) + ->method('getSuperGroup') + ->will($this->returnValue($configValue)); + $this->productMock + ->expects($this->once()) + ->method('getPreconfiguredValues') + ->will($this->returnValue($this->configuredValueMock)); + + $this->typeInstanceMock + ->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->productMock) + ->will($this->returnValue($associatedProduct)); + + + $this->productMock->expects($this->any())->method('getId')->will($this->returnValue($id)); + $this->productMock->expects($this->any())->method('setQty')->with(2); + $this->groupedView->setPreconfiguredValue(); + } + + public function setPreconfiguredValueDataProvider() + { + return array( + 'item_id_exist_in_config' => array('id_one'), + 'item_id_not_exist_in_config' => array('id_two') + ); + } + + public function testSetPreconfiguredValueIfSuperGroupNotExist() + { + $this->productMock + ->expects($this->once()) + ->method('getPreconfiguredValues') + ->will($this->returnValue($this->configuredValueMock)); + $this->configuredValueMock + ->expects($this->once()) + ->method('getSuperGroup') + ->will($this->returnValue(false)); + $this->typeInstanceMock->expects($this->never())->method('getAssociatedProducts'); + $this->groupedView->setPreconfiguredValue(); + } + + /** + * @param null|PHPUnit_Framework_MockObject_MockObject $price + * @dataProvider getTierPriceHtmlDataProvider + */ + public function testGetTierPriceHtml($price) + { + $this->productMock->expects($this->any())->method('getTypeId')->will($this->returnValue('product_id')); + $this->blockMock->expects($this->once()) + ->method('setTemplate')->with($this->defaultTemplate)->will($this->returnValue($this->blockMock)); + $this->blockMock + ->expects($this->once()) + ->method('setProduct') + ->with($this->productMock) + ->will($this->returnValue($this->blockMock)); + $this->blockMock + ->expects($this->once()) + ->method('setListClass') + ->with('tier prices grouped items') + ->will($this->returnValue($this->blockMock)); + $this->blockMock + ->expects($this->once()) + ->method('setShowDetailedPrice') + ->with(false) + ->will($this->returnValue($this->blockMock)); + $this->blockMock + ->expects($this->once()) + ->method('setCanDisplayQty') + ->with(false) + ->will($this->returnValue($this->blockMock)); + $this->blockMock + ->expects($this->once()) + ->method('toHtml') + ->will($this->returnValue('expected')); + $this->assertEquals('expected', $this->groupedView->getTierPriceHtml($price)); + } + + public function getTierPriceHtmlDataProvider() + { + return array( + 'if_use_default_value_for_method' => array(null), + 'if_pice_exist' => array($this->productMock) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/EditTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/EditTest.php new file mode 100644 index 00000000000..f769660df1e --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/EditTest.php @@ -0,0 +1,135 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Controller\Adminhtml; + +class EditTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + /** + * @var \Magento\GroupedProduct\Controller\Adminhtml\Edit + */ + protected $controller; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $request; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $factory; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $registry; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $view; + + protected function setUp() + { + $this->request = $this->getMock('Magento\App\RequestInterface', array(), array(), '', false); + $this->factory = $this->getMock('Magento\Catalog\Model\ProductFactory', array('create'), array(), '', false); + $this->registry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $this->view = $this->getMock('Magento\App\ViewInterface', array(), array(), '', false); + + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->controller = $this->objectManager->getObject( + '\Magento\GroupedProduct\Controller\Adminhtml\Edit', + array( + 'request' => $this->request, + 'factory' => $this->factory, + 'registry' => $this->registry, + 'view' => $this->view, + ) + ); + } + + public function testPopupActionNoProductId() + { + $storeId = 12; + $typeId = 4; + $productId = null; + $setId = 0; + $product = $this->getMock('Magento\Catalog\Model\Product', + array('setStoreId', 'setTypeId', 'setData', '__wakeup'), + array(), '', false); + + $this->request->expects($this->at(0))->method('getParam')->with('id')->will($this->returnValue($productId)); + $this->factory->expects($this->once())->method('create')->will($this->returnValue($product)); + $this->request->expects($this->at(1))->method('getParam') + ->with('store', 0)->will($this->returnValue($storeId)); + + $product->expects($this->once())->method('setStoreId')->with($storeId); + $this->request->expects($this->at(2))->method('getParam') + ->with('type')->will($this->returnValue($typeId)); + $product->expects($this->once())->method('setTypeId')->with($typeId); + $product->expects($this->once())->method('setData')->with('_edit_mode', true); + $this->request->expects($this->at(3))->method('getParam')->with('set')->will($this->returnValue($setId)); + $this->registry->expects($this->once())->method('register')->with('current_product', $product); + + $this->view->expects($this->once())->method('loadLayout')->with(false); + $this->view->expects($this->once())->method('renderLayout'); + + $this->controller->popupAction(); + } + + public function testPopupActionWithProductIdNoSetId() + { + $storeId = 12; + $typeId = 4; + $setId = 0; + $productId = 399; + $product = $this->getMock('Magento\Catalog\Model\Product', + array('setStoreId', 'setTypeId', 'setData', 'load', '__wakeup'), + array(), '', false); + + $this->request->expects($this->at(0))->method('getParam')->with('id')->will($this->returnValue($productId)); + $this->factory->expects($this->once())->method('create')->will($this->returnValue($product)); + $this->request->expects($this->at(1))->method('getParam') + ->with('store', 0)->will($this->returnValue($storeId)); + $product->expects($this->once())->method('setStoreId')->with($storeId); + $this->request->expects($this->at(2))->method('getParam') + ->with('type')->will($this->returnValue($typeId)); + $product->expects($this->never())->method('setTypeId'); + $product->expects($this->once())->method('setData')->with('_edit_mode', true); + $product->expects($this->once())->method('load')->with($productId); + $this->request->expects($this->at(3))->method('getParam')->with('set')->will($this->returnValue($setId)); + $this->registry->expects($this->once())->method('register')->with('current_product', $product); + + $this->view->expects($this->once())->method('loadLayout')->with(false); + $this->view->expects($this->once())->method('renderLayout'); + + $this->controller->popupAction(); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks/Plugin/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks/Plugin/GroupedTest.php new file mode 100644 index 00000000000..fb8b489fb4a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Controller/Adminhtml/Product/Initialization/Helper/ProductLinks/Plugin/GroupedTest.php @@ -0,0 +1,89 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Controller\Adminhtml\Product\Initialization\Helper\ProductLinks\Plugin; + +class GroupedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\GroupedProduct\Controller\Adminhtml\Product\Initialization\Helper\ProductLinks\Plugin\Grouped + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $requestMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + protected function setUp() + { + $this->requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $this->productMock= $this->getMock('Magento\Catalog\Model\Product', + array('getGroupedReadonly', 'setGroupedLinkData', '__wakeup'), array(), '', false); + + $this->model = new Grouped($this->requestMock); + } + + public function testAfterInitializeLinksRequestDoesNotHaveGrouped() + { + $this->requestMock->expects($this->once())->method('getPost')->with('links')->will($this->returnValue(array())); + $this->productMock->expects($this->never())->method('getGroupedReadonly'); + $this->productMock->expects($this->never())->method('setGroupedLinkData'); + $this->model->afterInitializeLinks($this->productMock); + } + + public function testAfterInitializeLinksRequestHasGrouped() + { + $this->requestMock->expects($this->once()) + ->method('getPost') + ->with('links') + ->will($this->returnValue(array('grouped' => 'value'))); + + $this->productMock->expects($this->once()) + ->method('getGroupedReadonly') + ->will($this->returnValue(false)); + $this->productMock->expects($this->once())->method('setGroupedLinkData')->with(array('value')); + $this->model->afterInitializeLinks($this->productMock); + } + + public function testAfterInitializeLinksProductIsReadonly() + { + $this->requestMock->expects($this->once()) + ->method('getPost') + ->with('links') + ->will($this->returnValue(array('grouped' => 'value'))); + + $this->productMock->expects($this->once()) + ->method('getGroupedReadonly') + ->will($this->returnValue(true)); + $this->productMock->expects($this->never())->method('setGroupedLinkData'); + $this->model->afterInitializeLinks($this->productMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Helper/Product/Configuration/Plugin/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Helper/Product/Configuration/Plugin/GroupedTest.php new file mode 100644 index 00000000000..3f046d0e329 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Helper/Product/Configuration/Plugin/GroupedTest.php @@ -0,0 +1,188 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Helper\Product\Configuration\Plugin; + +class GroupedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\GroupedProduct\Helper\Product\Configuration\Plugin\Grouped + */ + protected $groupedConfigPlugin; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $invocationChainMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $itemMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $typeInstanceMock; + + /** + * @var array + */ + protected $inputArguments; + + protected function setUp() + { + $this->groupedConfigPlugin = new Grouped(); + + $this->invocationChainMock = $this->getMock('Magento\Code\Plugin\InvocationChain', array(), array(), '', false); + $this->itemMock = $this->getMock('Magento\Catalog\Model\Product\Configuration\Item\ItemInterface'); + $this->productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $this->typeInstanceMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false + ); + + $this->itemMock->expects($this->any()) + ->method('getProduct') + ->will($this->returnValue($this->productMock)); + + $this->productMock->expects($this->any()) + ->method('getTypeInstance') + ->will($this->returnValue($this->typeInstanceMock)); + + $this->inputArguments = array('item' => $this->itemMock); + } + + /** + * @covers Magento\GroupedProduct\Helper\Product\Configuration\Plugin\Grouped::aroundGetOptions + */ + public function testAroundGetOptionsGroupedProductWithAssociated() + { + $associatedProductId = 'associatedId'; + $associatedProdName = 'associatedProductName'; + + $associatedProdMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + + $associatedProdMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue($associatedProductId)); + + $associatedProdMock->expects($this->once()) + ->method('getName') + ->will($this->returnValue($associatedProdName)); + + $this->typeInstanceMock->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->productMock) + ->will($this->returnValue(array($associatedProdMock))); + + $this->productMock->expects($this->once()) + ->method('getTypeId') + ->will($this->returnValue(\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE)); + + $quantityItemMock = $this->getMock( + 'Magento\Catalog\Model\Product\Configuration\Item\ItemInterface', + array('getValue', 'getProduct', 'getOptionByCode', 'getFileDownloadParams') + ); + + $quantityItemMock->expects($this->any()) + ->method('getValue') + ->will($this->returnValue(1)); + + $this->itemMock->expects($this->once()) + ->method('getOptionByCode') + ->with('associated_product_' . $associatedProductId) + ->will($this->returnValue($quantityItemMock)); + + $this->invocationChainMock->expects($this->once()) + ->method('proceed') + ->with($this->inputArguments) + ->will($this->returnValue(array(array('label' => 'productName', 'value' => 2)))); + + $result = $this->groupedConfigPlugin->aroundGetOptions($this->inputArguments, $this->invocationChainMock); + $expectedResult = array( + array( + 'label' => 'associatedProductName', + 'value' => 1 + ), + array( + 'label' => 'productName', + 'value' => 2 + ) + ); + $this->assertEquals($expectedResult, $result); + } + + /** + * @covers Magento\GroupedProduct\Helper\Product\Configuration\Plugin\Grouped::aroundGetOptions + */ + public function testAroundGetOptionsGroupedProductWithoutAssociated() + { + $this->typeInstanceMock->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->productMock) + ->will($this->returnValue(false)); + + $this->productMock->expects($this->once()) + ->method('getTypeId') + ->will($this->returnValue(\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE)); + + $chainCallResult = array(array('label' => 'label', 'value' => 'value')); + + $this->invocationChainMock->expects($this->once()) + ->method('proceed') + ->with($this->inputArguments) + ->will($this->returnValue($chainCallResult)); + + $result = $this->groupedConfigPlugin->aroundGetOptions($this->inputArguments, $this->invocationChainMock); + $this->assertEquals($chainCallResult, $result); + } + + /** + * @covers Magento\GroupedProduct\Helper\Product\Configuration\Plugin\Grouped::aroundGetOptions + */ + public function testAroundGetOptionsAnotherProductType() + { + $chainCallResult = array('result'); + + $this->productMock->expects($this->once()) + ->method('getTypeId') + ->will($this->returnValue('other_product_type')); + + $this->invocationChainMock->expects($this->once()) + ->method('proceed') + ->with($this->inputArguments) + ->will($this->returnValue($chainCallResult)); + + $this->productMock->expects($this->never()) + ->method('getTypeInstance'); + + $result = $this->groupedConfigPlugin->aroundGetOptions($this->inputArguments, $this->invocationChainMock); + $this->assertEquals($chainCallResult, $result); + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/CopyConstructor/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/CopyConstructor/GroupedTest.php new file mode 100644 index 00000000000..1c278958e61 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/CopyConstructor/GroupedTest.php @@ -0,0 +1,149 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Model\Product\CopyConstructor; + +class GroupedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\GroupedProduct\Model\Product\CopyConstructor\Grouped + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_productMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_duplicateMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_linkCollectionMock; + + protected function setUp() + { + $this->_model = new \Magento\GroupedProduct\Model\Product\CopyConstructor\Grouped(); + + $this->_productMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array('getTypeId', '__wakeup', 'getLinkInstance'), + array(), + '', + false + ); + + $this->_duplicateMock = $this->getMock( + '\Magento\Catalog\Model\Product', + array('setGroupedLinkData', '__wakeup'), + array(), + '', + false + ); + + $this->_linkMock = $this->getMock( + '\Magento\Catalog\Model\Product\Link', + array('setLinkTypeId', '__wakeup', 'getAttributes', 'getLinkCollection'), + array(), + '', + false + ); + + $this->_productMock->expects($this->any()) + ->method('getLinkInstance') + ->will($this->returnValue($this->_linkMock)); + } + + public function testBuildWithNonGroupedProductType() + { + $this->_productMock->expects($this->once())->method('getTypeId')->will($this->returnValue('some value')); + + $this->_duplicateMock->expects($this->never())->method('setGroupedLinkData'); + + $this->_model->build($this->_productMock, $this->_duplicateMock); + } + + public function testBuild() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $expectedData = array( + '100500' => array('some' => 'data') + ); + + $this->_productMock->expects($this->once()) + ->method('getTypeId') + ->will($this->returnValue(\Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE)); + + $attributes = array( + 'attributeOne' => array('code' => 'one'), + 'attributeTwo' => array('code' => 'two'), + ); + + $this->_linkMock->expects($this->once())->method('getAttributes')->will($this->returnValue($attributes)); + + $productLinkMock = $this->getMock( + '\Magento\Catalog\Model\Resource\Product\Link', + array('__wakeup', 'getLinkedProductId', 'toArray'), + array(), + '', + false + ); + $this->_linkMock->expects($this->atLeastOnce())->method('setLinkTypeId') + ->with(\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED); + + $productLinkMock->expects($this->once())->method('getLinkedProductId')->will($this->returnValue('100500')); + $productLinkMock->expects($this->once()) + ->method('toArray') + ->with(array('one', 'two')) + ->will($this->returnValue(array('some' => 'data'))); + + $collectionMock = $helper->getCollectionMock( + '\Magento\Catalog\Model\Resource\Product\Link\Collection', + array($productLinkMock) + ); + $collectionMock->expects($this->once())->method('setProduct')->with($this->_productMock); + $collectionMock->expects($this->once())->method('addLinkTypeIdFilter'); + $collectionMock->expects($this->once())->method('addProductIdFilter'); + $collectionMock->expects($this->once())->method('joinAttributes'); + + $this->_linkMock->expects($this->once()) + ->method('getLinkCollection') + ->will($this->returnValue($collectionMock)); + + $this->_duplicateMock->expects($this->once()) + ->method('setGroupedLinkData') + ->with($expectedData); + + $this->_model->build($this->_productMock, $this->_duplicateMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/Grouped/PriceTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/Grouped/PriceTest.php new file mode 100644 index 00000000000..2f555f06546 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/Grouped/PriceTest.php @@ -0,0 +1,194 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Model\Product\Type\Grouped; + +class PriceTest extends \PHPUnit_Framework_TestCase +{ + + /** + * @var \Magento\GroupedProduct\Model\Product\Type\Grouped\Price + */ + protected $finalPriceModel; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productMock; + + protected function setUp() + { + $this->productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + $this->finalPriceModel = $helper->getObject('Magento\GroupedProduct\Model\Product\Type\Grouped\Price', array()); + } + + /** + * @covers Magento\GroupedProduct\Model\Product\Type\Grouped\Price::getFinalPrice + */ + public function testGetFinalPriceIfQtyIsNullAndFinalPriceExist() + { + $finalPrice = 15; + + $this->productMock->expects($this->any()) + ->method('getCalculatedFinalPrice') + ->will($this->returnValue($finalPrice)); + + $this->productMock->expects($this->never()) + ->method('hasCustomOptions'); + + $this->assertEquals($finalPrice, $this->finalPriceModel->getFinalPrice(null, $this->productMock)); + } + + /** + * @param array $associatedProducts + * @param array $options + * @param $expectedPriceCall + * @param $expectedFinalPrice + * + * @dataProvider getFinalPriceDataProvider + * @covers Magento\GroupedProduct\Model\Product\Type\Grouped\Price::getFinalPrice + */ + public function testGetFinalPrice( + array $associatedProducts, array $options, $expectedPriceCall, $expectedFinalPrice + ) { + $rawFinalPrice = 10; + $rawPriceCheckStep = 10; + + $this->productMock->expects($this->any()) + ->method('getCalculatedFinalPrice') + ->will($this->returnValue($rawFinalPrice)); + + //mock for parent::getFinal price call + $this->productMock->expects($this->any()) + ->method('getPrice') + ->will($this->returnValue($rawFinalPrice)); + + $this->productMock->expects($this->at($rawPriceCheckStep)) + ->method('setFinalPrice') + ->with($rawFinalPrice) + ->will($this->returnValue($this->productMock)); + + $this->productMock->expects($this->at($expectedPriceCall)) + ->method('setFinalPrice') + ->with($expectedFinalPrice); + + $this->productMock->expects($this->any()) + ->method('getData') + ->with('final_price') + ->will($this->returnValue($rawFinalPrice)); + + //test method + $this->productMock->expects($this->once()) + ->method('hasCustomOptions') + ->will($this->returnValue(true)); + + $productTypeMock = $this->getMock( + 'Magento\GroupedProduct\Model\Product\Type\Grouped', array(), array(), '', false + ); + + $this->productMock->expects($this->once()) + ->method('getTypeInstance') + ->will($this->returnValue($productTypeMock)); + + $this->productMock->expects($this->any()) + ->method('getStore') + ->will($this->returnValue('store1')); + + $productTypeMock->expects($this->once()) + ->method('setStoreFilter') + ->with('store1', $this->productMock) + ->will($this->returnValue($productTypeMock)); + + $productTypeMock->expects($this->once()) + ->method('getAssociatedProducts') + ->with($this->productMock) + ->will($this->returnValue($associatedProducts)); + + $this->productMock->expects($this->any()) + ->method('getCustomOption') + ->will($this->returnValueMap($options)); + + $this->assertEquals($rawFinalPrice, $this->finalPriceModel->getFinalPrice(1, $this->productMock)); + } + + /** + * Data provider for testGetFinalPrice + * + * @return array + */ + public function getFinalPriceDataProvider() + { + $optionMock = $this->getMock( + 'Magento\Catalog\Model\Product\Option', array('getValue', '__wakeup'), array(), '', false + ); + /* quantity of options */ + $optionMock->expects($this->any())->method('getValue')->will($this->returnValue(5)); + + return array( + 'custom_option_null' => array( + 'associatedProducts' => array(), + 'options' => array( + array(), + array() + ), + 'expectedPriceCall' => 14, /* product call number to check final price formed correctly */ + 'expectedFinalPrice' => 10 /* 10(product price) + 2(options count) * 5(qty) * 5(option price) */ + ), + 'custom_option_exist' => array( + 'associatedProducts' => $this->generateAssociatedProducts(), + 'options' => array( + array('associated_product_1', false), + array('associated_product_2', $optionMock), + array('associated_product_3', $optionMock) + ), + 'expectedPriceCall' => 17, /* product call number to check final price formed correctly */ + 'expectedFinalPrice' => 35 /* 10(product price) + 2(options count) * 5(qty) * 5(option price) */ + ) + ); + } + + /** + * Generate associated product for every custom option + * + * @return array + */ + protected function generateAssociatedProducts() + { + $childProductMock = $this->getMock( + 'Magento\Catalog\Model\Product', array('getId', 'getFinalPrice', '__wakeup'), array(), '', false + ); + /* price for option taking into account quantity discounts */ + $childProductMock->expects($this->any())->method('getFinalPrice')->with(5)->will($this->returnValue(5)); + + for ($i = 0; $i <= 2; $i ++) { + $childProduct = clone($childProductMock); + $childProduct->expects($this->once())->method('getId')->will($this->returnValue($i)); + $associatedProducts[] = $childProduct; + } + + return $associatedProducts; + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php new file mode 100644 index 00000000000..dada066bdde --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php @@ -0,0 +1,261 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_GroupedProduct + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Model\Product\Type; + +class GroupedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\GroupedProduct\Model\Product\Type\Grouped + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $catalogProductLink; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $product; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $productStatusMock; + + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectHelper; + + protected function setUp() + { + $this->objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); + $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); + $coreDataMock = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); + $fileStorageDbMock = $this->getMock('Magento\Core\Helper\File\Storage\Database', array(), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); + $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); + $this->product = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); + $productFactoryMock = $this->getMock('Magento\Catalog\Model\ProductFactory', array(), array(), '', false); + $this->catalogProductLink = $this->getMock('\Magento\GroupedProduct\Model\Resource\Product\Link', + array(), array(), '', false); + $this->productStatusMock = $this->getMock('\Magento\Catalog\Model\Product\Status', + array(), array(), '', false); + $this->_model = $this->objectHelper->getObject('Magento\GroupedProduct\Model\Product\Type\Grouped', array( + 'eventManager' => $eventManager, + 'coreData' => $coreDataMock, + 'fileStorageDb' => $fileStorageDbMock, + 'filesystem' => $filesystem, + 'coreRegistry' => $coreRegistry, + 'logger' => $logger, + 'productFactory' => $productFactoryMock, + 'catalogProductLink' => $this->catalogProductLink, + 'catalogProductStatus' => $this->productStatusMock, + )); + } + + public function testHasWeightFalse() + { + $this->assertFalse($this->_model->hasWeight(), 'This product has weight, but it should not'); + } + + public function testGetChildrenIds() + { + $parentId = 12345; + $childrenIds = array(100, 200, 300); + $this->catalogProductLink->expects($this->once())->method('getChildrenIds') + ->with($parentId, \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED) + ->will($this->returnValue($childrenIds)); + $this->assertEquals($childrenIds, $this->_model->getChildrenIds($parentId)); + } + + public function testGetParentIdsByChild() + { + $childId = 12345; + $parentIds = array(100, 200, 300); + $this->catalogProductLink->expects($this->once())->method('getParentIdsByChild') + ->with($childId, \Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED) + ->will($this->returnValue($parentIds)); + $this->assertEquals($parentIds, $this->_model->getParentIdsByChild($childId)); + } + + public function testGetAssociatedProducts() + { + $cached = true; + $associatedProducts = array(5, 7, 11, 13, 17); + $this->product->expects($this->once())->method('hasData')->will($this->returnValue($cached)); + $this->product->expects($this->once())->method('getData')->will($this->returnValue($associatedProducts)); + $this->assertEquals($associatedProducts, $this->_model->getAssociatedProducts($this->product)); + } + + /** + * @param int $status + * @param array $filters + * @param array $result + * @dataProvider addStatusFilterDataProvider + */ + public function testAddStatusFilter($status, $filters, $result) + { + $this->product->expects($this->once())->method('getData')->will($this->returnValue($filters)); + $this->product->expects($this->once())->method('setData') + ->with('_cache_instance_status_filters', $result); + $this->assertEquals($this->_model, $this->_model->addStatusFilter($status, $this->product)); + } + + /** + * @return array + */ + public function addStatusFilterDataProvider() + { + return array( + array(1, array(), array(1)), + array(1, false, array(1)), + ); + } + + public function testSetSaleableStatus() + { + $key = '_cache_instance_status_filters'; + $saleableIds = array(300, 800, 500); + + $this->productStatusMock->expects($this->once())->method('getSaleableStatusIds') + ->will($this->returnValue($saleableIds)); + $this->product->expects($this->once())->method('setData')->with($key, $saleableIds); + $this->assertEquals($this->_model, $this->_model->setSaleableStatus($this->product)); + } + + public function testGetStatusFiltersNoData() + { + $result = array( + \Magento\Catalog\Model\Product\Status::STATUS_ENABLED, + \Magento\Catalog\Model\Product\Status::STATUS_DISABLED + ); + $this->product->expects($this->once())->method('hasData')->will($this->returnValue(false)); + $this->assertEquals($result, $this->_model->getStatusFilters($this->product)); + } + + public function testGetStatusFiltersWithData() + { + $result = array( + \Magento\Catalog\Model\Product\Status::STATUS_ENABLED, + \Magento\Catalog\Model\Product\Status::STATUS_DISABLED + ); + $this->product->expects($this->once())->method('hasData')->will($this->returnValue(true)); + $this->product->expects($this->once())->method('getData')->will($this->returnValue($result)); + $this->assertEquals($result, $this->_model->getStatusFilters($this->product)); + } + + public function testGetAssociatedProductIdsCached() + { + $key = '_cache_instance_associated_product_ids'; + $cachedData = array(300, 303, 306); + + $this->product->expects($this->once())->method('hasData')->with($key)->will($this->returnValue(true)); + $this->product->expects($this->never())->method('setData'); + $this->product->expects($this->once())->method('getData')->with($key)->will($this->returnValue($cachedData)); + + $this->assertEquals($cachedData, $this->_model->getAssociatedProductIds($this->product)); + } + + public function testGetAssociatedProductIdsNonCached() + { + $args = $this->objectHelper->getConstructArguments( + '\Magento\GroupedProduct\Model\Product\Type\Grouped', + array() + ); + + /** @var \Magento\GroupedProduct\Model\Product\Type\Grouped $model */ + $model = $this->getMock( + '\Magento\GroupedProduct\Model\Product\Type\Grouped', + array('getAssociatedProducts'), + $args + ); + + $associatedProduct = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $model->expects($this->once())->method('getAssociatedProducts') + ->with($this->product)->will($this->returnValue(array($associatedProduct))); + + $associatedId = 9384; + $key = '_cache_instance_associated_product_ids'; + $associatedIds = array($associatedId); + $associatedProduct->expects($this->once())->method('getId')->will($this->returnValue($associatedId)); + + $this->product->expects($this->once())->method('hasData')->with($key)->will($this->returnValue(false)); + $this->product->expects($this->once())->method('setData')->with($key, $associatedIds); + $this->product->expects($this->once())->method('getData')->with($key)->will($this->returnValue($associatedIds)); + + $this->assertEquals($associatedIds, $model->getAssociatedProductIds($this->product)); + } + + public function testGetAssociatedProductCollection() + { + $link = $this->getMock('Magento\Catalog\Model\Product\Link', array(), array(), '', false); + $this->product->expects($this->once())->method('getLinkInstance')->will($this->returnValue($link)); + $link->expects($this->any())->method('setLinkTypeId') + ->with(\Magento\GroupedProduct\Model\Resource\Product\Link::LINK_TYPE_GROUPED); + $collection = $this->getMock( + 'Magento\Catalog\Model\Resource\Product\Link\Product\Collection', + array('setFlag', 'setIsStrongMode', 'setProduct'), + array(), + '', + false + ); + $link->expects($this->once())->method('getProductCollection')->will($this->returnValue($collection)); + $collection->expects($this->any())->method('setFlag')->will($this->returnValue($collection)); + $collection->expects($this->once())->method('setIsStrongMode') + ->will($this->returnValue($collection)); + $this->assertEquals($collection, $this->_model->getAssociatedProductCollection($this->product)); + } + + /** + * @param array $superGroup + * @param array $result + * @dataProvider processBuyRequestDataProvider + */ + public function testProcessBuyRequest($superGroup, $result) + { + $buyRequest = $this->getMock('\Magento\Object', array('getSuperGroup'), array(), '', false); + $buyRequest->expects($this->any())->method('getSuperGroup')->will($this->returnValue($superGroup)); + + $this->assertEquals($result, $this->_model->processBuyRequest($this->product, $buyRequest)); + } + + /** + * @return array + */ + public function processBuyRequestDataProvider() + { + return array( + 'positive' => array(array(1, 2, 3), array('super_group' => array(1, 2, 3))), + 'negative' => array(false, array('super_group' => array())), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/ProductTypes/Config/Converter/Plugin/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/ProductTypes/Config/Converter/Plugin/GroupedTest.php new file mode 100644 index 00000000000..05cb2cdf712 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Model/ProductTypes/Config/Converter/Plugin/GroupedTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\GroupedProduct\Model\ProductTypes\Config\Converter\Plugin; + +class GroupedTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param array $config + * @param array $result + * @dataProvider afterConvertDataProvider + */ + public function testAfterConvert($config, $result) + { + $model = new \Magento\GroupedProduct\Model\ProductTypes\Config\Converter\Plugin\Grouped(); + $this->assertEquals($result, $model->afterConvert($config)); + } + + /** + * @return array + */ + public function afterConvertDataProvider() + { + $index = \Magento\GroupedProduct\Model\Product\Type\Grouped::TYPE_CODE; + $emptyConfig = array(1, 2, 3); + $config = array($index => array(1)); + $result = array($index => array(1, 'is_product_set' => true)); + + return array( + 'empty config' => array($emptyConfig, $emptyConfig), + 'with grouped' => array($config, $result), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Image/Adapter/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Image/Adapter/AbstractTest.php index e2aeb7de107..a618a78aed3 100644 --- a/dev/tests/unit/testsuite/Magento/Image/Adapter/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Image/Adapter/AbstractTest.php @@ -52,7 +52,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $this->directoryWriteMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); $this->filesystemMock = $this->getMock( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('getDirectoryWrite', 'createDirectory'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Image/Adapter/ImageMagickTest.php b/dev/tests/unit/testsuite/Magento/Image/Adapter/ImageMagickTest.php index 166cd59a800..2affcc7695a 100644 --- a/dev/tests/unit/testsuite/Magento/Image/Adapter/ImageMagickTest.php +++ b/dev/tests/unit/testsuite/Magento/Image/Adapter/ImageMagickTest.php @@ -33,7 +33,7 @@ class ImageMagickTest extends \PHPUnit_Framework_TestCase */ public function testWatermark($imagePath, $expectedMessage) { - $filesystem = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); + $filesystem = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock(); $this->setExpectedException('LogicException', $expectedMessage); $object = new \Magento\Image\Adapter\ImageMagick($filesystem); $object->watermark($imagePath); diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php index 19671dccf07..95a201da4fb 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/ExportTest.php @@ -76,7 +76,7 @@ class ExportTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($this->_exportFileExtension)); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $adapterFactory = $this->getMock('Magento\Core\Model\Log\AdapterFactory', array(), array(), '', false); $entityFactory = $this->getMock( 'Magento\ImportExport\Model\Export\Entity\Factory', array(), array(), '', false);; diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Source/CsvTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Source/CsvTest.php index be46d1298e2..48880f943ca 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Source/CsvTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Source/CsvTest.php @@ -27,7 +27,7 @@ namespace Magento\ImportExport\Model\Import\Source; class CsvTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $_filesystem; @@ -41,7 +41,7 @@ class CsvTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); } diff --git a/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php b/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php index bd4262adf32..7cef4fbaca6 100644 --- a/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/App/IndexerTest.php @@ -43,9 +43,14 @@ class IndexerTest extends \PHPUnit_Framework_TestCase */ protected $_filesystem; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_responseMock; + protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite'), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array('getDirectoryWrite'), array(), '', false); $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); $directoryMock->expects($this->any()) ->method('getRelativePath') @@ -53,12 +58,19 @@ class IndexerTest extends \PHPUnit_Framework_TestCase $this->_filesystem->expects($this->once()) ->method('getDirectoryWrite') ->will($this->returnValue($directoryMock)); - $this->_indexFactoryMock = $this->getMock('Magento\Index\Model\IndexerFactory', - array('create'), array(), '', false); + $this->_indexFactoryMock = $this->getMock( + 'Magento\Index\Model\IndexerFactory', + array('create'), + array(), + '', + false + ); + $this->_responseMock = $this->getMock('Magento\App\Console\Response', array(), array(), '', false); $this->_entryPoint = new \Magento\Index\App\Indexer( 'reportDir', $this->_filesystem, - $this->_indexFactoryMock + $this->_indexFactoryMock, + $this->_responseMock ); } @@ -89,7 +101,7 @@ class IndexerTest extends \PHPUnit_Framework_TestCase $indexerInterface->expects($this->once())->method('isVisible')->will($this->returnValue(false)); $process->expects($this->never())->method('reindexEverything'); } - $this->assertEquals('0', $this->_entryPoint->execute()); + $this->assertEquals($this->_responseMock, $this->_entryPoint->execute()); } /** diff --git a/dev/tests/unit/testsuite/Magento/Index/App/ShellTest.php b/dev/tests/unit/testsuite/Magento/Index/App/ShellTest.php index 3157f239e7c..b48c46c8b7e 100644 --- a/dev/tests/unit/testsuite/Magento/Index/App/ShellTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/App/ShellTest.php @@ -41,22 +41,17 @@ class ShellTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_shellErrorHandler; + protected $_responseMock; protected function setUp() { $this->_shellFactory = $this->getMock('Magento\Index\Model\ShellFactory', array('create'), array(), '', false); - $this->_shellErrorHandler = $this->getMock( - 'Magento\Index\App\Shell\ErrorHandler', - array(), - array(), - '', - false - ); + $this->_responseMock = $this->getMock('Magento\App\Console\Response', array(), array(), '', false); $this->_entryPoint = new \Magento\Index\App\Shell( 'indexer.php', $this->_shellFactory, - $this->_shellErrorHandler + $this->_responseMock + ); } @@ -70,12 +65,15 @@ class ShellTest extends \PHPUnit_Framework_TestCase $shell->expects($this->once()) ->method('hasErrors') ->will($this->returnValue($shellHasErrors)); - $shell->expects($this->once()) - ->method('run'); + $shell->expects($this->once())->method('run'); if ($shellHasErrors) { - $this->_shellErrorHandler->expects($this->once()) - ->method('terminate') - ->with(1); + $this->_responseMock->expects($this->once()) + ->method('setCode') + ->with(-1); + } else { + $this->_responseMock->expects($this->once()) + ->method('setCode') + ->with(0); } $this->_shellFactory->expects($this->any()) ->method('create') diff --git a/dev/tests/unit/testsuite/Magento/Index/Model/Lock/StorageTest.php b/dev/tests/unit/testsuite/Magento/Index/Model/Lock/StorageTest.php index c81ac3b2e8a..4d0e9662373 100644 --- a/dev/tests/unit/testsuite/Magento/Index/Model/Lock/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/Model/Lock/StorageTest.php @@ -56,12 +56,12 @@ class StorageTest extends \PHPUnit_Framework_TestCase ->method('openFile') ->will($this->returnValue($streamMock)); - $filesystemMock = $this->getMockBuilder('Magento\Filesystem') + $filesystemMock = $this->getMockBuilder('Magento\App\Filesystem') ->disableOriginalConstructor() ->getMock(); $filesystemMock->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::VAR_DIR) + ->with(\Magento\App\Filesystem::VAR_DIR) ->will($this->returnValue($directoryMock)); $fileModel = $this->getMock('Magento\Index\Model\Process\File', array(), array($streamMock), ''); diff --git a/dev/tests/unit/testsuite/Magento/Install/App/Action/Plugin/DirTest.php b/dev/tests/unit/testsuite/Magento/Install/App/Action/Plugin/DirTest.php index 3d97314e4a7..2a4ef97e160 100644 --- a/dev/tests/unit/testsuite/Magento/Install/App/Action/Plugin/DirTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/App/Action/Plugin/DirTest.php @@ -49,13 +49,13 @@ class DirTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); - $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite'), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array('getDirectoryWrite'), array(), '', false); $this->varDirectory = $this->getMock( 'Magento\Filesystem\Directory\Write', array('read', 'isDirectory', 'delete'), array(), '', false ); $filesystem->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::VAR_DIR) + ->with(\Magento\App\Filesystem::VAR_DIR) ->will($this->returnValue($this->varDirectory)); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); $this->plugin = new \Magento\Install\App\Action\Plugin\Dir( diff --git a/dev/tests/unit/testsuite/Magento/Install/App/ConsoleTest.php b/dev/tests/unit/testsuite/Magento/Install/App/ConsoleTest.php index 8f0492ec584..277336bae3e 100644 --- a/dev/tests/unit/testsuite/Magento/Install/App/ConsoleTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/App/ConsoleTest.php @@ -37,7 +37,7 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase protected $_installerMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Filesystem\DirectoryList\Verification + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Filesystem\DirectoryList\Verification */ protected $_dirVerifierMock; @@ -64,13 +64,18 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase */ protected $_objectManagerMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_responseMock; + protected function setUp() { $this->_instFactoryMock = $this->getMock('\Magento\Install\Model\Installer\ConsoleFactory', array('create'), array(), '', false); $this->_installerMock = $this->getMock('Magento\Install\Model\Installer\Console', array(), array(), '', false); $this->_dirVerifierMock = $this->getMock( - 'Magento\Filesystem\DirectoryList\Verification', + 'Magento\App\Filesystem\DirectoryList\Verification', array(), array(), '', @@ -100,10 +105,16 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase '', false ); - $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false); + $filesystem = $this->getMock( + 'Magento\App\Filesystem', + array('getDirectoryRead', '__wakeup'), + array(), + '', + false + ); $filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::ROOT) + ->with(\Magento\App\Filesystem::ROOT_DIR) ->will($this->returnValue($directory)); if (isset($params['config'])) { $directory->expects($this->once()) @@ -115,8 +126,16 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase ->with($params['config']) ->will($this->returnValue(true)); } - return new \Magento\Install\App\Console($this->_instFactoryMock, $this->_outputMock, - $this->_appStateMock, $this->_configLoaderMock, $this->_objectManagerMock, $filesystem, $params + $this->_responseMock = $this->getMock('Magento\App\Console\Response', array(), array(), '', false); + return new \Magento\Install\App\Console( + $this->_instFactoryMock, + $this->_outputMock, + $this->_appStateMock, + $this->_configLoaderMock, + $this->_objectManagerMock, + $filesystem, + $this->_responseMock, + $params ); } @@ -134,7 +153,7 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase ->method($method) ->will($this->returnValue($testValue)); $this->_outputMock->expects($this->once())->method('export')->with($testValue); - $model->execute(); + $this->assertEquals($this->_responseMock, $model->execute()); } public function executeShowsRequestedDataProvider() @@ -151,7 +170,7 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase { $model = $this->_createModel(array()); $this->_outputMock->expects($this->once())->method('success')->with($this->stringContains('successfully')); - $model->execute(); + $this->assertEquals($this->_responseMock, $model->execute()); } public function testInstallReportsEncryptionKey() @@ -159,7 +178,7 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase $model = $this->_createModel(array()); $this->_installerMock->expects($this->once())->method('install')->will($this->returnValue('enc_key')); $this->_outputMock->expects($this->once())->method('success')->with($this->stringContains('enc_key')); - $model->execute(); + $this->assertEquals($this->_responseMock, $model->execute()); } public function testUninstallReportsSuccess() @@ -167,7 +186,7 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase $model = $this->_createModel(array('uninstall' => true)); $this->_installerMock->expects($this->once())->method('uninstall')->will($this->returnValue(true)); $this->_outputMock->expects($this->once())->method('success')->with($this->stringContains('Uninstalled')); - $model->execute(); + $this->assertEquals($this->_responseMock, $model->execute()); } public function testUninstallReportsIgnoreIfApplicationIsNotInstalled() @@ -175,7 +194,7 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase $model = $this->_createModel(array('uninstall' => true)); $this->_installerMock->expects($this->once())->method('uninstall')->will($this->returnValue(false)); $this->_outputMock->expects($this->once())->method('success')->with($this->stringContains('non-installed')); - $model->execute(); + $this->assertEquals($this->_responseMock, $model->execute()); } public function testExecuteReportsErrors() @@ -184,13 +203,13 @@ class ConsoleTest extends \PHPUnit_Framework_TestCase $this->_installerMock->expects($this->once())->method('hasErrors')->will($this->returnValue(true)); $this->_installerMock->expects($this->once())->method('getErrors')->will($this->returnValue(array('error1'))); $this->_outputMock->expects($this->once())->method('error')->with($this->stringContains('error1')); - $model->execute(); + $this->assertEquals($this->_responseMock, $model->execute()); } public function testExecuteLoadsExtraConfig() { $model = $this->_createModel(array('config' => realpath(__DIR__ . '/_files/config.php'))); $this->_installerMock->expects($this->once())->method('uninstall')->will($this->returnValue(true)); - $model->execute(); + $this->assertEquals($this->_responseMock, $model->execute()); } } diff --git a/dev/tests/unit/testsuite/Magento/Install/Block/BeginTest.php b/dev/tests/unit/testsuite/Magento/Install/Block/BeginTest.php index 9b9dad14f9c..d0a35fd9710 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Block/BeginTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/Block/BeginTest.php @@ -56,7 +56,7 @@ class BeginTest extends \PHPUnit_Framework_TestCase ->with($this->equalTo($fileName)) ->will($this->returnValue($expectedTxt)); - $fileSystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $fileSystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $fileSystem->expects($this->once()) ->method('getDirectoryRead') ->will($this->returnValue($directoryMock)); @@ -76,7 +76,7 @@ class BeginTest extends \PHPUnit_Framework_TestCase */ public function testGetLicenseHtmlWhenFileIsEmpty($fileName) { - $fileSystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $fileSystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $fileSystem->expects($this->never())->method('read'); $block = $this->_objectManager->getObject('Magento\Install\Block\Begin', diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php index 12f750c6175..2016b62dfda 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/ConfigTest.php @@ -40,7 +40,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $_filesystemMock; @@ -58,10 +58,10 @@ class ConfigTest extends \PHPUnit_Framework_TestCase { $this->_directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); - $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_filesystemMock->expects($this->any()) ->method('getPath') - ->with(\Magento\Filesystem::CONFIG) + ->with(\Magento\App\Filesystem::CONFIG_DIR) ->will($this->returnValue(TESTS_TEMP_DIR)); $this->_filesystemMock->expects($this->any()) ->method('getDirectoryWrite') diff --git a/dev/tests/unit/testsuite/Magento/Log/App/ShellTest.php b/dev/tests/unit/testsuite/Magento/Log/App/ShellTest.php index a0324884c76..1c1d2f32393 100644 --- a/dev/tests/unit/testsuite/Magento/Log/App/ShellTest.php +++ b/dev/tests/unit/testsuite/Magento/Log/App/ShellTest.php @@ -35,11 +35,22 @@ class ShellTest extends \PHPUnit_Framework_TestCase */ protected $_shellFactoryMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_responseMock; + protected function setUp() { - $this->_shellFactoryMock = $this->getMock('Magento\Log\Model\ShellFactory', - array('create'), array(), '', false); - $this->_model = new \Magento\Log\App\Shell('shell.php', $this->_shellFactoryMock); + $this->_shellFactoryMock = $this->getMock( + 'Magento\Log\Model\ShellFactory', + array('create'), + array(), + '', + false + ); + $this->_responseMock = $this->getMock('Magento\App\Console\Response', array(), array(), '', false); + $this->_model = new \Magento\Log\App\Shell('shell.php', $this->_shellFactoryMock, $this->_responseMock); } public function testProcessRequest() @@ -50,6 +61,6 @@ class ShellTest extends \PHPUnit_Framework_TestCase ->with(array('entryPoint' => 'shell.php')) ->will($this->returnValue($shellMock)); $shellMock->expects($this->once())->method('run'); - $this->assertEquals('0', $this->_model->execute()); + $this->assertEquals($this->_responseMock, $this->_model->execute()); } } diff --git a/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php b/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php index 9f424f67f77..c25cd53abd1 100644 --- a/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php +++ b/dev/tests/unit/testsuite/Magento/Log/LoggerTest.php @@ -23,13 +23,12 @@ */ namespace Magento\Log; -use Magento\Filesystem, - Magento\Filesystem\Directory\Write; +use Magento\Filesystem\Directory\Write; class LoggerTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Logger|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject */ protected $_model = null; @@ -51,11 +50,11 @@ class LoggerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $logDir = TESTS_TEMP_DIR . '/var/log'; - $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_directory = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); $this->_filesystemMock->expects($this->any()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::LOG) + ->with(\Magento\App\Filesystem::LOG_DIR) ->will($this->returnValue($this->_directory)); $this->_directory->expects($this->any()) ->method('create') @@ -151,7 +150,7 @@ class LoggerTest extends \PHPUnit_Framework_TestCase public function testLogDebug() { $message = uniqid(); - /** @var $model \Magento\Logger|PHPUnit_Framework_MockObject_MockObject */ + /** @var $model \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject */ $model = $this->getMock('Magento\Logger', array('log'), array(), '', false); $model->expects($this->at(0))->method('log') ->with($message, \Zend_Log::DEBUG, \Magento\Logger::LOGGER_SYSTEM); @@ -165,7 +164,7 @@ class LoggerTest extends \PHPUnit_Framework_TestCase { $exception = new \Exception; $expected = "\n{$exception}"; - /** @var $model \Magento\Logger|PHPUnit_Framework_MockObject_MockObject */ + /** @var $model \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject */ $model = $this->getMock('Magento\Logger', array('log'), array(), '', false); $model->expects($this->at(0))->method('log') ->with($expected, \Zend_Log::ERR, \Magento\Logger::LOGGER_EXCEPTION); diff --git a/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php b/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php index aaa36f13530..d8a036376c7 100644 --- a/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php +++ b/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php @@ -43,7 +43,7 @@ class ShellTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_factoryMock = $this->getMock('Magento\Log\Model\Shell\Command\Factory', array(), array(), '', false); - $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_model = $this->getMock('Magento\Log\Model\Shell', array('_applyPhpVariables'), array($filesystemMock, 'entryPoint.php', $this->_factoryMock) diff --git a/dev/tests/unit/testsuite/Magento/Message/AbstractMessageTest.php b/dev/tests/unit/testsuite/Magento/Message/AbstractMessageTest.php index ee0988deb5b..2ec9f1b4f1a 100644 --- a/dev/tests/unit/testsuite/Magento/Message/AbstractMessageTest.php +++ b/dev/tests/unit/testsuite/Magento/Message/AbstractMessageTest.php @@ -43,8 +43,8 @@ class AbstractMessageTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\AbstractMessage::getText - * @cover \Magento\Message\AbstractMessage::setText + * @covers \Magento\Message\AbstractMessage::getText + * @covers \Magento\Message\AbstractMessage::setText * @dataProvider setTextGetTextProvider */ public function testSetTextGetText($text) @@ -65,8 +65,8 @@ class AbstractMessageTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\AbstractMessage::getIdentifier - * @cover \Magento\Message\AbstractMessage::setIdentifier + * @covers \Magento\Message\AbstractMessage::getIdentifier + * @covers \Magento\Message\AbstractMessage::setIdentifier * @dataProvider setIdentifierGetIdentifierProvider */ public function testSetIdentifierGetIdentifier($identifier) @@ -87,8 +87,8 @@ class AbstractMessageTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\AbstractMessage::getIsSticky - * @cover \Magento\Message\AbstractMessage::setIsSticky + * @covers \Magento\Message\AbstractMessage::getIsSticky + * @covers \Magento\Message\AbstractMessage::setIsSticky */ public function testSetIsStickyGetIsSticky() { @@ -98,7 +98,7 @@ class AbstractMessageTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\AbstractMessage::toString + * @covers \Magento\Message\AbstractMessage::toString */ public function testToString() { diff --git a/dev/tests/unit/testsuite/Magento/Message/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Message/CollectionTest.php index 13096bcc7d9..ba047fb150d 100644 --- a/dev/tests/unit/testsuite/Magento/Message/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Message/CollectionTest.php @@ -46,8 +46,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\Collection::addMessage - * @cover \Magento\Message\Collection::getItemsByType + * @covers \Magento\Message\Collection::addMessage + * @covers \Magento\Message\Collection::getItemsByType */ public function testAddMessage() { @@ -68,9 +68,9 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\Collection::addMessage - * @cover \Magento\Message\Collection::getItems - * @cover \Magento\Message\Collection::getLastAddedMessage + * @covers \Magento\Message\Collection::addMessage + * @covers \Magento\Message\Collection::getItems + * @covers \Magento\Message\Collection::getLastAddedMessage */ public function testGetItems() { @@ -92,10 +92,10 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\Collection::addMessage - * @cover \Magento\Message\Collection::getItemsByType - * @cover \Magento\Message\Collection::getCount - * @cover \Magento\Message\Collection::getCountByType + * @covers \Magento\Message\Collection::addMessage + * @covers \Magento\Message\Collection::getItemsByType + * @covers \Magento\Message\Collection::getCount + * @covers \Magento\Message\Collection::getCountByType */ public function testGetItemsByType() { @@ -135,8 +135,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\Collection::addMessage - * @cover \Magento\Message\Collection::getErrors + * @covers \Magento\Message\Collection::addMessage + * @covers \Magento\Message\Collection::getErrors */ public function testGetErrors() { @@ -158,8 +158,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\Collection::getMessageByIdentifier - * @cover \Magento\Message\Collection::deleteMessageByIdentifier + * @covers \Magento\Message\Collection::getMessageByIdentifier + * @covers \Magento\Message\Collection::deleteMessageByIdentifier */ public function testGetMessageByIdentifier() { @@ -185,7 +185,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\Collection::clear + * @covers \Magento\Message\Collection::clear */ public function testClear() { @@ -206,7 +206,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @cover \Magento\Message\Collection::clear + * @covers \Magento\Message\Collection::clear */ public function testClearWithSticky() { diff --git a/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php index 61e9dd28bd0..41c579ef5ef 100644 --- a/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Declaration/FileResolverTest.php @@ -77,8 +77,8 @@ class FileResolverTest extends \PHPUnit_Framework_TestCase */ protected function getFileResolver($baseDir) { - $filesystem = new \Magento\Filesystem( - new \Magento\Filesystem\DirectoryList($baseDir), + $filesystem = new \Magento\App\Filesystem( + new \Magento\App\Filesystem\DirectoryList($baseDir), new \Magento\Filesystem\Directory\ReadFactory(), new \Magento\Filesystem\Directory\WriteFactory() ); diff --git a/dev/tests/unit/testsuite/Magento/Module/Declaration/Reader/FilesystemTest.php b/dev/tests/unit/testsuite/Magento/Module/Declaration/Reader/FilesystemTest.php index 8d525fe3943..160a87d626f 100644 --- a/dev/tests/unit/testsuite/Magento/Module/Declaration/Reader/FilesystemTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Declaration/Reader/FilesystemTest.php @@ -99,8 +99,8 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase */ protected function getFileResolver($baseDir) { - $filesystem = new \Magento\Filesystem( - new \Magento\Filesystem\DirectoryList($baseDir), + $filesystem = new \Magento\App\Filesystem( + new \Magento\App\Filesystem\DirectoryList($baseDir), new \Magento\Filesystem\Directory\ReadFactory(), new \Magento\Filesystem\Directory\WriteFactory() ); diff --git a/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php index 60a6471e709..e267ee4f04f 100644 --- a/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/Dir/ReaderTest.php @@ -62,7 +62,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_dirsMock = $this->getMock('Magento\Module\Dir', array(), array(), '', false, false); $this->_baseConfigMock = $this->getMock('Magento\Core\Model\Config\Base', array(), array(), '', false, false); $this->_moduleListMock = $this->getMock('Magento\Module\ModuleListInterface'); - $filesystemMock = $this->getMock('\Magento\Filesystem', array(), array(), '', false, false); + $filesystemMock = $this->getMock('\Magento\App\Filesystem', array(), array(), '', false, false); $fileIteratorFactoryMock = $this->getMock('\Magento\Config\FileIteratorFactory', array(), array(), '', false, false); diff --git a/dev/tests/unit/testsuite/Magento/Module/DirTest.php b/dev/tests/unit/testsuite/Magento/Module/DirTest.php index 3d0b358904e..47df14dcf3d 100644 --- a/dev/tests/unit/testsuite/Magento/Module/DirTest.php +++ b/dev/tests/unit/testsuite/Magento/Module/DirTest.php @@ -31,7 +31,7 @@ class DirTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $filesystemMock; @@ -47,7 +47,7 @@ class DirTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false, false); + $this->filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false, false); $this->directoryMock = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false, false); $this->_stringMock = $this->getMock('Magento\Stdlib\String', array(), array(), '', false, false); diff --git a/dev/tests/unit/testsuite/Magento/PageCache/Model/App/FrontController/HeaderPluginTest.php b/dev/tests/unit/testsuite/Magento/PageCache/Model/App/FrontController/HeaderPluginTest.php new file mode 100644 index 00000000000..75075328a46 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/PageCache/Model/App/FrontController/HeaderPluginTest.php @@ -0,0 +1,103 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_PageCache + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\PageCache\Model\App\FrontController; + +class HeaderPluginTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\PageCache\Model\App\FrontController\HeaderPlugin + */ + protected $plugin; + + /** + * @var \Magento\Core\Model\Layout|\PHPUnit_Framework_MockObject_MockObject + */ + protected $layoutMock; + + /** + * @var \Magento\Core\Model\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $configMock; + + /** + * @var \Magento\App\Response\Http|\PHPUnit_Framework_MockObject_MockObject + */ + protected $responseMock; + + /** + * SetUp + */ + protected function setUp() + { + $this->layoutMock = $this->getMock('Magento\Core\Model\Layout', array(), array(), '', false); + $this->configMock = $this->getMock('Magento\Core\Model\ConfigInterface', array(), array(), '', false); + $this->responseMock = $this->getMock('Magento\App\Response\Http', array(), array(), '', false); + $this->plugin = new HeaderPlugin($this->layoutMock, $this->configMock); + } + + /** + * data providers for response headers + */ + public function headersCachableDataProvider() + { + return array( + array(false, false, '10', 'no-store, no-cache, must-revalidate, max-age=0', 'no-cache'), + array(true, false, '20', 'public, max-age=20', 'cache'), + array(true, true, '30', 'private, max-age=30', 'cache'), + ); + } + + /** + * test response headers after dispatch, without cache + * + * @dataProvider headersCachableDataProvider + */ + public function testAfterDispatchCacheable($isCacheable, $isPrivate, $maxAge, $cacheControl, $pragma) + { + $this->layoutMock->expects($this->once()) + ->method('isCacheable') + ->will($this->returnValue($isCacheable)); + $this->layoutMock->expects($this->any()) + ->method('isPrivate') + ->will($this->returnValue($isPrivate)); + $this->configMock->expects($this->any()) + ->method('getValue') + ->with('system/headers/max-age') + ->will($this->returnValue($maxAge)); + + $this->responseMock->expects($this->at(0)) + ->method('setHeader') + ->with('pragma', $pragma); + + $this->responseMock->expects($this->at(1)) + ->method('setHeader') + ->with('cache-control', $cacheControl); + + $this->plugin->afterDispatch($this->responseMock); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Model/Method/AgreementTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Model/Method/AgreementTest.php new file mode 100644 index 00000000000..ef9df2e4fcd --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Paypal/Model/Method/AgreementTest.php @@ -0,0 +1,122 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Paypal + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Paypal\Model\Method; + +class AgreementTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_helper; + + /** + * @var \Magento\Paypal\Model\Method\Agreement + */ + protected $_model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_apiNvpMock; + + protected function setUp() + { + $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $paypalConfigMock = $this->getMockBuilder('\Magento\Paypal\Model\Config') + ->disableOriginalConstructor() + ->setMethods(array('__get')) + ->getMock(); + $this->_apiNvpMock = $this->getMockBuilder('\Magento\Paypal\Model\Api\Nvp') + ->disableOriginalConstructor() + ->setMethods(array('callDoReferenceTransaction', 'callGetTransactionDetails')) + ->getMock(); + $proMock = $this->getMockBuilder('\Magento\Paypal\Model\Pro') + ->setMethods(array('getApi', 'setMethod', 'getConfig', 'importPaymentInfo')) + ->disableOriginalConstructor() + ->getMock(); + $proMock->expects($this->any()) + ->method('getApi') + ->will($this->returnValue($this->_apiNvpMock)); + $proMock->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue($paypalConfigMock)); + + $billingAgreementMock = $this->getMockBuilder('\Magento\Sales\Model\Billing\Agreement') + ->disableOriginalConstructor() + ->setMethods(array('load', '__wakeup')) + ->getMock(); + $billingAgreementMock->expects($this->any()) + ->method('load') + ->will($this->returnValue($billingAgreementMock)); + + $agreementFactoryMock = $this->getMockBuilder('\Magento\Sales\Model\Billing\AgreementFactory') + ->disableOriginalConstructor() + ->setMethods(array('create')) + ->getMock(); + $agreementFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($billingAgreementMock)); + + $cartMock = $this->getMockBuilder('\Magento\Paypal\Model\Cart') + ->disableOriginalConstructor() + ->getMock(); + $cartFactoryMock = $this->getMockBuilder('\Magento\Paypal\Model\CartFactory') + ->disableOriginalConstructor() + ->setMethods(array('create')) + ->getMock(); + $cartFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($cartMock)); + + $arguments = array( + 'agreementFactory' => $agreementFactoryMock, + 'cartFactory' => $cartFactoryMock, + 'data' => array($proMock) + ); + + $this->_model = $this->_helper->getObject('Magento\Paypal\Model\Method\Agreement', $arguments); + } + + public function testAuthorizeWithBaseCurrency() + { + $payment = $this->getMockBuilder('\Magento\Sales\Model\Order\Payment') + ->disableOriginalConstructor() + ->setMethods(array('__wakeup')) + ->getMock(); + $order = $this->getMockBuilder('Magento\Sales\Model\Order') + ->disableOriginalConstructor() + ->setMethods(array('__wakeup')) + ->getMock(); + $order->setBaseCurrencyCode('USD'); + $payment->setOrder($order); + + $this->_model->authorize($payment, 10.00); + $this->assertEquals($order->getBaseCurrencyCode(), $this->_apiNvpMock->getCurrencyCode()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/ShippingTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/ShippingTest.php index 6280ff74854..fd8e0a297aa 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/ShippingTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Invoice/Total/ShippingTest.php @@ -52,13 +52,13 @@ class ShippingTest extends \PHPUnit_Framework_TestCase 'calculatorFactory' => $this->getMock( 'Magento\Core\Model\CalculatorFactory', array(), array(), '', false ), - 'invoiceItemCollFactory' => $this->getMock( + 'invoiceItemCollectionFactory' => $this->getMock( 'Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory', array(), array(), '', false ), 'invoiceCommentFactory' => $this->getMock( 'Magento\Sales\Model\Order\Invoice\CommentFactory', array(), array(), '', false ), - 'commentCollFactory' => $this->getMock( + 'commentCollectionFactory' => $this->getMock( 'Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory', array(), array(), '', false ), 'templateMailerFactory' => $this->getMock( @@ -98,7 +98,7 @@ class ShippingTest extends \PHPUnit_Framework_TestCase 'emailInfoFactory' => $this->getMock( 'Magento\Email\Model\InfoFactory', array(), array(), '', false ), - 'orderItemCollFactory' => $this->getMock( + 'orderItemCollectionFactory' => $this->getMock( 'Magento\Sales\Model\Resource\Order\Item\CollectionFactory', array(), array(), '', false ), 'serviceOrderFactory' => $this->getMock( @@ -110,7 +110,7 @@ class ShippingTest extends \PHPUnit_Framework_TestCase 'orderHistoryFactory' => $this->getMock( 'Magento\Sales\Model\Order\Status\HistoryFactory', array(), array(), '', false ), - 'orderTaxCollFactory' => $this->getMock( + 'orderTaxCollectionFactory' => $this->getMock( 'Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory', array(), array(), '', false ), ); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/InvoiceTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/InvoiceTest.php index 64510b540fb..5444d1003dc 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/InvoiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/InvoiceTest.php @@ -66,13 +66,13 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase 'calculatorFactory' => $this->getMock( 'Magento\Core\Model\CalculatorFactory', array(), array(), '', false ), - 'invoiceItemCollFactory' => $this->getMock( + 'invoiceItemCollectionFactory' => $this->getMock( 'Magento\Sales\Model\Resource\Order\Invoice\Item\CollectionFactory', array(), array(), '', false ), 'invoiceCommentFactory' => $this->getMock( 'Magento\Sales\Model\Order\Invoice\CommentFactory', array(), array(), '', false ), - 'commentCollFactory' => $this->getMock( + 'commentCollectionFactory' => $this->getMock( 'Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory', array(), array(), '', false ), 'templateMailerFactory' => $this->getMock( diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php index 4c0fed53ff2..de1b6ef5a59 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php @@ -46,8 +46,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $string = $this->getMock('Magento\Stdlib\String', array(), array(), '', false); $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); $translate = $this->getMock('Magento\Core\Model\Translate', array(), array(), '', false); - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); - $shippingConfig = $this->getMock('Magento\Shipping\Model\Config', array(), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $pdfItemsFactory = $this->getMock('Magento\Sales\Model\Order\Pdf\ItemsFactory', array(), array(), '', false); $localeMock = $this->getMock('Magento\Core\Model\LocaleInterface', array(), array(), '', false, false); @@ -108,7 +107,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase // Test model /** @var \Magento\Sales\Model\Order\Pdf\AbstractPdf $model */ $model = $this->getMockForAbstractClass('Magento\Sales\Model\Order\Pdf\AbstractPdf', - array($paymentData, $string, $coreStoreConfig, $translate, $filesystem, $shippingConfig, + array($paymentData, $string, $coreStoreConfig, $translate, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeMock), '', true, false, true, array('drawLineBlocks') ); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php index bb05bb4a701..82c845ee657 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php @@ -52,7 +52,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase } ) ); - $filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false, false); + $filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false, false); $filesystemMock->expects($this->any()) ->method('getDirectoryRead') ->will($this->returnValue($directoryMock)); @@ -60,8 +60,6 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase ->method('getDirectoryWrite') ->will($this->returnValue($directoryMock)); - $shippingConfigMock = $this->getMock('Magento\Shipping\Model\Config', array(), array(), '', false, - false); $this->_pdfConfigMock = $this->getMock('Magento\Sales\Model\Order\Pdf\Config', array(), array(), '', false, false); $totalFactoryMock = $this->getMock('Magento\Sales\Model\Order\Pdf\Total\Factory', array(), array(), '', false, @@ -79,7 +77,6 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $storeConfigMock, $translateMock, $filesystemMock, - $shippingConfigMock, $this->_pdfConfigMock, $totalFactoryMock, $pdfItemsFactoryMock, diff --git a/dev/tests/unit/testsuite/Magento/Shipping/Block/Adminhtml/Order/TrackingTest.php b/dev/tests/unit/testsuite/Magento/Shipping/Block/Adminhtml/Order/TrackingTest.php new file mode 100644 index 00000000000..4f7f7f6221b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Shipping/Block/Adminhtml/Order/TrackingTest.php @@ -0,0 +1,63 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Shipping\Block\Adminhtml\Order; + +class TrackingTest extends \PHPUnit_Framework_TestCase +{ + public function testLookup() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $shipment = new \Magento\Object(['store_id' => 1]); + + $registry = $this->getMock('Magento\Core\Model\Registry', ['registry'], [], '', false); + $registry->expects($this->once())->method('registry') + ->with('current_shipment')->will($this->returnValue($shipment)); + + $carrier = $this->getMock('Magento\Shipping\Model\Carrier\Freeshipping', + ['isTrackingAvailable', 'getConfigData'], [], '', false); + $carrier->expects($this->once())->method('isTrackingAvailable')->will($this->returnValue(true)); + $carrier->expects($this->once())->method('getConfigData')->with('title') + ->will($this->returnValue('configdata')); + + $config = $this->getMock('Magento\Shipping\Model\Config', ['getAllCarriers'], [], '', false); + $config->expects($this->once())->method('getAllCarriers') + ->with(1)->will($this->returnValue(['free' => $carrier])); + + /** @var \Magento\Shipping\Block\Adminhtml\Order\Tracking $model */ + $model = $helper->getObject( + 'Magento\Shipping\Block\Adminhtml\Order\Tracking', + [ + 'registry' => $registry, + 'shippingConfig' => $config + ] + ); + + $this->assertEquals([ + 'custom' => 'Custom Value', + 'free' => 'configdata' + ], $model->getCarriers()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Shipping/Model/Order/TrackTest.php b/dev/tests/unit/testsuite/Magento/Shipping/Model/Order/TrackTest.php new file mode 100644 index 00000000000..fc2fbbf67ee --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Shipping/Model/Order/TrackTest.php @@ -0,0 +1,62 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Shipping\Model\Order; + +class TrackTest extends \PHPUnit_Framework_TestCase +{ + public function testLookup() + { + $helper = new \Magento\TestFramework\Helper\ObjectManager($this); + + $carrier = $this->getMock('Magento\Shipping\Model\Carrier\Freeshipping', + ['setStore', 'getTrackingInfo'], [], '', false); + $carrier->expects($this->once())->method('setStore')->with(''); + $carrier->expects($this->once())->method('getTrackingInfo') + ->will($this->returnValue('trackingInfo')); + + $carrierFactory = $this->getMock('\Magento\Shipping\Model\CarrierFactory', ['create'], [], '', false); + $carrierFactory->expects($this->once())->method('create') + ->will($this->returnValue($carrier)); + + $shipment = $this->getMock('Magento\Shipping\Model\Carrier\Freeshipping', ['load'], [], '', false); + $shipment->expects($this->any())->method('load') + ->will($this->returnValue($shipment)); + + $shipmentFactory = $this->getMock('\Magento\Sales\Model\Order\ShipmentFactory', ['create'], [], '', false); + $shipmentFactory->expects($this->any())->method('create') + ->will($this->returnValue($shipment)); + + /** @var \Magento\Shipping\Model\Order\Track $model */ + $model = $helper->getObject( + 'Magento\Shipping\Model\Order\Track', + [ + 'carrierFactory' => $carrierFactory, + 'shipmentFactory' => $shipmentFactory + ] + ); + + $this->assertEquals('trackingInfo', $model->getNumberDetail()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php b/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php index da957722a12..a70f8292756 100644 --- a/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php +++ b/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php @@ -63,7 +63,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase protected $_sitemapCmsPageMock; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystemMock; @@ -144,7 +144,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase ->method('openFile') ->will($this->returnValue($this->_fileMock)); - $this->_filesystemMock = $this->getMockBuilder('Magento\Filesystem') + $this->_filesystemMock = $this->getMockBuilder('Magento\App\Filesystem') ->setMethods(array('getDirectoryWrite')) ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/PluginScannerTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/PluginScannerTest.php index 23100676f4e..1fff8a9bc0e 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/PluginScannerTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/PluginScannerTest.php @@ -47,7 +47,6 @@ class PluginScannerTest extends \PHPUnit_Framework_TestCase $expected = array( 'Magento\App\Cache\TagPlugin', 'Magento\Core\Model\Action\Plugin', - 'Custom_PageCache_Model_Action_Plugin', ); $this->assertEquals($expected, $actual); } diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/config.xml b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/config.xml index 278ee39b915..2f95d74fced 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/config.xml +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/config.xml @@ -36,7 +36,6 @@ <Node2 type ="Magento\App\Action\Context"> <plugins> <first><instance>Magento\Core\Model\Action\Plugin</instance></first> - <second><instance>Custom_PageCache_Model_Action_Plugin</instance></second> </plugins> <parameters> <layoutFactory> diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/di/config.xml b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/di/config.xml index b08bf681976..42dda6ca76c 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/di/config.xml +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/etc/di/config.xml @@ -30,7 +30,6 @@ <type name="Magento\App\Action\Context"> <param name="layoutFactory"><instance type="customLayoutFactory" /></param> <plugin name="first" type="Magento\Core\Model\Action\Plugin" /> - <plugin name="second" type="Custom_PageCache_Model_Action_Plugin" /> </type> <virtualType name="customStoreManagerProxy" type="Magento\Core\Model\StoreManager\Proxy" /> <virtualType name="customLayoutFactory" type="Magento\Core\Model\Layout\Factory" /> diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/CopyRuleTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/CopyRuleTest.php index ce05dcec4bc..fcdc99eda35 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/CopyRuleTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/CopyRuleTest.php @@ -51,7 +51,7 @@ class CopyRuleTest extends \PHPUnit_Framework_TestCase protected function setUp() { $filesystemMock = $this->getMock( - 'Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false + 'Magento\App\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false ); $this->_directoryMock = $this->getMock( '\Magento\Filesystem\Directory\Read', diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/ThemeDeploymentTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/ThemeDeploymentTest.php index 3c7e29e11b9..37ac11f375c 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/ThemeDeploymentTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/View/Generator/ThemeDeploymentTest.php @@ -42,7 +42,7 @@ class ThemeDeploymentTest extends \PHPUnit_Framework_TestCase protected $_tmpDir; /** - * @var \Magento\Filesystem | \PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem | \PHPUnit_Framework_MockObject_MockObject */ protected $filesystem; @@ -54,10 +54,10 @@ class ThemeDeploymentTest extends \PHPUnit_Framework_TestCase protected function setUp() { $methods = array('getDirectoryWrite', 'getPath', '__wakeup'); - $this->filesystem = $this->getMock('Magento\Filesystem', $methods, array(), '', false); + $this->filesystem = $this->getMock('Magento\App\Filesystem', $methods, array(), '', false); $this->filesystem->expects($this->any()) ->method('getPath') - ->with(\Magento\Filesystem::ROOT) + ->with(\Magento\App\Filesystem::ROOT_DIR) ->will($this->returnValue(str_replace('\\', '/', BP))); $viewFilesystem = $this->getMock('Magento\View\Filesystem', array('normalizePath'), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php b/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php index 8cb5c42d3b5..f28c551425d 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Block/Html/HeaderTest.php @@ -34,7 +34,7 @@ class HeaderTest extends \PHPUnit_Framework_TestCase */ public function testGetLogoSrc() { - $filesystem = $this->getMock('\Magento\Filesystem', array(), array(), '', false ); + $filesystem = $this->getMock('\Magento\App\Filesystem', array(), array(), '', false ); $mediaDirectory = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false ); $storeConfig = $this->getMock('Magento\Core\Model\Store\Config', array('getConfig'), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Theme/Helper/StorageTest.php b/dev/tests/unit/testsuite/Magento/Theme/Helper/StorageTest.php index 48bd6522594..75e7e5282bf 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Helper/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Helper/StorageTest.php @@ -32,7 +32,7 @@ namespace Magento\Theme\Helper; class StorageTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $filesystem; @@ -88,7 +88,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase $this->customizationPath = '/' . implode('/', array('var', 'theme')); $this->request = $this->getMock('\Magento\App\Request\Http', array(), array(), '', false); - $this->filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->session = $this->getMock('Magento\Backend\Model\Session', array(), array(), '', false); $this->contextHelper = $this->getMock('Magento\App\Helper\Context', array(), array(), '', false); $this->directoryWrite = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php index 7d167aeb780..7a8cbc66246 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php @@ -146,7 +146,7 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase 'Magento\View\Design\Theme\FileFactory', array('create'), array(), '', false ); $this->_filesystem = $this->getMock( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('getDirectoryWrite'), array(), '', @@ -160,7 +160,7 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase ); $this->_filesystem->expects($this->any()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::MEDIA) + ->with(\Magento\App\Filesystem::MEDIA_DIR) ->will($this->returnValue($this->_dirWriteMock)); /* Init \Magento\Core\Model\Resource\Layout\Collection model */ diff --git a/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php index 8de60869bba..a17f1623307 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php @@ -51,7 +51,7 @@ class ServiceTest extends \PHPUnit_Framework_TestCase protected $_fileSizeMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Filesystem + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Filesystem */ protected $_filesystemMock; @@ -73,7 +73,7 @@ class ServiceTest extends \PHPUnit_Framework_TestCase ); $this->_uploaderFactory->expects($this->any())->method('create')->will($this->returnValue($this->_uploader)); $this->_directoryMock = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); - $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_filesystemMock->expects($this->any()) ->method('getDirectoryRead') ->will($this->returnValue($this->_directoryMock)); diff --git a/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php index 2a126341874..5e7c2aa7f8e 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php @@ -37,7 +37,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase protected $_storageRoot; /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $_filesystem; @@ -68,7 +68,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_helperStorage = $this->getMock('Magento\Theme\Helper\Storage', array(), array(), '', false); $this->_objectManager = $this->getMock('Magento\ObjectManager', array(), array(), '', false); $this->_imageFactory = $this->getMock('Magento\Image\AdapterFactory', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Dhl/InternationalTest.php b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Dhl/InternationalTest.php index 52b2a07f69b..a54c6b50dc7 100644 --- a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Dhl/InternationalTest.php +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/Dhl/InternationalTest.php @@ -81,11 +81,12 @@ class InternationalTest extends \PHPUnit_Framework_TestCase $rateFactory->expects($this->any())->method('create')->will($this->returnValue($rateResult)); // rate method factory - $rateMethodFactory = $this->getMockBuilder('\Magento\Shipping\Model\Rate\Result\MethodFactory') + $rateMethodFactory = $this->getMockBuilder('\Magento\Sales\Model\Quote\Address\RateResult\MethodFactory') ->disableOriginalConstructor() ->setMethods(array('create')) ->getMock(); - $rateMethod = $this->getMockBuilder('Magento\Shipping\Model\Rate\Result\Method')->disableOriginalConstructor() + $rateMethod = $this->getMockBuilder('Magento\Sales\Model\Quote\Address\RateResult\Method') + ->disableOriginalConstructor() ->setMethods(array('setPrice')) ->getMock(); $rateMethod->expects($this->any())->method('setPrice')->will($this->returnSelf()); @@ -111,7 +112,7 @@ class InternationalTest extends \PHPUnit_Framework_TestCase ->getMock(); $modulesDirectory->expects($this->any())->method('readFile') ->will($this->returnValue(file_get_contents(__DIR__ . '/_files/countries.xml'))); - $filesystem = $this->getMockBuilder('\Magento\Filesystem')->disableOriginalConstructor() + $filesystem = $this->getMockBuilder('\Magento\App\Filesystem')->disableOriginalConstructor() ->setMethods(array('getDirectoryRead')) ->getMock(); $filesystem->expects($this->any())->method('getDirectoryRead')->will($this->returnValue($modulesDirectory)); @@ -124,7 +125,7 @@ class InternationalTest extends \PHPUnit_Framework_TestCase $website->expects($this->any())->method('getBaseCurrencyCode')->will($this->returnValue('USD')); $storeManager->expects($this->any())->method('getWebsite')->will($this->returnValue($website)); - $arguments = array( + $this->_model = $this->_helper->getObject('Magento\Usa\Model\Shipping\Carrier\Dhl\International', array( 'coreStoreConfig' => $coreStoreConfig, 'xmlElFactory' => $xmlElFactory, 'rateFactory' => $rateFactory, @@ -133,8 +134,7 @@ class InternationalTest extends \PHPUnit_Framework_TestCase 'filesystem' => $filesystem, 'storeManager' => $storeManager, 'data' => array('id' => 'dhlint', 'store' => '1') - ); - $this->_model = $this->_helper->getObject('Magento\Usa\Model\Shipping\Carrier\Dhl\International', $arguments); + )); } /** @@ -219,7 +219,7 @@ class InternationalTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(file_get_contents(__DIR__ . '/_files/success_dhlintl_response_rates.xml'))); // for setRequest $request_params = include __DIR__ . '/_files/rates_request_data_dhlintl.php'; - $request = $this->_helper->getObject('Magento\Shipping\Model\Rate\Request', $request_params); + $request = $this->_helper->getObject('Magento\Sales\Model\Quote\Address\RateRequest', $request_params); $this->assertNotEmpty($this->_model->collectRates($request)->getAllRates()); } } diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/DhlTest.php b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/DhlTest.php index e2dd6bd9ee9..cbde90204ad 100644 --- a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/DhlTest.php +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/DhlTest.php @@ -90,11 +90,11 @@ class DhlTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($rateResult)); // rate method factory - $rateMethodFactory = $this->getMockBuilder('\Magento\Shipping\Model\Rate\Result\MethodFactory') + $rateMethodFactory = $this->getMockBuilder('\Magento\Sales\Model\Quote\Address\RateResult\MethodFactory') ->disableOriginalConstructor() ->setMethods(array('create')) ->getMock(); - $rateMethod = $this->getMockBuilder('Magento\Shipping\Model\Rate\Result\Method') + $rateMethod = $this->getMockBuilder('Magento\Sales\Model\Quote\Address\RateResult\Method') ->disableOriginalConstructor() ->setMethods(array('setPrice')) ->getMock(); @@ -172,7 +172,7 @@ class DhlTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(file_get_contents(__DIR__ . '/_files/success_dhl_response_rates.xml'))); // for setRequest $request_params = include __DIR__ . '/_files/rates_request_data_dhl.php'; - $request = $this->_helper->getObject('Magento\Shipping\Model\Rate\Request', $request_params); + $request = $this->_helper->getObject('Magento\Sales\Model\Quote\Address\RateRequest', $request_params); $this->assertNotEmpty($this->_model->collectRates($request)->getAllRates()); } diff --git a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/UspsTest.php b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/UspsTest.php index 7d01193aff8..82a5678a8d8 100755 --- a/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/UspsTest.php +++ b/dev/tests/unit/testsuite/Magento/Usa/Model/Shipping/Carrier/UspsTest.php @@ -87,11 +87,11 @@ class UspsTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($rateResult)); // rate method factory - $rateMethodFactory = $this->getMockBuilder('\Magento\Shipping\Model\Rate\Result\MethodFactory') + $rateMethodFactory = $this->getMockBuilder('\Magento\Sales\Model\Quote\Address\RateResult\MethodFactory') ->disableOriginalConstructor() ->setMethods(array('create')) ->getMock(); - $rateMethod = $this->getMockBuilder('Magento\Shipping\Model\Rate\Result\Method') + $rateMethod = $this->getMockBuilder('Magento\Sales\Model\Quote\Address\RateResult\Method') ->disableOriginalConstructor() ->setMethods(array('setPrice')) ->getMock(); @@ -162,7 +162,7 @@ class UspsTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue(file_get_contents(__DIR__ . '/_files/success_usps_response_rates.xml'))); // for setRequest $request_params = include __DIR__ . '/_files/rates_request_data.php'; - $request = $this->_helper->getObject('Magento\Shipping\Model\Rate\Request', $request_params); + $request = $this->_helper->getObject('Magento\Sales\Model\Quote\Address\RateRequest', $request_params); $this->assertNotEmpty($this->_model->collectRates($request)->getAllRates()); } diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/MergeServiceTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/MergeServiceTest.php index d3cafad33a5..0d106a064bc 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergeServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergeServiceTest.php @@ -60,7 +60,7 @@ class MergeServiceTest extends \PHPUnit_Framework_TestCase { $this->_objectManager = $this->getMockForAbstractClass('Magento\ObjectManager', array('create')); $this->_config = $this->getMock('Magento\View\Asset\ConfigInterface', array(), array(), '', false); - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_directory = $this->getMock('\Magento\Filesystem\Directory\Write', array(), array(), '', false); $this->_state = $this->getMock('Magento\App\State', array(), array(), '', false); $this->_filesystem->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/ChecksumTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/ChecksumTest.php index b97a0557c09..5d7a3c87568 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/ChecksumTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/ChecksumTest.php @@ -63,7 +63,7 @@ class ChecksumTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryWrite'), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array('getDirectoryWrite'), array(), '', false); $this->_directory = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); $this->_filesystem->expects($this->once()) ->method('getDirectoryWrite') diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/DirectTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/DirectTest.php index 5c06c470959..b9f3d5ba773 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/DirectTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/DirectTest.php @@ -24,8 +24,7 @@ namespace Magento\View\Asset\MergeStrategy; -use Magento\Filesystem, - Magento\Filesystem\Directory\Write; +use Magento\Filesystem\Directory\Write; class DirectTest extends \PHPUnit_Framework_TestCase { @@ -52,11 +51,11 @@ class DirectTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_cssUrlResolver = $this->getMock('Magento\View\Url\CssResolver', array(), array(), '', false); - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_directory = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false); $this->_filesystem->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::PUB) + ->with(\Magento\App\Filesystem::PUB_DIR) ->will($this->returnValue($this->_directory)); $this->_directory->expects($this->any()) ->method('getRelativePath') diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/FileExistsTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/FileExistsTest.php index 2fc1d57804d..aa493c862fd 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/FileExistsTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergeStrategy/FileExistsTest.php @@ -59,7 +59,7 @@ class FileExistsTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_filesystem = $this->getMock( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('getDirectoryWrite', 'getDirectoryRead'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/MergedTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/MergedTest.php index 645024f0531..66e08a86c26 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MergedTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MergedTest.php @@ -82,7 +82,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase ); $this->_filesystem = $this->getMock( - 'Magento\Filesystem', array(), array(), '', false); + 'Magento\App\Filesystem', array(), array(), '', false); $this->_objectManager->expects($this->any()) ->method('get') ->will($this->returnValue($this->_filesystem)); @@ -147,11 +147,11 @@ class MergedTest extends \PHPUnit_Framework_TestCase $this->_filesystem->expects($this->at(0)) ->method('getPath') - ->with($this->equalTo(\Magento\Filesystem::PUB_LIB)) + ->with($this->equalTo(\Magento\App\Filesystem::PUB_LIB_DIR)) ->will($this->returnValue('pub/lib')); $this->_filesystem->expects($this->at(1)) ->method('getPath') - ->with($this->equalTo(\Magento\Filesystem::STATIC_VIEW)) + ->with($this->equalTo(\Magento\App\Filesystem::STATIC_VIEW_DIR)) ->will($this->returnValue('pub/static')); $readDirectoryMock = $this->getMockBuilder('\Magento\Filesystem\Directory\Read') ->disableOriginalConstructor() @@ -164,7 +164,7 @@ class MergedTest extends \PHPUnit_Framework_TestCase $this->_filesystem->expects($this->any()) ->method('getDirectoryRead') - ->with($this->equalTo(\Magento\Filesystem::PUB_VIEW_CACHE)) + ->with($this->equalTo(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR)) ->will($this->returnValue($readDirectoryMock)); $this->_mergeStrategy diff --git a/dev/tests/unit/testsuite/Magento/View/Asset/MinifyServiceTest.php b/dev/tests/unit/testsuite/Magento/View/Asset/MinifyServiceTest.php index 2bbea589edc..4de53df8cb2 100644 --- a/dev/tests/unit/testsuite/Magento/View/Asset/MinifyServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Asset/MinifyServiceTest.php @@ -51,7 +51,7 @@ class MinifyServiceTest extends \PHPUnit_Framework_TestCase $this->_config = $this->getMock('Magento\View\Asset\ConfigInterface', array(), array(), '', false); $this->_objectManager = $this->getMock('Magento\ObjectManager'); $this->_appState = $this->getMock('Magento\App\State', array(), array(), '', false); - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $directory = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); $filesystem->expects($this->any()) ->method('getDirectoryRead') diff --git a/dev/tests/unit/testsuite/Magento/View/Design/Fallback/FactoryTest.php b/dev/tests/unit/testsuite/Magento/View/Design/Fallback/FactoryTest.php index 74ca9190cd1..2f5af33c4cf 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/Fallback/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/Fallback/FactoryTest.php @@ -44,12 +44,12 @@ class FactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { $filesystemMock = $this->getMock( - '\Magento\Filesystem', + '\Magento\App\Filesystem', array('getPath', 'getDirectoryRead', '__wakeup'), array('dir' => array( - \Magento\Filesystem::THEMES => 'themes', - \Magento\Filesystem::MODULES => 'modules', - \Magento\Filesystem::PUB_LIB => 'pub_lib', + \Magento\App\Filesystem::THEMES_DIR => 'themes', + \Magento\App\Filesystem::MODULES_DIR => 'modules', + \Magento\App\Filesystem::PUB_LIB_DIR => 'pub_lib', ) ), '', @@ -59,9 +59,9 @@ class FactoryTest extends \PHPUnit_Framework_TestCase ->method('getPath') ->will($this->returnValueMap( array( - (\Magento\Filesystem::THEMES) => 'themes', - (\Magento\Filesystem::MODULES) => 'modules', - (\Magento\Filesystem::PUB_LIB) => 'pub_lib', + (\Magento\App\Filesystem::THEMES_DIR) => 'themes', + (\Magento\App\Filesystem::MODULES_DIR) => 'modules', + (\Magento\App\Filesystem::PUB_LIB_DIR) => 'pub_lib', )) ); diff --git a/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxyTest.php b/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxyTest.php index 9ead3d7aa6d..acea6869bcb 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxyTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxyTest.php @@ -27,7 +27,7 @@ namespace Magento\View\Design\FileResolution\Strategy\Fallback; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\TestFramework\Helper\ProxyTesting; /** @@ -286,14 +286,14 @@ class CachingProxyTest extends \PHPUnit_Framework_TestCase ->method('getRelativePath') ->will($this->returnArgument(0)); $methods = array('getDirectoryRead', 'getDirectoryWrite', '__wakeup'); - $filesystem = $this->getMock('Magento\Filesystem', $methods, array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', $methods, array(), '', false); $filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::ROOT) + ->with(\Magento\App\Filesystem::ROOT_DIR) ->will($this->returnValue($directoryRead)); $filesystem->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::VAR_DIR) + ->with(\Magento\App\Filesystem::VAR_DIR) ->will($this->returnValue($this->directoryWrite)); return $filesystem; } diff --git a/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php b/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php index 59fd7c82d2c..2dad626d70e 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/Strategy/FallbackTest.php @@ -75,7 +75,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase $this->fallbackFactory = $this->getMock( 'Magento\View\Design\Fallback\Factory', array('createLocaleFileRule', 'createFileRule', 'createViewFileRule'), - array($this->getMock('Magento\Filesystem', array(), array(), '', false)) + array($this->getMock('Magento\App\Filesystem', array(), array(), '', false)) ); $this->fallbackFactory ->expects($this->any())->method('createLocaleFileRule')->will($this->returnValue($this->fallbackLocale)); @@ -225,7 +225,7 @@ class FallbackTest extends \PHPUnit_Framework_TestCase /** * @param string $targetFile - * @return \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @return \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected function getFileSystemMock($targetFile) { @@ -245,10 +245,16 @@ class FallbackTest extends \PHPUnit_Framework_TestCase } ) ); - $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false); + $filesystem = $this->getMock( + 'Magento\App\Filesystem', + array('getDirectoryRead', '__wakeup'), + array(), + '', + false + ); $filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::ROOT) + ->with(\Magento\App\Filesystem::ROOT_DIR) ->will($this->returnValue($directoryMock)); return $filesystem; diff --git a/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/StrategyPoolTest.php b/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/StrategyPoolTest.php index d0e53c5af9c..e3e2c950bb1 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/StrategyPoolTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/FileResolution/StrategyPoolTest.php @@ -46,7 +46,7 @@ class StrategyPoolTest extends \PHPUnit_Framework_TestCase protected $appState; /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $filesystem; @@ -59,10 +59,10 @@ class StrategyPoolTest extends \PHPUnit_Framework_TestCase { $this->objectManager = $this->getMock('Magento\ObjectManager', array(), array(), '', false); $this->appState = $this->getMock('Magento\App\State', array(), array(), '', false); - $this->filesystem = $this->getMock('Magento\Filesystem', array('getPath'), array(), '', false); + $this->filesystem = $this->getMock('Magento\App\Filesystem', array('getPath'), array(), '', false); $pathMap = array( - array(\Magento\Filesystem::VAR_DIR, 'base_dir/var'), - array(\Magento\Filesystem::ROOT, 'base_dir') + array(\Magento\App\Filesystem::VAR_DIR, 'base_dir/var'), + array(\Magento\App\Filesystem::ROOT_DIR, 'base_dir') ); $this->filesystem->expects($this->any()) ->method('getPath') diff --git a/dev/tests/unit/testsuite/Magento/View/Design/Theme/Customization/AbstractFileTest.php b/dev/tests/unit/testsuite/Magento/View/Design/Theme/Customization/AbstractFileTest.php index d5fee8471eb..1491fbab0b5 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/Theme/Customization/AbstractFileTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/Theme/Customization/AbstractFileTest.php @@ -68,7 +68,7 @@ class AbstractFileTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_modelBuilder = $this->getMockBuilder('Magento\View\Design\Theme\Customization\AbstractFile') ->setMethods(array('getType', 'getContentType')) @@ -263,7 +263,7 @@ class AbstractFileTest extends \PHPUnit_Framework_TestCase $directoryMock->expects($this->once())->method('delete')->will($this->returnValue(true)); $this->_filesystem->expects($this->any())->method('getDirectoryWrite') - ->with(\Magento\Filesystem::ROOT)->will($this->returnValue($directoryMock)); + ->with(\Magento\App\Filesystem::ROOT_DIR)->will($this->returnValue($directoryMock)); /** @var $model \Magento\View\Design\Theme\Customization\AbstractFile */ /** @var $file \Magento\Core\Model\Theme\File */ $model->save($file); @@ -290,7 +290,7 @@ class AbstractFileTest extends \PHPUnit_Framework_TestCase $directoryMock->expects($this->once())->method('delete')->will($this->returnValue(true)); $this->_filesystem->expects($this->any())->method('getDirectoryWrite') - ->with(\Magento\Filesystem::ROOT)->will($this->returnValue($directoryMock)); + ->with(\Magento\App\Filesystem::ROOT_DIR)->will($this->returnValue($directoryMock)); $model->expects($this->once())->method('getFullPath')->with($file)->will($this->returnValue('test_path')); /** @var $model \Magento\View\Design\Theme\Customization\AbstractFile */ diff --git a/dev/tests/unit/testsuite/Magento/View/Design/Theme/Customization/PathTest.php b/dev/tests/unit/testsuite/Magento/View/Design/Theme/Customization/PathTest.php index 67e2590f08a..9d9a4158b38 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/Theme/Customization/PathTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/Theme/Customization/PathTest.php @@ -64,7 +64,7 @@ class PathTest extends \PHPUnit_Framework_TestCase $appStateProperty = new \ReflectionProperty('\Magento\Core\Model\Theme', '_appState'); $appStateProperty->setAccessible(true); $appStateProperty->setValue($this->_theme, $this->_appState); - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_directory = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false); $filesystem->expects($this->any()) ->method('getDirectoryRead') diff --git a/dev/tests/unit/testsuite/Magento/View/Design/Theme/Image/UploaderTest.php b/dev/tests/unit/testsuite/Magento/View/Design/Theme/Image/UploaderTest.php index c45dee725f6..80d4694c226 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/Theme/Image/UploaderTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/Theme/Image/UploaderTest.php @@ -59,7 +59,7 @@ class UploaderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_filesystemMock = $this->getMock('Magento\Filesystem', array(), array(), '', false); + $this->_filesystemMock = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $this->_transferAdapterMock = $this->getMock('Zend_File_Transfer_Adapter_Http', array(), array(), '', false); $this->_fileUploader = $this->getMock('Magento\File\Uploader', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/View/Design/Theme/ImageTest.php b/dev/tests/unit/testsuite/Magento/View/Design/Theme/ImageTest.php index 82f66325007..283a6c1cd90 100644 --- a/dev/tests/unit/testsuite/Magento/View/Design/Theme/ImageTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Design/Theme/ImageTest.php @@ -38,7 +38,7 @@ class ImageTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $_filesystemMock; @@ -69,11 +69,11 @@ class ImageTest extends \PHPUnit_Framework_TestCase array('isExist', 'copyFile', 'getRelativePath', 'delete'), array(), '', false, false ); $this->_filesystemMock = $this->getMock( - 'Magento\Filesystem', array('getDirectoryWrite', '__wakeup'), array(), '', false, false + 'Magento\App\Filesystem', array('getDirectoryWrite', '__wakeup'), array(), '', false, false ); $this->_filesystemMock->expects($this->once()) ->method('getDirectoryWrite') - ->with(\Magento\Filesystem::MEDIA) + ->with(\Magento\App\Filesystem::MEDIA_DIR) ->will($this->returnValue($this->_directoryMock)); $imageFactory = $this->getMock('Magento\Image\Factory', array(), array(), '', false, false); $this->_imageMock = $this->getMock('Magento\Image', array(), array(), '', false, false); diff --git a/dev/tests/unit/testsuite/Magento/View/Element/AbstractBlockTest.php b/dev/tests/unit/testsuite/Magento/View/Element/AbstractBlockTest.php index 01bb1159a79..6c2cfee1ef2 100644 --- a/dev/tests/unit/testsuite/Magento/View/Element/AbstractBlockTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Element/AbstractBlockTest.php @@ -99,4 +99,11 @@ class AbstractBlockTest extends \PHPUnit_Framework_TestCase $this->assertEquals('one', $block->getVar('v1')); $this->assertEquals('two', $block->getVar('v2', $module)); } + + public function testIsScopePrivate() + { + $contextMock = $this->getMock('Magento\View\Element\Context', [], [], '', false); + $block = $this->getMockForAbstractClass('Magento\View\Element\AbstractBlock', ['context' => $contextMock]); + $this->assertEquals(false, $block->isScopePrivate()); + } } diff --git a/dev/tests/unit/testsuite/Magento/View/Element/TemplateTest.php b/dev/tests/unit/testsuite/Magento/View/Element/TemplateTest.php index 3a1dde218d1..ffec9a3374f 100644 --- a/dev/tests/unit/testsuite/Magento/View/Element/TemplateTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Element/TemplateTest.php @@ -35,7 +35,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase protected $_block; /** - * @var \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ protected $_filesystem; @@ -53,7 +53,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase { $this->_viewFileSystem = $this->getMock('\Magento\View\FileSystem', array(), array(), '', false); - $this->_filesystem = $this->getMock('\Magento\Filesystem', array(), array(), '', false); + $this->_filesystem = $this->getMock('\Magento\App\Filesystem', array(), array(), '', false); $this->_templateEngine = $this->getMock('Magento\View\TemplateEnginePool', array('render', 'get'), array(), '', false); @@ -115,4 +115,36 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $this->_block->assign($vars); $this->assertEquals($output, $this->_block->fetchView('themedir/template.phtml')); } + + public function testSetTemplateContext() + { + $directoryMock = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false); + $directoryMock->expects($this->any()) + ->method('getRelativePath') + ->will($this->returnArgument(0)); + $this->_filesystem + ->expects($this->once()) + ->method('getDirectoryRead') + ->will($this->returnValue($directoryMock) + ); + $this->_filesystem + ->expects($this->any()) + ->method('getPath') + ->will($this->returnValue('themedir') + ); + $directoryMock->expects($this->once()) + ->method('isFile') + ->with('themedir/template.phtml') + ->will($this->returnValue(true) + ); + + $context = new \Magento\Object(); + $this->_templateEngine + ->expects($this->once()) + ->method('render') + ->with($context) + ; + $this->_block->setTemplateContext($context); + $this->_block->fetchView('themedir/template.phtml'); + } } diff --git a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/BaseTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/BaseTest.php index 749689fcea1..335de657293 100644 --- a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/BaseTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/BaseTest.php @@ -24,8 +24,7 @@ namespace Magento\View\Layout\File\Source; -use Magento\Filesystem, - Magento\Filesystem\Directory\Read, +use Magento\Filesystem\Directory\Read, Magento\View\Layout\File\Factory; class BaseTest extends \PHPUnit_Framework_TestCase @@ -55,7 +54,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase false ); $filesystem = $this->getMock( - 'Magento\Filesystem', + 'Magento\App\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', @@ -63,7 +62,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase ); $filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::MODULES) + ->with(\Magento\App\Filesystem::MODULES_DIR) ->will($this->returnValue($this->directory)); $this->fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/BaseTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/BaseTest.php index 2989832166e..191dc8af4fe 100644 --- a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/BaseTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/BaseTest.php @@ -24,8 +24,7 @@ namespace Magento\View\Layout\File\Source\Override; -use Magento\Filesystem, - Magento\Filesystem\Directory\Read, +use Magento\Filesystem\Directory\Read, Magento\View\Layout\File\Factory; class BaseTest extends \PHPUnit_Framework_TestCase @@ -52,11 +51,11 @@ class BaseTest extends \PHPUnit_Framework_TestCase array('getAbsolutePath', 'search'), array(), '', false ); $filesystem = $this->getMock( - 'Magento\Filesystem', array('getDirectoryRead'), array(), '', false + 'Magento\App\Filesystem', array('getDirectoryRead'), array(), '', false ); $filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::THEMES) + ->with(\Magento\App\Filesystem::THEMES_DIR) ->will($this->returnValue($this->directory)); $this->fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); $this->model = new \Magento\View\Layout\File\Source\Override\Base( diff --git a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/ThemeTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/ThemeTest.php index 41bcecc3cb9..c67b27eb641 100644 --- a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/Override/ThemeTest.php @@ -43,14 +43,14 @@ class ThemeTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $filesystem = $this->getMock('Magento\Filesystem', array('getDirectoryRead'), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array('getDirectoryRead'), array(), '', false); $this->_directory = $this->getMock('Magento\Filesystem\Directory\Read', array(), array(), '', false); $this->_directory->expects($this->any()) ->method('getAbsolutePath') ->will($this->returnArgument(0)); $filesystem->expects($this->any())->method('getDirectoryRead') - ->with($this->equalTo(\Magento\Filesystem::THEMES)) + ->with($this->equalTo(\Magento\App\Filesystem::THEMES_DIR)) ->will($this->returnValue($this->_directory)); $this->_fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); $this->_model = new \Magento\View\Layout\File\Source\Override\Theme( diff --git a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/ThemeTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/ThemeTest.php index 021873e3a98..b197f47a2c6 100644 --- a/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Layout/File/Source/ThemeTest.php @@ -24,8 +24,7 @@ namespace Magento\View\Layout\File\Source; -use Magento\Filesystem, - Magento\Filesystem\Directory\Read, +use Magento\Filesystem\Directory\Read, Magento\View\Layout\File\Factory; class ThemeTest extends \PHPUnit_Framework_TestCase @@ -52,11 +51,11 @@ class ThemeTest extends \PHPUnit_Framework_TestCase array('getAbsolutePath', 'search'), array(), '', false ); $filesystem = $this->getMock( - 'Magento\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false + 'Magento\App\Filesystem', array('getDirectoryRead', '__wakeup'), array(), '', false ); $filesystem->expects($this->once()) ->method('getDirectoryRead') - ->with(\Magento\Filesystem::THEMES) + ->with(\Magento\App\Filesystem::THEMES_DIR) ->will($this->returnValue($this->directory)); $this->fileFactory = $this->getMock('Magento\View\Layout\File\Factory', array(), array(), '', false); $this->model = new \Magento\View\Layout\File\Source\Theme( diff --git a/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php b/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php index a23ba2be576..57150c70cd0 100644 --- a/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Url/CssResolverTest.php @@ -33,10 +33,10 @@ class CssResolverTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $filesystem = $this->getMock('Magento\Filesystem', array('getPath', '__wakeup'), array(), '', false); + $filesystem = $this->getMock('Magento\App\Filesystem', array('getPath', '__wakeup'), array(), '', false); $filesystem->expects($this->any()) ->method('getPath') - ->with(\Magento\Filesystem::ROOT) + ->with(\Magento\App\Filesystem::ROOT_DIR) ->will($this->returnValue('/base_dir/')); $viewFilesystem = $this->getMock('Magento\View\Filesystem', array('normalizePath'), array(), '', false); $viewFilesystem->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/View/UrlTest.php b/dev/tests/unit/testsuite/Magento/View/UrlTest.php index 321ed891cd0..551ef874365 100644 --- a/dev/tests/unit/testsuite/Magento/View/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/View/UrlTest.php @@ -38,8 +38,8 @@ class UrlTest extends \PHPUnit_Framework_TestCase $expected = 'http://example.com/public_dir/a/t/m/file.js'; // 1. Get fileSystem model - /** @var $filesystem \Magento\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ - $filesystem = $this->getMock('Magento\Filesystem', array(), array(), '', false); + /** @var $filesystem \Magento\App\Filesystem|\PHPUnit_Framework_MockObject_MockObject */ + $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $filesystem->expects($this->never()) ->method('isFile'); $filesystem->expects($this->never()) diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php index 6b2f0835a7f..f88ab45dd2b 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php @@ -54,7 +54,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $filesystemMock = $this->getMockBuilder('\Magento\Filesystem') + $filesystemMock = $this->getMockBuilder('\Magento\App\Filesystem') ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php index 983b65e95ad..82632a7763b 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -46,7 +46,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $objectManagerMock = $this->getMockBuilder('Magento\App\ObjectManager') ->disableOriginalConstructor() ->getMock(); - $fileSystemMock = $this->getMockBuilder('Magento\Filesystem')->disableOriginalConstructor()->getMock(); + $fileSystemMock = $this->getMockBuilder('Magento\App\Filesystem')->disableOriginalConstructor()->getMock(); $this->_configMock = $this->getMockBuilder('Magento\Webapi\Model\Config') ->disableOriginalConstructor()->getMock(); $this->_soapConfig = new \Magento\Webapi\Model\Soap\Config( diff --git a/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php b/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php index e1dcb7a37e4..6daefdafe1b 100644 --- a/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php +++ b/dev/tests/unit/testsuite/Magento/Widget/Model/Widget/InstanceTest.php @@ -74,7 +74,7 @@ class InstanceTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); - $filesystemMock =$this->getMock('\Magento\Filesystem', array(), array(), '', false); + $filesystemMock =$this->getMock('\Magento\App\Filesystem', array(), array(), '', false); $this->_directoryMock = $this->getMock('\Magento\Filesystem\Directory\Read', array(), array(), '', false); $filesystemMock->expects($this->any()) ->method('getDirectoryRead') diff --git a/dev/tools/Magento/Tools/Migration/Acl/log/AclXPathToAclId.log b/dev/tools/Magento/Tools/Migration/Acl/log/AclXPathToAclId.log index 563cc95a6b8..f0405f4981b 100644 --- a/dev/tools/Magento/Tools/Migration/Acl/log/AclXPathToAclId.log +++ b/dev/tools/Magento/Tools/Migration/Acl/log/AclXPathToAclId.log @@ -1 +1 @@ -{"config\/acl\/resources\/admin\/cms\/magento_banner":"Magento_Banner::magento_banner","config\/acl\/resources\/admin\/catalog\/events":"Magento_CatalogEvent::events","config\/acl\/resources\/admin\/system\/config\/magento_catalogpermissions":"Magento_CatalogPermissions::magento_catalogpermissions","config\/acl\/resources\/admin\/catalog\/magento_catalogpermissions":"Magento_CatalogPermissions::catalog_magento_catalogpermissions","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout":"Magento_AdvancedCheckout::magento_advancedcheckout","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout\/view":"Magento_AdvancedCheckout::view","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout\/update":"Magento_AdvancedCheckout::update","config\/acl\/resources\/admin\/cms\/page\/save_revision":"Magento_VersionsCms::save_revision","config\/acl\/resources\/admin\/cms\/page\/delete_revision":"Magento_VersionsCms::delete_revision","config\/acl\/resources\/admin\/cms\/page\/publish_revision":"Magento_VersionsCms::publish_revision","config\/acl\/resources\/admin\/cms\/hierarchy":"Magento_VersionsCms::hierarchy","config\/acl\/resources\/admin\/customer\/customersegment":"Magento_CustomerSegment::customersegment","config\/acl\/resources\/admin\/report\/customers\/segment":"Magento_CustomerSegment::segment","config\/acl\/resources\/admin\/customer\/attributes":"Magento_CustomerCustomAttributes::attributes","config\/acl\/resources\/admin\/customer\/attributes\/customer_attributes":"Magento_CustomerCustomAttributes::customer_attributes","config\/acl\/resources\/admin\/customer\/attributes\/customer_address_attributes":"Magento_CustomerCustomAttributes::customer_address_attributes","config\/acl\/resources\/admin\/system\/config\/giftcardaccount":"Magento_GiftCardAccount::giftcardaccount","config\/acl\/resources\/admin\/customer\/giftcardaccount":"Magento_GiftCardAccount::customer_giftcardaccount","config\/acl\/resources\/admin\/system\/config\/giftcard":"Magento_GiftCard::giftcard","config\/acl\/resources\/admin\/system\/config\/magento_giftregistry":"Magento_GiftRegistry::magento_giftregistry","config\/acl\/resources\/admin\/customer\/magento_giftregistry":"Magento_GiftRegistry::customer_magento_giftregistry","config\/acl\/resources\/admin\/sales\/magento_giftwrapping":"Magento_GiftWrapping::magento_giftwrapping","config\/acl\/resources\/admin\/system\/convert\/enterprise_scheduled_operation":"Magento_ScheduledImportExport::enterprise_scheduled_operation","config\/acl\/resources\/admin\/customer\/magento_invitation":"Magento_Invitation::magento_invitation","config\/acl\/resources\/admin\/report\/magento_invitation":"Magento_Invitation::report_magento_invitation","config\/acl\/resources\/admin\/report\/magento_invitation\/general":"Magento_Invitation::general","config\/acl\/resources\/admin\/report\/magento_invitation\/customer":"Magento_Invitation::magento_invitation_customer","config\/acl\/resources\/admin\/report\/magento_invitation\/order":"Magento_Invitation::order","config\/acl\/resources\/admin\/system\/config\/magento_invitation":"Magento_Invitation::config_magento_invitation","config\/acl\/resources\/admin\/system\/config\/logging":"Magento_Logging::logging","config\/acl\/resources\/admin\/system\/magento_logging":"Magento_Logging::magento_logging","config\/acl\/resources\/admin\/system\/magento_logging\/events":"Magento_Logging::magento_logging_events","config\/acl\/resources\/admin\/system\/magento_logging\/backups":"Magento_Logging::backups","config\/acl\/resources\/admin\/system\/crypt_key":"Magento_Pci::crypt_key","config\/acl\/resources\/admin\/system\/acl\/locks":"Magento_Pci::locks","config\/acl\/resources\/admin\/catalog\/products\/read_product_price":"Magento_PricePermissions::read_product_price","config\/acl\/resources\/admin\/catalog\/products\/read_product_price\/edit_product_price":"Magento_PricePermissions::edit_product_price","config\/acl\/resources\/admin\/catalog\/products\/edit_product_status":"Magento_PricePermissions::edit_product_status","config\/acl\/resources\/admin\/promo\/catalog\/edit":"Magento_PromotionPermissions::edit","config\/acl\/resources\/admin\/promo\/quote\/edit":"Magento_PromotionPermissions::quote_edit","config\/acl\/resources\/admin\/promo\/magento_reminder\/edit":"Magento_PromotionPermissions::magento_reminder_edit","config\/acl\/resources\/admin\/promo\/magento_reminder":"Magento_Reminder::magento_reminder","config\/acl\/resources\/admin\/system\/config\/promo":"Magento_SalesRule::config_promo","config\/acl\/resources\/admin\/customer\/manage\/reward_balance":"Magento_Reward::reward_balance","config\/acl\/resources\/admin\/sales\/order\/actions\/create\/reward_spend":"Magento_Reward::reward_spend","config\/acl\/resources\/admin\/customer\/rates":"Magento_Reward::rates","config\/acl\/resources\/admin\/system\/config\/magento_reward":"Magento_Reward::magento_reward","config\/acl\/resources\/admin\/sales\/magento_rma":"Magento_Rma::magento_rma","config\/acl\/resources\/admin\/sales\/magento_rma\/rma_manage":"Magento_Rma::rma_manage","config\/acl\/resources\/admin\/sales\/magento_rma\/rma_attribute":"Magento_Rma::rma_attribute","config\/acl\/resources\/admin\/sales\/archive":"Magento_SalesArchive::archive","config\/acl\/resources\/admin\/sales\/archive\/orders":"Magento_SalesArchive::orders","config\/acl\/resources\/admin\/sales\/archive\/orders\/add":"Magento_SalesArchive::add","config\/acl\/resources\/admin\/sales\/archive\/orders\/remove":"Magento_SalesArchive::remove","config\/acl\/resources\/admin\/sales\/archive\/invoices":"Magento_SalesArchive::invoices","config\/acl\/resources\/admin\/sales\/archive\/shipments":"Magento_SalesArchive::shipments","config\/acl\/resources\/admin\/sales\/archive\/creditmemos":"Magento_SalesArchive::creditmemos","config\/acl\/resources\/admin\/catalog\/targetrule":"Magento_TargetRule::targetrule","config\/acl\/resources\/admin\/report\/customers\/wishlist":"Magento_MultipleWishlist::wishlist","config\/acl\/resources\/admin\/system\/adminnotification":"Magento_AdminNotification::adminnotification","config\/acl\/resources\/admin\/system\/adminnotification\/show_toolbar":"Magento_AdminNotification::show_toolbar","config\/acl\/resources\/admin\/system\/adminnotification\/show_list":"Magento_AdminNotification::show_list","config\/acl\/resources\/admin\/system\/adminnotification\/mark_as_read":"Magento_AdminNotification::mark_as_read","config\/acl\/resources\/admin\/system\/adminnotification\/remove":"Magento_AdminNotification::adminnotification_remove","config\/acl\/resources\/all":"Magento_Adminhtml::all","config\/acl\/resources\/admin":"Magento_Adminhtml::admin","config\/acl\/resources\/admin\/dashboard":"Magento_Adminhtml::dashboard","config\/acl\/resources\/admin\/system":"Magento_Adminhtml::system","config\/acl\/resources\/admin\/system\/store":"Magento_Adminhtml::store","config\/acl\/resources\/admin\/system\/design":"Magento_Adminhtml::design","config\/acl\/resources\/admin\/system\/design\/schedule":"Magento_Adminhtml::schedule","config\/acl\/resources\/admin\/system\/config":"Magento_Adminhtml::config","config\/acl\/resources\/admin\/system\/config\/general":"Magento_Adminhtml::config_general","config\/acl\/resources\/admin\/system\/config\/web":"Magento_Adminhtml::web","config\/acl\/resources\/admin\/system\/config\/design":"Magento_Adminhtml::config_design","config\/acl\/resources\/admin\/system\/config\/system":"Magento_Adminhtml::config_system","config\/acl\/resources\/admin\/system\/config\/advanced":"Magento_Adminhtml::advanced","config\/acl\/resources\/admin\/system\/config\/trans_email":"Magento_Adminhtml::trans_email","config\/acl\/resources\/admin\/system\/config\/dev":"Magento_Adminhtml::dev","config\/acl\/resources\/admin\/system\/config\/currency":"Magento_Adminhtml::currency","config\/acl\/resources\/admin\/system\/config\/sendfriend":"Magento_Adminhtml::sendfriend","config\/acl\/resources\/admin\/system\/config\/admin":"Magento_Adminhtml::config_admin","config\/acl\/resources\/admin\/system\/currency":"Magento_CurrencySymbol::system_currency","config\/acl\/resources\/admin\/system\/email_template":"Magento_Email::template","config\/acl\/resources\/admin\/system\/variable":"Magento_Adminhtml::variable","config\/acl\/resources\/admin\/system\/myaccount":"Magento_Adminhtml::myaccount","config\/acl\/resources\/admin\/system\/tools":"Magento_Adminhtml::tools","config\/acl\/resources\/admin\/system\/convert":"Magento_Adminhtml::convert","config\/acl\/resources\/admin\/system\/cache":"Magento_Adminhtml::cache","config\/acl\/resources\/admin\/system\/extensions":"Magento_Adminhtml::extensions","config\/acl\/resources\/admin\/system\/extensions\/local":"Magento_Adminhtml::local","config\/acl\/resources\/admin\/system\/extensions\/custom":"Magento_Adminhtml::custom","config\/acl\/resources\/admin\/global_search":"Magento_Adminhtml::global_search","config\/acl\/resources\/admin\/system\/tools\/backup":"Magento_Backup::backup","config\/acl\/resources\/admin\/system\/tools\/backup\/rollback":"Magento_Backup::rollback","config\/acl\/resources\/admin\/system\/config\/cataloginventory":"Magento_CatalogInventory::cataloginventory","config\/acl\/resources\/admin\/promo":"Magento_CatalogRule::promo","config\/acl\/resources\/admin\/promo\/catalog":"Magento_CatalogRule::promo_catalog","config\/acl\/resources\/admin\/catalog\/search":"Magento_CatalogSearch::search","config\/acl\/resources\/admin\/system\/config\/catalog":"Magento_Catalog::config_catalog","config\/acl\/resources\/admin\/catalog":"Magento_Catalog::catalog","config\/acl\/resources\/admin\/catalog\/attributes":"Magento_Catalog::catalog_attributes","config\/acl\/resources\/admin\/catalog\/attributes\/attributes":"Magento_Catalog::attributes_attributes","config\/acl\/resources\/admin\/catalog\/attributes\/sets":"Magento_Catalog::sets","config\/acl\/resources\/admin\/catalog\/categories":"Magento_Catalog::categories","config\/acl\/resources\/admin\/catalog\/products":"Magento_Catalog::products","config\/acl\/resources\/admin\/catalog\/update_attributes":"Magento_Catalog::update_attributes","config\/acl\/resources\/admin\/catalog\/urlrewrite":"Magento_Catalog::urlrewrite","config\/acl\/resources\/admin\/sales\/checkoutagreement":"Magento_Checkout::checkoutagreement","config\/acl\/resources\/admin\/system\/config\/checkout":"Magento_Checkout::checkout","config\/acl\/resources\/admin\/cms":"Magento_Cms::cms","config\/acl\/resources\/admin\/cms\/block":"Magento_Cms::block","config\/acl\/resources\/admin\/cms\/page":"Magento_Cms::page","config\/acl\/resources\/admin\/cms\/page\/save":"Magento_Cms::save","config\/acl\/resources\/admin\/cms\/page\/delete":"Magento_Cms::page_delete","config\/acl\/resources\/admin\/cms\/media_gallery":"Magento_Cms::media_gallery","config\/acl\/resources\/admin\/system\/config\/cms":"Magento_Cms::config_cms","config\/acl\/resources\/admin\/system\/config\/contacts":"Magento_Contacts::contacts","config\/acl\/resources\/admin\/system\/currency\/rates":"Magento_CurrencySymbol::currency_rates","config\/acl\/resources\/admin\/system\/currency\/symbols":"Magento_CurrencySymbol::symbols","config\/acl\/resources\/admin\/customer":"Magento_Customer::customer","config\/acl\/resources\/admin\/customer\/group":"Magento_Customer::group","config\/acl\/resources\/admin\/customer\/manage":"Magento_Customer::manage","config\/acl\/resources\/admin\/customer\/online":"Magento_Customer::online","config\/acl\/resources\/admin\/system\/config\/customer":"Magento_Customer::config_customer","config\/acl\/resources\/admin\/system\/design\/editor":"Magento_DesignEditor::editor","config\/acl\/resources\/admin\/system\/config\/downloadable":"Magento_Downloadable::downloadable","config\/acl\/resources\/admin\/system\/config\/google":"Magento_GoogleCheckout::google","config\/acl\/resources\/admin\/catalog\/googleshopping":"Magento_GoogleShopping::googleshopping","config\/acl\/resources\/admin\/catalog\/googleshopping\/types":"Magento_GoogleShopping::types","config\/acl\/resources\/admin\/catalog\/googleshopping\/items":"Magento_GoogleShopping::items","config\/acl\/resources\/admin\/system\/convert\/import":"Magento_ImportExport::import","config\/acl\/resources\/admin\/system\/convert\/export":"Magento_ImportExport::export","config\/acl\/resources\/admin\/system\/index":"Magento_Index::index","config\/acl\/resources\/admin\/system\/config\/newsletter":"Magento_Newsletter::newsletter","config\/acl\/resources\/admin\/newsletter":"Magento_Newsletter::admin_newsletter","config\/acl\/resources\/admin\/newsletter\/problem":"Magento_Newsletter::problem","config\/acl\/resources\/admin\/newsletter\/queue":"Magento_Newsletter::queue","config\/acl\/resources\/admin\/newsletter\/subscriber":"Magento_Newsletter::subscriber","config\/acl\/resources\/admin\/newsletter\/template":"Magento_Newsletter::template","config\/acl\/resources\/admin\/system\/config\/oauth":"Magento_Oauth::oauth","config\/acl\/resources\/admin\/page_cache":"Magento_PageCache::page_cache","config\/acl\/resources\/admin\/system\/config\/payment":"Magento_Payment::payment","config\/acl\/resources\/admin\/system\/config\/payment_services":"Magento_Payment::payment_services","config\/acl\/resources\/admin\/system\/config\/paypal":"Magento_Paypal::paypal","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports":"Magento_Paypal::paypal_settlement_reports","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports\/view":"Magento_Paypal::paypal_settlement_reports_view","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports\/fetch":"Magento_Paypal::fetch","config\/acl\/resources\/admin\/system\/config\/persistent":"Magento_Persistent::persistent","config\/acl\/resources\/admin\/cms\/poll":"Magento_Poll::poll","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/ratings":"Magento_Rating::ratings","config\/acl\/resources\/admin\/report":"Magento_Reports::report","config\/acl\/resources\/admin\/report\/salesroot":"Magento_Reports::salesroot","config\/acl\/resources\/admin\/report\/salesroot\/sales":"Magento_Reports::salesroot_sales","config\/acl\/resources\/admin\/report\/salesroot\/tax":"Magento_Reports::tax","config\/acl\/resources\/admin\/report\/salesroot\/shipping":"Magento_Reports::shipping","config\/acl\/resources\/admin\/report\/salesroot\/invoiced":"Magento_Reports::invoiced","config\/acl\/resources\/admin\/report\/salesroot\/refunded":"Magento_Reports::refunded","config\/acl\/resources\/admin\/report\/salesroot\/coupons":"Magento_Reports::coupons","config\/acl\/resources\/admin\/report\/shopcart":"Magento_Reports::shopcart","config\/acl\/resources\/admin\/report\/shopcart\/product":"Magento_Reports::product","config\/acl\/resources\/admin\/report\/shopcart\/abandoned":"Magento_Reports::abandoned","config\/acl\/resources\/admin\/report\/products":"Magento_Reports::report_products","config\/acl\/resources\/admin\/report\/products\/bestsellers":"Magento_Reports::bestsellers","config\/acl\/resources\/admin\/report\/products\/sold":"Magento_Reports::sold","config\/acl\/resources\/admin\/report\/products\/viewed":"Magento_Reports::viewed","config\/acl\/resources\/admin\/report\/products\/lowstock":"Magento_Reports::lowstock","config\/acl\/resources\/admin\/report\/products\/downloads":"Magento_Reports::downloads","config\/acl\/resources\/admin\/report\/customers":"Magento_Reports::customers","config\/acl\/resources\/admin\/report\/customers\/accounts":"Magento_Reports::accounts","config\/acl\/resources\/admin\/report\/customers\/totals":"Magento_Reports::totals","config\/acl\/resources\/admin\/report\/customers\/orders":"Magento_Reports::customers_orders","config\/acl\/resources\/admin\/report\/review":"Magento_Reports::review","config\/acl\/resources\/admin\/report\/review\/customer":"Magento_Reports::review_customer","config\/acl\/resources\/admin\/report\/review\/product":"Magento_Reports::review_product","config\/acl\/resources\/admin\/report\/tags":"Magento_Reports::tags","config\/acl\/resources\/admin\/report\/tags\/customer":"Magento_Reports::tags_customer","config\/acl\/resources\/admin\/report\/tags\/popular":"Magento_Reports::popular","config\/acl\/resources\/admin\/report\/tags\/product":"Magento_Reports::tags_product","config\/acl\/resources\/admin\/report\/search":"Magento_Reports::report_search","config\/acl\/resources\/admin\/report\/statistics":"Magento_Reports::statistics","config\/acl\/resources\/admin\/system\/config\/reports":"Magento_Reports::reports","config\/acl\/resources\/admin\/catalog\/reviews_ratings":"Magento_Review::reviews_ratings","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews":"Magento_Review::reviews","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews\/all":"Magento_Review::reviews_all","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews\/pending":"Magento_Review::pending","config\/acl\/resources\/admin\/system\/config\/rss":"Magento_Rss::rss","config\/acl\/resources\/admin\/promo\/quote":"Magento_SalesRule::quote","config\/acl\/resources\/admin\/sales":"Magento_Sales::sales","config\/acl\/resources\/admin\/sales\/order":"Magento_Sales::sales_order","config\/acl\/resources\/admin\/sales\/order\/actions":"Magento_Sales::actions","config\/acl\/resources\/admin\/sales\/order\/actions\/create":"Magento_Sales::create","config\/acl\/resources\/admin\/sales\/order\/actions\/view":"Magento_Sales::actions_view","config\/acl\/resources\/admin\/sales\/order\/actions\/email":"Magento_Sales::email","config\/acl\/resources\/admin\/sales\/order\/actions\/reorder":"Magento_Sales::reorder","config\/acl\/resources\/admin\/sales\/order\/actions\/edit":"Magento_Sales::actions_edit","config\/acl\/resources\/admin\/sales\/order\/actions\/cancel":"Magento_Sales::cancel","config\/acl\/resources\/admin\/sales\/order\/actions\/review_payment":"Magento_Sales::review_payment","config\/acl\/resources\/admin\/sales\/order\/actions\/capture":"Magento_Sales::capture","config\/acl\/resources\/admin\/sales\/order\/actions\/invoice":"Magento_Sales::invoice","config\/acl\/resources\/admin\/sales\/order\/actions\/creditmemo":"Magento_Sales::creditmemo","config\/acl\/resources\/admin\/sales\/order\/actions\/hold":"Magento_Sales::hold","config\/acl\/resources\/admin\/sales\/order\/actions\/unhold":"Magento_Sales::unhold","config\/acl\/resources\/admin\/sales\/order\/actions\/ship":"Magento_Sales::ship","config\/acl\/resources\/admin\/sales\/order\/actions\/comment":"Magento_Sales::comment","config\/acl\/resources\/admin\/sales\/order\/actions\/emails":"Magento_Sales::emails","config\/acl\/resources\/admin\/sales\/invoice":"Magento_Sales::sales_invoice","config\/acl\/resources\/admin\/sales\/shipment":"Magento_Sales::shipment","config\/acl\/resources\/admin\/sales\/creditmemo":"Magento_Sales::sales_creditmemo","config\/acl\/resources\/admin\/sales\/transactions":"Magento_Sales::transactions","config\/acl\/resources\/admin\/sales\/transactions\/fetch":"Magento_Sales::transactions_fetch","config\/acl\/resources\/admin\/sales\/recurring_profile":"Magento_Sales::recurring_profile","config\/acl\/resources\/admin\/sales\/billing_agreement":"Magento_Sales::billing_agreement","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions":"Magento_Sales::billing_agreement_actions","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/view":"Magento_Sales::billing_agreement_actions_view","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/manage":"Magento_Sales::actions_manage","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/use":"Magento_Sales::use","config\/acl\/resources\/admin\/system\/order_statuses":"Magento_Sales::order_statuses","config\/acl\/resources\/admin\/system\/config\/sales":"Magento_Sales::config_sales","config\/acl\/resources\/admin\/system\/config\/sales_email":"Magento_Sales::sales_email","config\/acl\/resources\/admin\/system\/config\/sales_pdf":"Magento_Sales::sales_pdf","config\/acl\/resources\/admin\/system\/config\/shipping":"Magento_Shipping::config_shipping","config\/acl\/resources\/admin\/system\/config\/carriers":"Magento_Shipping::carriers","config\/acl\/resources\/admin\/catalog\/sitemap":"Magento_Sitemap::sitemap","config\/acl\/resources\/admin\/system\/config\/sitemap":"Magento_Sitemap::config_sitemap","config\/acl\/resources\/admin\/sales\/tax":"Magento_Tax::sales_tax","config\/acl\/resources\/admin\/sales\/tax\/classes_customer":"Magento_Tax::classes_customer","config\/acl\/resources\/admin\/sales\/tax\/classes_product":"Magento_Tax::classes_product","config\/acl\/resources\/admin\/sales\/tax\/import_export":"Magento_Tax::import_export","config\/acl\/resources\/admin\/sales\/tax\/rates":"Magento_Tax::tax_rates","config\/acl\/resources\/admin\/sales\/tax\/rules":"Magento_Tax::rules","config\/acl\/resources\/admin\/system\/config\/tax":"Magento_Tax::config_tax","config\/acl\/resources\/admin\/system\/acl":"Magento_User::acl","config\/acl\/resources\/admin\/system\/acl\/roles":"Magento_User::acl_roles","config\/acl\/resources\/admin\/system\/acl\/users":"Magento_User::acl_users","config\/acl\/resources\/admin\/cms\/widget_instance":"Magento_Widget::widget_instance","config\/acl\/resources\/admin\/system\/config\/wishlist":"Magento_Wishlist::config_wishlist"} +{"config\/acl\/resources\/admin\/cms\/magento_banner":"Magento_Banner::magento_banner","config\/acl\/resources\/admin\/catalog\/events":"Magento_CatalogEvent::events","config\/acl\/resources\/admin\/system\/config\/magento_catalogpermissions":"Magento_CatalogPermissions::magento_catalogpermissions","config\/acl\/resources\/admin\/catalog\/magento_catalogpermissions":"Magento_CatalogPermissions::catalog_magento_catalogpermissions","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout":"Magento_AdvancedCheckout::magento_advancedcheckout","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout\/view":"Magento_AdvancedCheckout::view","config\/acl\/resources\/admin\/sales\/magento_advancedcheckout\/update":"Magento_AdvancedCheckout::update","config\/acl\/resources\/admin\/cms\/page\/save_revision":"Magento_VersionsCms::save_revision","config\/acl\/resources\/admin\/cms\/page\/delete_revision":"Magento_VersionsCms::delete_revision","config\/acl\/resources\/admin\/cms\/page\/publish_revision":"Magento_VersionsCms::publish_revision","config\/acl\/resources\/admin\/cms\/hierarchy":"Magento_VersionsCms::hierarchy","config\/acl\/resources\/admin\/customer\/customersegment":"Magento_CustomerSegment::customersegment","config\/acl\/resources\/admin\/report\/customers\/segment":"Magento_CustomerSegment::segment","config\/acl\/resources\/admin\/customer\/attributes":"Magento_CustomerCustomAttributes::attributes","config\/acl\/resources\/admin\/customer\/attributes\/customer_attributes":"Magento_CustomerCustomAttributes::customer_attributes","config\/acl\/resources\/admin\/customer\/attributes\/customer_address_attributes":"Magento_CustomerCustomAttributes::customer_address_attributes","config\/acl\/resources\/admin\/system\/config\/giftcardaccount":"Magento_GiftCardAccount::giftcardaccount","config\/acl\/resources\/admin\/customer\/giftcardaccount":"Magento_GiftCardAccount::customer_giftcardaccount","config\/acl\/resources\/admin\/system\/config\/giftcard":"Magento_GiftCard::giftcard","config\/acl\/resources\/admin\/system\/config\/magento_giftregistry":"Magento_GiftRegistry::magento_giftregistry","config\/acl\/resources\/admin\/customer\/magento_giftregistry":"Magento_GiftRegistry::customer_magento_giftregistry","config\/acl\/resources\/admin\/sales\/magento_giftwrapping":"Magento_GiftWrapping::magento_giftwrapping","config\/acl\/resources\/admin\/system\/convert\/enterprise_scheduled_operation":"Magento_ScheduledImportExport::enterprise_scheduled_operation","config\/acl\/resources\/admin\/customer\/magento_invitation":"Magento_Invitation::magento_invitation","config\/acl\/resources\/admin\/report\/magento_invitation":"Magento_Invitation::report_magento_invitation","config\/acl\/resources\/admin\/report\/magento_invitation\/general":"Magento_Invitation::general","config\/acl\/resources\/admin\/report\/magento_invitation\/customer":"Magento_Invitation::magento_invitation_customer","config\/acl\/resources\/admin\/report\/magento_invitation\/order":"Magento_Invitation::order","config\/acl\/resources\/admin\/system\/config\/magento_invitation":"Magento_Invitation::config_magento_invitation","config\/acl\/resources\/admin\/system\/config\/logging":"Magento_Logging::logging","config\/acl\/resources\/admin\/system\/magento_logging":"Magento_Logging::magento_logging","config\/acl\/resources\/admin\/system\/magento_logging\/events":"Magento_Logging::magento_logging_events","config\/acl\/resources\/admin\/system\/magento_logging\/backups":"Magento_Logging::backups","config\/acl\/resources\/admin\/system\/crypt_key":"Magento_Pci::crypt_key","config\/acl\/resources\/admin\/system\/acl\/locks":"Magento_Pci::locks","config\/acl\/resources\/admin\/catalog\/products\/read_product_price":"Magento_PricePermissions::read_product_price","config\/acl\/resources\/admin\/catalog\/products\/read_product_price\/edit_product_price":"Magento_PricePermissions::edit_product_price","config\/acl\/resources\/admin\/catalog\/products\/edit_product_status":"Magento_PricePermissions::edit_product_status","config\/acl\/resources\/admin\/promo\/catalog\/edit":"Magento_PromotionPermissions::edit","config\/acl\/resources\/admin\/promo\/quote\/edit":"Magento_PromotionPermissions::quote_edit","config\/acl\/resources\/admin\/promo\/magento_reminder\/edit":"Magento_PromotionPermissions::magento_reminder_edit","config\/acl\/resources\/admin\/promo\/magento_reminder":"Magento_Reminder::magento_reminder","config\/acl\/resources\/admin\/system\/config\/promo":"Magento_SalesRule::config_promo","config\/acl\/resources\/admin\/customer\/manage\/reward_balance":"Magento_Reward::reward_balance","config\/acl\/resources\/admin\/sales\/order\/actions\/create\/reward_spend":"Magento_Reward::reward_spend","config\/acl\/resources\/admin\/customer\/rates":"Magento_Reward::rates","config\/acl\/resources\/admin\/system\/config\/magento_reward":"Magento_Reward::magento_reward","config\/acl\/resources\/admin\/sales\/magento_rma":"Magento_Rma::magento_rma","config\/acl\/resources\/admin\/sales\/magento_rma\/rma_manage":"Magento_Rma::rma_manage","config\/acl\/resources\/admin\/sales\/magento_rma\/rma_attribute":"Magento_Rma::rma_attribute","config\/acl\/resources\/admin\/sales\/archive":"Magento_SalesArchive::archive","config\/acl\/resources\/admin\/sales\/archive\/orders":"Magento_SalesArchive::orders","config\/acl\/resources\/admin\/sales\/archive\/orders\/add":"Magento_SalesArchive::add","config\/acl\/resources\/admin\/sales\/archive\/orders\/remove":"Magento_SalesArchive::remove","config\/acl\/resources\/admin\/sales\/archive\/invoices":"Magento_SalesArchive::invoices","config\/acl\/resources\/admin\/sales\/archive\/shipments":"Magento_SalesArchive::shipments","config\/acl\/resources\/admin\/sales\/archive\/creditmemos":"Magento_SalesArchive::creditmemos","config\/acl\/resources\/admin\/catalog\/targetrule":"Magento_TargetRule::targetrule","config\/acl\/resources\/admin\/report\/customers\/wishlist":"Magento_MultipleWishlist::wishlist","config\/acl\/resources\/admin\/system\/adminnotification":"Magento_AdminNotification::adminnotification","config\/acl\/resources\/admin\/system\/adminnotification\/show_toolbar":"Magento_AdminNotification::show_toolbar","config\/acl\/resources\/admin\/system\/adminnotification\/show_list":"Magento_AdminNotification::show_list","config\/acl\/resources\/admin\/system\/adminnotification\/mark_as_read":"Magento_AdminNotification::mark_as_read","config\/acl\/resources\/admin\/system\/adminnotification\/remove":"Magento_AdminNotification::adminnotification_remove","config\/acl\/resources\/all":"Magento_Adminhtml::all","config\/acl\/resources\/admin":"Magento_Adminhtml::admin","config\/acl\/resources\/admin\/dashboard":"Magento_Adminhtml::dashboard","config\/acl\/resources\/admin\/system":"Magento_Adminhtml::system","config\/acl\/resources\/admin\/system\/store":"Magento_Adminhtml::store","config\/acl\/resources\/admin\/system\/design":"Magento_Adminhtml::design","config\/acl\/resources\/admin\/system\/design\/schedule":"Magento_Adminhtml::schedule","config\/acl\/resources\/admin\/system\/config":"Magento_Adminhtml::config","config\/acl\/resources\/admin\/system\/config\/general":"Magento_Adminhtml::config_general","config\/acl\/resources\/admin\/system\/config\/web":"Magento_Adminhtml::web","config\/acl\/resources\/admin\/system\/config\/design":"Magento_Adminhtml::config_design","config\/acl\/resources\/admin\/system\/config\/system":"Magento_Adminhtml::config_system","config\/acl\/resources\/admin\/system\/config\/advanced":"Magento_Adminhtml::advanced","config\/acl\/resources\/admin\/system\/config\/trans_email":"Magento_Adminhtml::trans_email","config\/acl\/resources\/admin\/system\/config\/dev":"Magento_Adminhtml::dev","config\/acl\/resources\/admin\/system\/config\/currency":"Magento_Adminhtml::currency","config\/acl\/resources\/admin\/system\/config\/sendfriend":"Magento_Adminhtml::sendfriend","config\/acl\/resources\/admin\/system\/config\/admin":"Magento_Adminhtml::config_admin","config\/acl\/resources\/admin\/system\/currency":"Magento_CurrencySymbol::system_currency","config\/acl\/resources\/admin\/system\/email_template":"Magento_Email::template","config\/acl\/resources\/admin\/system\/variable":"Magento_Adminhtml::variable","config\/acl\/resources\/admin\/system\/myaccount":"Magento_Adminhtml::myaccount","config\/acl\/resources\/admin\/system\/tools":"Magento_Adminhtml::tools","config\/acl\/resources\/admin\/system\/convert":"Magento_Adminhtml::convert","config\/acl\/resources\/admin\/system\/cache":"Magento_Adminhtml::cache","config\/acl\/resources\/admin\/system\/extensions":"Magento_Adminhtml::extensions","config\/acl\/resources\/admin\/system\/extensions\/local":"Magento_Adminhtml::local","config\/acl\/resources\/admin\/system\/extensions\/custom":"Magento_Adminhtml::custom","config\/acl\/resources\/admin\/global_search":"Magento_Adminhtml::global_search","config\/acl\/resources\/admin\/system\/tools\/backup":"Magento_Backup::backup","config\/acl\/resources\/admin\/system\/tools\/backup\/rollback":"Magento_Backup::rollback","config\/acl\/resources\/admin\/system\/config\/cataloginventory":"Magento_CatalogInventory::cataloginventory","config\/acl\/resources\/admin\/promo":"Magento_CatalogRule::promo","config\/acl\/resources\/admin\/promo\/catalog":"Magento_CatalogRule::promo_catalog","config\/acl\/resources\/admin\/catalog\/search":"Magento_CatalogSearch::search","config\/acl\/resources\/admin\/system\/config\/catalog":"Magento_Catalog::config_catalog","config\/acl\/resources\/admin\/catalog":"Magento_Catalog::catalog","config\/acl\/resources\/admin\/catalog\/attributes":"Magento_Catalog::catalog_attributes","config\/acl\/resources\/admin\/catalog\/attributes\/attributes":"Magento_Catalog::attributes_attributes","config\/acl\/resources\/admin\/catalog\/attributes\/sets":"Magento_Catalog::sets","config\/acl\/resources\/admin\/catalog\/categories":"Magento_Catalog::categories","config\/acl\/resources\/admin\/catalog\/products":"Magento_Catalog::products","config\/acl\/resources\/admin\/catalog\/update_attributes":"Magento_Catalog::update_attributes","config\/acl\/resources\/admin\/catalog\/urlrewrite":"Magento_Catalog::urlrewrite","config\/acl\/resources\/admin\/sales\/checkoutagreement":"Magento_Checkout::checkoutagreement","config\/acl\/resources\/admin\/system\/config\/checkout":"Magento_Checkout::checkout","config\/acl\/resources\/admin\/cms":"Magento_Cms::cms","config\/acl\/resources\/admin\/cms\/block":"Magento_Cms::block","config\/acl\/resources\/admin\/cms\/page":"Magento_Cms::page","config\/acl\/resources\/admin\/cms\/page\/save":"Magento_Cms::save","config\/acl\/resources\/admin\/cms\/page\/delete":"Magento_Cms::page_delete","config\/acl\/resources\/admin\/cms\/media_gallery":"Magento_Cms::media_gallery","config\/acl\/resources\/admin\/system\/config\/cms":"Magento_Cms::config_cms","config\/acl\/resources\/admin\/system\/config\/contacts":"Magento_Contacts::contacts","config\/acl\/resources\/admin\/system\/currency\/rates":"Magento_CurrencySymbol::currency_rates","config\/acl\/resources\/admin\/system\/currency\/symbols":"Magento_CurrencySymbol::symbols","config\/acl\/resources\/admin\/customer":"Magento_Customer::customer","config\/acl\/resources\/admin\/customer\/group":"Magento_Customer::group","config\/acl\/resources\/admin\/customer\/manage":"Magento_Customer::manage","config\/acl\/resources\/admin\/customer\/online":"Magento_Customer::online","config\/acl\/resources\/admin\/system\/config\/customer":"Magento_Customer::config_customer","config\/acl\/resources\/admin\/system\/design\/editor":"Magento_DesignEditor::editor","config\/acl\/resources\/admin\/system\/config\/downloadable":"Magento_Downloadable::downloadable","config\/acl\/resources\/admin\/system\/config\/google":"Magento_GoogleCheckout::google","config\/acl\/resources\/admin\/catalog\/googleshopping":"Magento_GoogleShopping::googleshopping","config\/acl\/resources\/admin\/catalog\/googleshopping\/types":"Magento_GoogleShopping::types","config\/acl\/resources\/admin\/catalog\/googleshopping\/items":"Magento_GoogleShopping::items","config\/acl\/resources\/admin\/system\/convert\/import":"Magento_ImportExport::import","config\/acl\/resources\/admin\/system\/convert\/export":"Magento_ImportExport::export","config\/acl\/resources\/admin\/system\/index":"Magento_Index::index","config\/acl\/resources\/admin\/system\/config\/newsletter":"Magento_Newsletter::newsletter","config\/acl\/resources\/admin\/newsletter":"Magento_Newsletter::admin_newsletter","config\/acl\/resources\/admin\/newsletter\/problem":"Magento_Newsletter::problem","config\/acl\/resources\/admin\/newsletter\/queue":"Magento_Newsletter::queue","config\/acl\/resources\/admin\/newsletter\/subscriber":"Magento_Newsletter::subscriber","config\/acl\/resources\/admin\/newsletter\/template":"Magento_Newsletter::template","config\/acl\/resources\/admin\/system\/config\/oauth":"Magento_Oauth::oauth","config\/acl\/resources\/admin\/system\/config\/payment":"Magento_Payment::payment","config\/acl\/resources\/admin\/system\/config\/payment_services":"Magento_Payment::payment_services","config\/acl\/resources\/admin\/system\/config\/paypal":"Magento_Paypal::paypal","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports":"Magento_Paypal::paypal_settlement_reports","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports\/view":"Magento_Paypal::paypal_settlement_reports_view","config\/acl\/resources\/admin\/report\/salesroot\/paypal_settlement_reports\/fetch":"Magento_Paypal::fetch","config\/acl\/resources\/admin\/system\/config\/persistent":"Magento_Persistent::persistent","config\/acl\/resources\/admin\/cms\/poll":"Magento_Poll::poll","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/ratings":"Magento_Rating::ratings","config\/acl\/resources\/admin\/report":"Magento_Reports::report","config\/acl\/resources\/admin\/report\/salesroot":"Magento_Reports::salesroot","config\/acl\/resources\/admin\/report\/salesroot\/sales":"Magento_Reports::salesroot_sales","config\/acl\/resources\/admin\/report\/salesroot\/tax":"Magento_Reports::tax","config\/acl\/resources\/admin\/report\/salesroot\/shipping":"Magento_Reports::shipping","config\/acl\/resources\/admin\/report\/salesroot\/invoiced":"Magento_Reports::invoiced","config\/acl\/resources\/admin\/report\/salesroot\/refunded":"Magento_Reports::refunded","config\/acl\/resources\/admin\/report\/salesroot\/coupons":"Magento_Reports::coupons","config\/acl\/resources\/admin\/report\/shopcart":"Magento_Reports::shopcart","config\/acl\/resources\/admin\/report\/shopcart\/product":"Magento_Reports::product","config\/acl\/resources\/admin\/report\/shopcart\/abandoned":"Magento_Reports::abandoned","config\/acl\/resources\/admin\/report\/products":"Magento_Reports::report_products","config\/acl\/resources\/admin\/report\/products\/bestsellers":"Magento_Reports::bestsellers","config\/acl\/resources\/admin\/report\/products\/sold":"Magento_Reports::sold","config\/acl\/resources\/admin\/report\/products\/viewed":"Magento_Reports::viewed","config\/acl\/resources\/admin\/report\/products\/lowstock":"Magento_Reports::lowstock","config\/acl\/resources\/admin\/report\/products\/downloads":"Magento_Reports::downloads","config\/acl\/resources\/admin\/report\/customers":"Magento_Reports::customers","config\/acl\/resources\/admin\/report\/customers\/accounts":"Magento_Reports::accounts","config\/acl\/resources\/admin\/report\/customers\/totals":"Magento_Reports::totals","config\/acl\/resources\/admin\/report\/customers\/orders":"Magento_Reports::customers_orders","config\/acl\/resources\/admin\/report\/review":"Magento_Reports::review","config\/acl\/resources\/admin\/report\/review\/customer":"Magento_Reports::review_customer","config\/acl\/resources\/admin\/report\/review\/product":"Magento_Reports::review_product","config\/acl\/resources\/admin\/report\/tags":"Magento_Reports::tags","config\/acl\/resources\/admin\/report\/tags\/customer":"Magento_Reports::tags_customer","config\/acl\/resources\/admin\/report\/tags\/popular":"Magento_Reports::popular","config\/acl\/resources\/admin\/report\/tags\/product":"Magento_Reports::tags_product","config\/acl\/resources\/admin\/report\/search":"Magento_Reports::report_search","config\/acl\/resources\/admin\/report\/statistics":"Magento_Reports::statistics","config\/acl\/resources\/admin\/system\/config\/reports":"Magento_Reports::reports","config\/acl\/resources\/admin\/catalog\/reviews_ratings":"Magento_Review::reviews_ratings","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews":"Magento_Review::reviews","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews\/all":"Magento_Review::reviews_all","config\/acl\/resources\/admin\/catalog\/reviews_ratings\/reviews\/pending":"Magento_Review::pending","config\/acl\/resources\/admin\/system\/config\/rss":"Magento_Rss::rss","config\/acl\/resources\/admin\/promo\/quote":"Magento_SalesRule::quote","config\/acl\/resources\/admin\/sales":"Magento_Sales::sales","config\/acl\/resources\/admin\/sales\/order":"Magento_Sales::sales_order","config\/acl\/resources\/admin\/sales\/order\/actions":"Magento_Sales::actions","config\/acl\/resources\/admin\/sales\/order\/actions\/create":"Magento_Sales::create","config\/acl\/resources\/admin\/sales\/order\/actions\/view":"Magento_Sales::actions_view","config\/acl\/resources\/admin\/sales\/order\/actions\/email":"Magento_Sales::email","config\/acl\/resources\/admin\/sales\/order\/actions\/reorder":"Magento_Sales::reorder","config\/acl\/resources\/admin\/sales\/order\/actions\/edit":"Magento_Sales::actions_edit","config\/acl\/resources\/admin\/sales\/order\/actions\/cancel":"Magento_Sales::cancel","config\/acl\/resources\/admin\/sales\/order\/actions\/review_payment":"Magento_Sales::review_payment","config\/acl\/resources\/admin\/sales\/order\/actions\/capture":"Magento_Sales::capture","config\/acl\/resources\/admin\/sales\/order\/actions\/invoice":"Magento_Sales::invoice","config\/acl\/resources\/admin\/sales\/order\/actions\/creditmemo":"Magento_Sales::creditmemo","config\/acl\/resources\/admin\/sales\/order\/actions\/hold":"Magento_Sales::hold","config\/acl\/resources\/admin\/sales\/order\/actions\/unhold":"Magento_Sales::unhold","config\/acl\/resources\/admin\/sales\/order\/actions\/ship":"Magento_Sales::ship","config\/acl\/resources\/admin\/sales\/order\/actions\/comment":"Magento_Sales::comment","config\/acl\/resources\/admin\/sales\/order\/actions\/emails":"Magento_Sales::emails","config\/acl\/resources\/admin\/sales\/invoice":"Magento_Sales::sales_invoice","config\/acl\/resources\/admin\/sales\/shipment":"Magento_Sales::shipment","config\/acl\/resources\/admin\/sales\/creditmemo":"Magento_Sales::sales_creditmemo","config\/acl\/resources\/admin\/sales\/transactions":"Magento_Sales::transactions","config\/acl\/resources\/admin\/sales\/transactions\/fetch":"Magento_Sales::transactions_fetch","config\/acl\/resources\/admin\/sales\/recurring_profile":"Magento_Sales::recurring_profile","config\/acl\/resources\/admin\/sales\/billing_agreement":"Magento_Sales::billing_agreement","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions":"Magento_Sales::billing_agreement_actions","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/view":"Magento_Sales::billing_agreement_actions_view","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/manage":"Magento_Sales::actions_manage","config\/acl\/resources\/admin\/sales\/billing_agreement\/actions\/use":"Magento_Sales::use","config\/acl\/resources\/admin\/system\/order_statuses":"Magento_Sales::order_statuses","config\/acl\/resources\/admin\/system\/config\/sales":"Magento_Sales::config_sales","config\/acl\/resources\/admin\/system\/config\/sales_email":"Magento_Sales::sales_email","config\/acl\/resources\/admin\/system\/config\/sales_pdf":"Magento_Sales::sales_pdf","config\/acl\/resources\/admin\/system\/config\/shipping":"Magento_Shipping::config_shipping","config\/acl\/resources\/admin\/system\/config\/carriers":"Magento_Shipping::carriers","config\/acl\/resources\/admin\/catalog\/sitemap":"Magento_Sitemap::sitemap","config\/acl\/resources\/admin\/system\/config\/sitemap":"Magento_Sitemap::config_sitemap","config\/acl\/resources\/admin\/sales\/tax":"Magento_Tax::sales_tax","config\/acl\/resources\/admin\/sales\/tax\/classes_customer":"Magento_Tax::classes_customer","config\/acl\/resources\/admin\/sales\/tax\/classes_product":"Magento_Tax::classes_product","config\/acl\/resources\/admin\/sales\/tax\/import_export":"Magento_Tax::import_export","config\/acl\/resources\/admin\/sales\/tax\/rates":"Magento_Tax::tax_rates","config\/acl\/resources\/admin\/sales\/tax\/rules":"Magento_Tax::rules","config\/acl\/resources\/admin\/system\/config\/tax":"Magento_Tax::config_tax","config\/acl\/resources\/admin\/system\/acl":"Magento_User::acl","config\/acl\/resources\/admin\/system\/acl\/roles":"Magento_User::acl_roles","config\/acl\/resources\/admin\/system\/acl\/users":"Magento_User::acl_users","config\/acl\/resources\/admin\/cms\/widget_instance":"Magento_Widget::widget_instance","config\/acl\/resources\/admin\/system\/config\/wishlist":"Magento_Wishlist::config_wishlist"} diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php index a85082f646b..ad151d45e33 100644 --- a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php +++ b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php @@ -278,7 +278,7 @@ return array( 'oscommerce/oscommerce_type' => 'oscommerce_import_type', 'paybox/api_debug' => 'paybox_api_debug', 'paybox/question_number' => 'paybox_question_number', - 'paygate/authorizenet_debug' => 'paygate_authorizenet_debug', + 'paygate/authorizenet_debug' => 'authorizenet_debug', 'paypal/api_debug' => 'paypal_api_debug', 'paypal/cert' => 'paypal_cert', 'paypal/payment_transaction' => 'paypal_payment_transaction', diff --git a/dev/tools/Magento/Tools/View/Generator/Config.php b/dev/tools/Magento/Tools/View/Generator/Config.php index 2d8a0ba37df..fc4475df53f 100644 --- a/dev/tools/Magento/Tools/View/Generator/Config.php +++ b/dev/tools/Magento/Tools/View/Generator/Config.php @@ -47,13 +47,13 @@ class Config private $_isDryRun; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param array $cmdOptions * @throws \Magento\Exception */ - public function __construct(\Magento\Filesystem $filesystem, $cmdOptions) + public function __construct(\Magento\App\Filesystem $filesystem, $cmdOptions) { - $rootDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $rootDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $sourceDir = isset($cmdOptions['source']) ? $cmdOptions['source'] : $rootDirectory->getAbsolutePath(); if (!$rootDirectory->isDirectory($rootDirectory->getRelativePath($sourceDir))) { throw new \Magento\Exception('Source directory does not exist: ' . $sourceDir); @@ -62,7 +62,7 @@ class Config if (isset($cmdOptions['destination'])) { $destinationDir = $cmdOptions['destination']; } else { - $destinationDir = $filesystem->getPath(\Magento\Filesystem::STATIC_VIEW); + $destinationDir = $filesystem->getPath(\Magento\App\Filesystem::STATIC_VIEW_DIR); } $destinationDirRelative = $rootDirectory->getRelativePath($destinationDir); if (!$rootDirectory->isDirectory($destinationDirRelative)) { diff --git a/dev/tools/Magento/Tools/View/Generator/CopyRule.php b/dev/tools/Magento/Tools/View/Generator/CopyRule.php index 4aea33b663a..70ceb08f9ab 100644 --- a/dev/tools/Magento/Tools/View/Generator/CopyRule.php +++ b/dev/tools/Magento/Tools/View/Generator/CopyRule.php @@ -32,7 +32,7 @@ namespace Magento\Tools\View\Generator; class CopyRule { /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ private $_filesystem; @@ -56,12 +56,12 @@ class CopyRule /** * Constructor * - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\Theme\Collection $themes * @param \Magento\View\Design\Fallback\Rule\RuleInterface $fallbackRule */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Core\Model\Theme\Collection $themes, \Magento\View\Design\Fallback\Rule\RuleInterface $fallbackRule ) { @@ -145,7 +145,7 @@ class CopyRule private function _getMatchingDirs($dirPattern) { $dirPattern = preg_replace($this->_placeholderPcre, '*', $dirPattern, -1, $placeholderCount); - $directoryHandler = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $directoryHandler = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); if ($placeholderCount) { // autodetect pattern base directory because the filesystem interface requires it $firstPlaceholderPos = strpos($dirPattern, '*'); diff --git a/downloader/lib/Magento/Backup/Snapshot.php b/downloader/lib/Magento/Backup/Snapshot.php index e3bfcb4b2ee..7e560fa2372 100755 --- a/downloader/lib/Magento/Backup/Snapshot.php +++ b/downloader/lib/Magento/Backup/Snapshot.php @@ -45,7 +45,7 @@ class Snapshot extends \Magento\Backup\Filesystem /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -55,11 +55,11 @@ class Snapshot extends \Magento\Backup\Filesystem protected $_backupFactory; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param Factory $backupFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Backup\Factory $backupFactory ) { $this->_filesystem = $filesystem; @@ -136,7 +136,7 @@ class Snapshot extends \Magento\Backup\Filesystem return $this->_backupFactory->create(\Magento\Backup\Factory::TYPE_DB) ->setBackupExtension('gz') ->setTime($this->getTime()) - ->setBackupsDir($this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR)) + ->setBackupsDir($this->_filesystem->getPath(\Magento\App\Filesystem::VAR_DIR)) ->setResourceModel($this->getResourceModel()); } diff --git a/index.php b/index.php index a9e360a30c2..8f165f8101c 100644 --- a/index.php +++ b/index.php @@ -34,8 +34,5 @@ */ require __DIR__ . '/app/bootstrap.php'; -\Magento\Profiler::start('magento'); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $_SERVER); -$result = $entryPoint->run('Magento\App\Http'); -\Magento\Profiler::stop('magento'); -return $result; +$entryPoint->run('Magento\App\Http'); diff --git a/lib/Magento/App/Cache/Frontend/Factory.php b/lib/Magento/App/Cache/Frontend/Factory.php index 6565c3b48ad..6360e37eb3d 100644 --- a/lib/Magento/App/Cache/Frontend/Factory.php +++ b/lib/Magento/App/Cache/Frontend/Factory.php @@ -42,7 +42,7 @@ class Factory private $_objectManager; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ private $_filesystem; @@ -91,14 +91,14 @@ class Factory /** * @param \Magento\ObjectManager $objectManager - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\App\Resource $resource * @param array $enforcedOptions * @param array $decorators */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\App\Resource $resource, array $enforcedOptions = array(), array $decorators = array() @@ -122,20 +122,20 @@ class Factory foreach (array('backend_options', 'slow_backend_options') as $section) { if (!empty($options[$section]['cache_dir'])) { - $directory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::VAR_DIR); + $directory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); $directory->create($options[$section]['cache_dir']); $options[$section]['cache_dir'] = $directory->getAbsolutePath($options[$section]['cache_dir']); } } - $this->_backendOptions['cache_dir'] = $this->_filesystem->getPath(\Magento\Filesystem::CACHE); + $this->_backendOptions['cache_dir'] = $this->_filesystem->getPath(\Magento\App\Filesystem::CACHE_DIR); $idPrefix = isset($options['id_prefix']) ? $options['id_prefix'] : ''; if (!$idPrefix && isset($options['prefix'])) { $idPrefix = $options['prefix']; } if (empty($idPrefix)) { - $idPrefix = substr(md5($this->_filesystem->getPath(\Magento\Filesystem::CONFIG)), 0, 3) . '_'; + $idPrefix = substr(md5($this->_filesystem->getPath(\Magento\App\Filesystem::CONFIG_DIR)), 0, 3) . '_'; } $options['frontend_options']['cache_id_prefix'] = $idPrefix; diff --git a/lib/Magento/App/Config/FileResolver/Primary.php b/lib/Magento/App/Config/FileResolver/Primary.php index c366d4edbf2..59885970779 100644 --- a/lib/Magento/App/Config/FileResolver/Primary.php +++ b/lib/Magento/App/Config/FileResolver/Primary.php @@ -49,14 +49,14 @@ class Primary implements \Magento\Config\FileResolverInterface protected $iteratorFactory; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Config\FileIteratorFactory $iteratorFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Config\FileIteratorFactory $iteratorFactory ) { - $this->configDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); + $this->configDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::CONFIG_DIR); $this->iteratorFactory = $iteratorFactory; } /** diff --git a/lib/Magento/App/Config/Loader.php b/lib/Magento/App/Config/Loader.php index 79e2f3da288..cc9b53bd766 100644 --- a/lib/Magento/App/Config/Loader.php +++ b/lib/Magento/App/Config/Loader.php @@ -59,12 +59,12 @@ class Loader protected $_idAttributes = array('/config/resource' => 'name', '/config/connection' => 'name'); /** - * @param \Magento\Filesystem\DirectoryList $dirList + * @param \Magento\App\Filesystem\DirectoryList $dirList * @param string $customFile */ - public function __construct(\Magento\Filesystem\DirectoryList $dirList, $customFile = null) + public function __construct(\Magento\App\Filesystem\DirectoryList $dirList, $customFile = null) { - $this->_dir = $dirList->getDir(\Magento\Filesystem::CONFIG); + $this->_dir = $dirList->getDir(\Magento\App\Filesystem::CONFIG_DIR); $this->_customFile = $customFile; } diff --git a/lib/Magento/App/Console/Response.php b/lib/Magento/App/Console/Response.php new file mode 100644 index 00000000000..29271978eee --- /dev/null +++ b/lib/Magento/App/Console/Response.php @@ -0,0 +1,81 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App\Console; + +/** + * @SuppressWarnings(PHPMD.ExitExpression) + */ +class Response implements \Magento\App\ResponseInterface +{ + /** + * Status code + * Possible values: + * 0 (successfully) + * 1-255 (error) + * -1 (error) + * + * @var int + */ + protected $code = 0; + + /** + * Set whether to terminate process on send or not + * + * @var bool + */ + protected $terminateOnSend = true; + + /** + * Send response to client + */ + public function sendResponse() + { + if ($this->terminateOnSend) { + exit($this->code); + } + return $this->code; + } + + /** + * @param int $code + */ + public function setCode($code) + { + if ($code > 255) { + $code = 255; + } + $this->code = $code; + } + + /** + * Set whether to terminate process on send or not + * + * @param bool $terminate + */ + public function terminateOnSend($terminate) + { + $this->terminateOnSend = $terminate; + } +} \ No newline at end of file diff --git a/lib/Magento/App/Cron.php b/lib/Magento/App/Cron.php index 12892b65c7f..553b6b56be2 100644 --- a/lib/Magento/App/Cron.php +++ b/lib/Magento/App/Cron.php @@ -25,8 +25,8 @@ */ namespace Magento\App; -use \Magento\Config\ScopeInterface, - \Magento\App\ObjectManager\ConfigLoader, +use Magento\App\Console\Response; +use \Magento\App\ObjectManager\ConfigLoader, \Magento\Event\ManagerInterface; class Cron implements \Magento\AppInterface @@ -41,27 +41,36 @@ class Cron implements \Magento\AppInterface */ protected $_state; + /** + * @var Console\Response + */ + protected $_response; + /** * @param ManagerInterface $eventManager * @param State $state + * @param Response $response */ public function __construct( ManagerInterface $eventManager, - State $state + State $state, + Response $response ) { $this->_eventManager = $eventManager; $this->_state = $state; + $this->_response = $response; } /** - * Execute application + * Run application * - * @return int + * @return ResponseInterface */ public function execute() { $this->_state->setAreaCode('crontab'); $this->_eventManager->dispatch('default'); - return 0; + $this->_response->setCode(0); + return $this->_response; } } diff --git a/lib/Magento/App/EntryPoint/EntryPoint.php b/lib/Magento/App/EntryPoint/EntryPoint.php index 9eee10428da..7b06d10e4f8 100644 --- a/lib/Magento/App/EntryPoint/EntryPoint.php +++ b/lib/Magento/App/EntryPoint/EntryPoint.php @@ -28,7 +28,6 @@ namespace Magento\App\EntryPoint; use Magento\App\State, Magento\App\EntryPointInterface, Magento\ObjectManager; -use Magento\Webapi\Exception; class EntryPoint implements EntryPointInterface { @@ -70,16 +69,19 @@ class EntryPoint implements EntryPointInterface * * @param string $applicationName * @param array $arguments - * @return int */ public function run($applicationName, array $arguments = array()) { try { + \Magento\Profiler::start('magento'); if (!$this->_locator) { $locatorFactory = new \Magento\App\ObjectManagerFactory(); $this->_locator = $locatorFactory->create($this->_rootDir, $this->_parameters); } - return $this->_locator->create($applicationName, $arguments)->execute(); + $application = $this->_locator->create($applicationName, $arguments); + $response = $application->execute(); + \Magento\Profiler::stop('magento'); + $response->sendResponse(); } catch (\Exception $exception) { if (isset($this->_parameters[state::PARAM_MODE]) && $this->_parameters[State::PARAM_MODE] == State::MODE_DEVELOPER @@ -98,7 +100,6 @@ class EntryPoint implements EntryPointInterface } print $message; } - return 1; } } } diff --git a/lib/Magento/App/Error/Handler.php b/lib/Magento/App/Error/Handler.php index 609bbbcc369..fe9ec9bf177 100644 --- a/lib/Magento/App/Error/Handler.php +++ b/lib/Magento/App/Error/Handler.php @@ -35,7 +35,7 @@ class Handler extends \Magento\Error\Handler protected $_logger; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -46,12 +46,12 @@ class Handler extends \Magento\Error\Handler /** * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\App\State $appState */ public function __construct( \Magento\Logger $logger, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\App\State $appState ) { $this->_logger = $logger; @@ -80,7 +80,7 @@ class Handler extends \Magento\Error\Handler $reportData['script_name'] = $_SERVER['SCRIPT_NAME']; } } - require_once($this->_filesystem->getPath(\Magento\Filesystem::PUB) . '/errors/report.php'); + require_once($this->_filesystem->getPath(\Magento\App\Filesystem::PUB_DIR) . '/errors/report.php'); } } diff --git a/lib/Magento/App/Filesystem.php b/lib/Magento/App/Filesystem.php new file mode 100644 index 00000000000..2867c408dfb --- /dev/null +++ b/lib/Magento/App/Filesystem.php @@ -0,0 +1,140 @@ +<?php +/** + * Magento application filesystem facade + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\App; + +class Filesystem extends \Magento\Filesystem +{ + /** + * Custom application dirs + */ + const PARAM_APP_DIRS = 'app_dirs'; + + /** + * Code base root + */ + const ROOT_DIR = 'base'; + + /** + * Most of entire application + */ + const APP_DIR = 'app'; + + /** + * Modules + */ + const MODULES_DIR = 'code'; + + /** + * Themes + */ + const THEMES_DIR = 'design'; + + /** + * Initial configuration of the application + */ + const CONFIG_DIR = 'etc'; + + /** + * Libraries or third-party components + */ + const LIB_DIR = 'lib'; + + /** + * Files with translation of system labels and messages from en_US to other languages + */ + const LOCALE_DIR = 'i18n'; + + /** + * \Directory within document root of a web-server to access static view files publicly + */ + const PUB_DIR = 'pub'; + + /** + * Libraries/components that need to be accessible publicly through web-server (such as various DHTML components) + */ + const PUB_LIB_DIR = 'pub_lib'; + + /** + * Storage of files entered or generated by the end-user + */ + const MEDIA_DIR = 'media'; + + /** + * Storage of static view files that are needed on HTML-pages, emails or similar content + */ + const STATIC_VIEW_DIR = 'static'; + + /** + * Public view files, stored to avoid repetitive run-time calculation, and can be re-generated any time + */ + const PUB_VIEW_CACHE_DIR = 'view_cache'; + + /** + * Various files generated by the system in runtime + */ + const VAR_DIR = 'var'; + + /** + * Temporary files + */ + const TMP_DIR = 'tmp'; + + /** + * File system caching directory (if file system caching is used) + */ + const CACHE_DIR = 'cache'; + + /** + * Logs of system messages and errors + */ + const LOG_DIR = 'log'; + + /** + * File system session directory (if file system session storage is used) + */ + const SESSION_DIR = 'session'; + + /** + * Dependency injection related file directory + * + */ + const DI_DIR = 'di'; + + /** + * Relative directory key for generated code + */ + const GENERATION_DIR = 'generation'; + + /** + * Temporary directory for uploading files by end-user + */ + const UPLOAD_DIR = 'upload'; + + /** + * System base temporary folder + */ + const SYS_TMP_DIR = 'sys_tmp'; +} diff --git a/lib/Magento/App/Filesystem/DirectoryList.php b/lib/Magento/App/Filesystem/DirectoryList.php new file mode 100644 index 00000000000..b5d69b66193 --- /dev/null +++ b/lib/Magento/App/Filesystem/DirectoryList.php @@ -0,0 +1,109 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\App\Filesystem; + +use Magento\App\Filesystem; + +/** + * Class DirectoryList + * @package Magento\App\Filesystem + */ +class DirectoryList extends \Magento\Filesystem\DirectoryList +{ + /** + * Directories configurations + * + * @var array + */ + protected $directories = array( + Filesystem::ROOT_DIR => array( + 'path' => '' + ), + Filesystem::APP_DIR => array( + 'path' => 'app' + ), + Filesystem::MODULES_DIR => array( + 'path' => 'app/code' + ), + Filesystem::CONFIG_DIR => array( + 'path' => 'app/etc' + ), + Filesystem::LIB_DIR => array( + 'path' => 'lib' + ), + Filesystem::VAR_DIR => array( + 'path' => 'var', + 'read_only' => false, + 'allow_create_dirs' => true, + 'permissions' => 0777 + ), + Filesystem::CACHE_DIR => array( + 'path' => 'var/cache', + 'read_only' => false, + 'allow_create_dirs' => true, + 'permissions' => 0777 + ), + Filesystem::LOG_DIR => array( + 'path' => 'var/log', + 'read_only' => false, + 'allow_create_dirs' => true, + 'permissions' => 0777 + ), + Filesystem::DI_DIR => array( + 'path' => 'var/di' + ), + Filesystem::GENERATION_DIR => array( + 'path' => 'var/generation' + ), + Filesystem::HTTP => array( + 'path' => '' + ), + Filesystem::LOCALE_DIR => array( + 'path' => '' + ), + Filesystem::SYS_TMP_DIR => array( + 'path' => '', + 'read_only' => false, + 'allow_create_dirs' => true, + 'permissions' => 0777 + ), + Filesystem::SESSION_DIR => array( + 'path' => 'var/session', + 'read_only' => false, + 'allow_create_dirs' => true, + 'permissions' => 0777 + ) + ); + + /** + * @param string $root + * @param array $directories + */ + public function __construct($root, array $directories = array()) + { + $this->directories[Filesystem::SYS_TMP_DIR]['path'] = sys_get_temp_dir(); + parent::__construct($root, $directories); + } +} diff --git a/lib/Magento/Filesystem/DirectoryList/Configuration.php b/lib/Magento/App/Filesystem/DirectoryList/Configuration.php similarity index 92% rename from lib/Magento/Filesystem/DirectoryList/Configuration.php rename to lib/Magento/App/Filesystem/DirectoryList/Configuration.php index ef74e92f97f..10ab31caaa7 100644 --- a/lib/Magento/Filesystem/DirectoryList/Configuration.php +++ b/lib/Magento/App/Filesystem/DirectoryList/Configuration.php @@ -22,10 +22,15 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Filesystem\DirectoryList; +namespace Magento\App\Filesystem\DirectoryList; -use Magento\Filesystem\DirectoryList; +use Magento\App\Filesystem, + Magento\Filesystem\DirectoryList; +/** + * Class Configuration + * @package Magento\App\Filesystem\DirectoryList + */ class Configuration { /** diff --git a/lib/Magento/Filesystem/DirectoryList/Verification.php b/lib/Magento/App/Filesystem/DirectoryList/Verification.php similarity index 86% rename from lib/Magento/Filesystem/DirectoryList/Verification.php rename to lib/Magento/App/Filesystem/DirectoryList/Verification.php index 21811df0dcf..4ceae682f96 100644 --- a/lib/Magento/Filesystem/DirectoryList/Verification.php +++ b/lib/Magento/App/Filesystem/DirectoryList/Verification.php @@ -23,11 +23,11 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Filesystem\DirectoryList; +namespace Magento\App\Filesystem\DirectoryList; use Magento\App\State, - Magento\Filesystem, - Magento\Filesystem\FilesystemException; + Magento\Filesystem\FilesystemException, + Magento\App\Filesystem; class Verification { @@ -37,12 +37,9 @@ class Verification * @var array */ protected static $productionDirs = array( - Filesystem::MEDIA, - Filesystem::VAR_DIR, - Filesystem::TMP, - Filesystem::CACHE, - Filesystem::LOG, - Filesystem::SESSION, + Filesystem::SESSION_DIR, + Filesystem::CACHE_DIR, + Filesystem::LOG_DIR, ); /** @@ -51,17 +48,13 @@ class Verification * @var array */ protected static $nonProductionDirs = array( - Filesystem::MEDIA, - Filesystem::STATIC_VIEW, - Filesystem::VAR_DIR, - Filesystem::TMP, - Filesystem::CACHE, - Filesystem::LOG, - Filesystem::SESSION, + Filesystem::SESSION_DIR, + Filesystem::CACHE_DIR, + Filesystem::LOG_DIR, ); /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -78,7 +71,8 @@ class Verification * @param Filesystem $filesystem * @param State $appState */ - public function __construct(Filesystem $filesystem, State $appState) { + public function __construct(Filesystem $filesystem, State $appState) + { $this->filesystem = $filesystem; $this->dirsToVerify = $this->_getDirsToVerify($appState); } diff --git a/lib/Magento/App/FrontController.php b/lib/Magento/App/FrontController.php index bfd7aab5a60..2104418dd76 100644 --- a/lib/Magento/App/FrontController.php +++ b/lib/Magento/App/FrontController.php @@ -73,6 +73,8 @@ class FrontController implements FrontControllerInterface if ($routingCycleCounter > 100) { throw new \LogicException('Front controller reached 100 router match iterations'); } + $response->setHeader('cache-control', 'no-store, no-cache, must-revalidate, max-age=0', true); + $response->setHeader('pragma', 'no-cache', true); return $response; } } diff --git a/lib/Magento/App/Http.php b/lib/Magento/App/Http.php index 2e5e9c87e46..e1be703a08d 100644 --- a/lib/Magento/App/Http.php +++ b/lib/Magento/App/Http.php @@ -25,10 +25,12 @@ */ namespace Magento\App; -use Magento\Config\Scope, - Magento\App\ObjectManager\ConfigLoader, +use Magento\App\ObjectManager\ConfigLoader, Magento\Event; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Http implements \Magento\AppInterface { /** @@ -47,15 +49,10 @@ class Http implements \Magento\AppInterface protected $_areaList; /** - * @var RequestInterface + * @var Request\Http */ protected $_request; - /** - * @var \Magento\Config\Scope - */ - protected $_configScope; - /** * @var ConfigLoader */ @@ -67,42 +64,49 @@ class Http implements \Magento\AppInterface protected $_state; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; + /** + * @var Response\Http + */ + protected $_response; + /** * @param \Magento\ObjectManager $objectManager * @param Event\Manager $eventManager * @param AreaList $areaList - * @param RequestInterface $request - * @param Scope $configScope + * @param Request\Http $request + * @param Response\Http $response * @param ConfigLoader $configLoader * @param State $state - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\ObjectManager $objectManager, Event\Manager $eventManager, AreaList $areaList, - RequestInterface $request, - Scope $configScope, + \Magento\App\Request\Http $request, + \Magento\App\Response\Http $response, ConfigLoader $configLoader, State $state, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_objectManager = $objectManager; $this->_eventManager = $eventManager; $this->_areaList = $areaList; $this->_request = $request; - $this->_configScope = $configScope; + $this->_response = $response; $this->_configLoader = $configLoader; $this->_state = $state; $this->_filesystem = $filesystem; } /** - * Execute application + * Run application + * + * @return ResponseInterface */ public function execute() { @@ -110,24 +114,20 @@ class Http implements \Magento\AppInterface $areaCode = $this->_areaList->getCodeByFrontName($this->_request->getFrontName()); $this->_state->setAreaCode($areaCode); $this->_objectManager->configure($this->_configLoader->load($areaCode)); - $response = $this->_objectManager->get('Magento\App\FrontControllerInterface')->dispatch($this->_request); + $this->_response = $this->_objectManager + ->get('Magento\App\FrontControllerInterface') + ->dispatch($this->_request); // This event gives possibility to launch something before sending output (allow cookie setting) - $eventParams = array('request' => $this->_request, 'response' => $response); + $eventParams = array('request' => $this->_request, 'response' => $this->_response); $this->_eventManager->dispatch('controller_front_send_response_before', $eventParams); - \Magento\Profiler::start('send_response'); - $response->sendResponse(); - \Magento\Profiler::stop('send_response'); - $this->_eventManager->dispatch('controller_front_send_response_after', $eventParams); - return 0; - } catch(\Exception $exception) { - echo $exception->getMessage() . "\n"; + } catch (\Exception $exception) { + $message = $exception->getMessage() . "\n"; try { if ($this->_state->getMode() == State::MODE_DEVELOPER) { - header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500); - print '<pre>'; - print $exception->getMessage() . "\n\n"; - print $exception->getTraceAsString(); - print '</pre>'; + $message .= '<pre>'; + $message .= $exception->getMessage() . "\n\n"; + $message .= $exception->getTraceAsString(); + $message .= '</pre>'; } else { $reportData = array($exception->getMessage(), $exception->getTraceAsString()); // retrieve server data @@ -139,14 +139,17 @@ class Http implements \Magento\AppInterface $reportData['script_name'] = $_SERVER['SCRIPT_NAME']; } } - require_once ($this->_filesystem->getPath(\Magento\Filesystem::PUB) . '/errors/report.php'); + require_once($this->_filesystem->getPath(\Magento\App\Filesystem::PUB_DIR) . '/errors/report.php'); + $processor = new \Error_Processor($this->_response); + $processor->saveReport($reportData); + $this->_response = $processor->processReport(); } } catch (\Exception $exception) { - $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP 1.1'; - header($protocol . ' 500 Internal Server Error', true, 500); - print "Unknown error happened."; + $message .= "Unknown error happened."; } - return -1; + $this->_response->setHttpResponseCode(500); + $this->_response->setBody($message); } + return $this->_response; } } diff --git a/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php b/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php index 7afe8ed2e3b..e3f7c36b74a 100644 --- a/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php +++ b/lib/Magento/App/ObjectManager/ConfigLoader/Primary.php @@ -35,16 +35,16 @@ class Primary protected $_appMode; /** - * @var \Magento\Filesystem\DirectoryList + * @var \Magento\App\Filesystem\DirectoryList */ protected $_directoryList; /** - * @param string $configDirectoryPath + * @param \Magento\App\Filesystem\DirectoryList $directoryList * @param string $appMode */ public function __construct( - \Magento\Filesystem\DirectoryList $directoryList, + \Magento\App\Filesystem\DirectoryList $directoryList, $appMode = \Magento\App\State::MODE_DEFAULT ) { $this->_directoryList = $directoryList; @@ -60,7 +60,7 @@ class Primary { $reader = new \Magento\ObjectManager\Config\Reader\Dom( new \Magento\App\Config\FileResolver\Primary( - new \Magento\Filesystem( + new \Magento\App\Filesystem( $this->_directoryList, new \Magento\Filesystem\Directory\ReadFactory(), new \Magento\Filesystem\Directory\WriteFactory() diff --git a/lib/Magento/App/ObjectManagerFactory.php b/lib/Magento/App/ObjectManagerFactory.php index be3d3d2ad54..336e9d9981a 100644 --- a/lib/Magento/App/ObjectManagerFactory.php +++ b/lib/Magento/App/ObjectManagerFactory.php @@ -28,7 +28,7 @@ namespace Magento\App; use Magento\App\Config, Magento\Profiler, - Magento\Filesystem; + Magento\App\Filesystem; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -64,19 +64,19 @@ class ObjectManagerFactory */ public function create($rootDir, array $arguments) { - $directories = new \Magento\Filesystem\DirectoryList( - $rootDir, - isset($arguments[\Magento\Filesystem::PARAM_APP_DIRS]) - ? $arguments[\Magento\Filesystem::PARAM_APP_DIRS] - : array() - ); + $directories = isset($arguments[\Magento\App\Filesystem::PARAM_APP_DIRS]) + ? $arguments[\Magento\App\Filesystem::PARAM_APP_DIRS] + : array(); + $directoryList = new \Magento\App\Filesystem\DirectoryList($rootDir, $directories); - \Magento\Autoload\IncludePath::addIncludePath(array($directories->getDir(\Magento\Filesystem::GENERATION))); + \Magento\Autoload\IncludePath::addIncludePath( + array($directoryList->getDir(\Magento\App\Filesystem::GENERATION_DIR)) + ); $options = new Config( $arguments, new Config\Loader( - $directories, + $directoryList, isset($arguments[Config\Loader::PARAM_CUSTOM_FILE]) ? $arguments[Config\Loader::PARAM_CUSTOM_FILE] : null @@ -85,8 +85,8 @@ class ObjectManagerFactory $definitionFactory = new \Magento\ObjectManager\DefinitionFactory( new \Magento\Filesystem\Driver\File(), - $directories->getDir(\Magento\Filesystem::DI), - $directories->getDir(\Magento\Filesystem::GENERATION), + $directoryList->getDir(\Magento\App\Filesystem::DI_DIR), + $directoryList->getDir(\Magento\App\Filesystem::GENERATION_DIR), $options->get('definition.format', 'serialized') ); @@ -97,7 +97,7 @@ class ObjectManagerFactory $diConfig = new $configClass($relations, $definitions); $appMode = $options->get(State::PARAM_MODE, State::MODE_DEFAULT); - $configData = $this->_loadPrimaryConfig($directories, $appMode); + $configData = $this->_loadPrimaryConfig($directoryList, $appMode); if ($configData) { $diConfig->extend($configData); @@ -106,28 +106,29 @@ class ObjectManagerFactory $factory = new \Magento\ObjectManager\Factory\Factory($diConfig, null, $definitions, $options->get()); $className = $this->_locatorClassName; - /** @var \Magento\ObjectManager $locator */ - $locator = new $className($factory, $diConfig, array( + /** @var \Magento\ObjectManager $objectManager */ + $objectManager = new $className($factory, $diConfig, array( 'Magento\App\Config' => $options, - 'Magento\Filesystem\DirectoryList' => $directories + 'Magento\App\Filesystem\DirectoryList' => $directoryList, + 'Magento\Filesystem\DirectoryList' => $directoryList )); - \Magento\App\ObjectManager::setInstance($locator); + \Magento\App\ObjectManager::setInstance($objectManager); - /** @var \Magento\Filesystem\DirectoryList\Verification $verification */ - $verification = $locator->get('Magento\Filesystem\DirectoryList\Verification'); + /** @var \Magento\App\Filesystem\DirectoryList\Verification $verification */ + $verification = $objectManager->get('Magento\App\Filesystem\DirectoryList\Verification'); $verification->createAndVerifyDirectories(); - $diConfig->setCache($locator->get('Magento\App\ObjectManager\ConfigCache')); - $locator->configure( - $locator->get('Magento\App\ObjectManager\ConfigLoader')->load('global') + $diConfig->setCache($objectManager->get('Magento\App\ObjectManager\ConfigCache')); + $objectManager->configure( + $objectManager->get('Magento\App\ObjectManager\ConfigLoader')->load('global') ); - $locator->get('Magento\Config\ScopeInterface')->setCurrentScope('global'); - $locator->get('Magento\App\Resource')->setCache($locator->get('Magento\App\CacheInterface')); + $objectManager->get('Magento\Config\ScopeInterface')->setCurrentScope('global'); + $objectManager->get('Magento\App\Resource')->setCache($objectManager->get('Magento\App\CacheInterface')); $relations = $definitionFactory->createRelations(); - $interceptionConfig = $locator->create('Magento\Interception\Config\Config', array( + $interceptionConfig = $objectManager->create('Magento\Interception\Config\Config', array( 'relations' => $relations, 'omConfig' => $diConfig, 'classDefinitions' => $definitions instanceof \Magento\ObjectManager\Definition\Compiled @@ -135,19 +136,28 @@ class ObjectManagerFactory : null, )); - $pluginList = $this->_createPluginList($locator, $relations, $definitionFactory, $diConfig, $definitions); + $pluginList = $this->_createPluginList($objectManager, $relations, $definitionFactory, $diConfig, $definitions); - $factory = $locator->create('Magento\Interception\FactoryDecorator', array( + $factory = $objectManager->create('Magento\Interception\FactoryDecorator', array( 'factory' => $factory, 'config' => $interceptionConfig, 'pluginList' => $pluginList )); - $locator->setFactory($factory); + $objectManager->setFactory($factory); - $directoryListConfig = $locator->get('Magento\Filesystem\DirectoryList\Configuration'); - $directoryListConfig->configure($directories); + $this->configureDirectories($objectManager); + + return $objectManager; + } - return $locator; + /** + * @param \Magento\ObjectManager $objectManager + */ + protected function configureDirectories(\Magento\ObjectManager $objectManager) + { + $directoryList = $objectManager->get('Magento\App\Filesystem\DirectoryList'); + $directoryListConfig = $objectManager->get('Magento\App\Filesystem\DirectoryList\Configuration'); + $directoryListConfig->configure($directoryList); } /** @@ -173,7 +183,7 @@ class ObjectManagerFactory /** * Crete plugin list object * - * @param \Magento\ObjectManager $locator + * @param \Magento\ObjectManager $objectManager * @param \Magento\ObjectManager\Relations $relations * @param \Magento\ObjectManager\DefinitionFactory $definitionFactory * @param \Magento\ObjectManager\Config\Config $diConfig @@ -181,13 +191,13 @@ class ObjectManagerFactory * @return \Magento\Interception\PluginList\PluginList */ protected function _createPluginList( - \Magento\ObjectManager $locator, + \Magento\ObjectManager $objectManager, \Magento\ObjectManager\Relations $relations, \Magento\ObjectManager\DefinitionFactory $definitionFactory, \Magento\ObjectManager\Config\Config $diConfig, \Magento\ObjectManager\Definition $definitions ) { - return $locator->create('Magento\Interception\PluginList\PluginList', array( + return $objectManager->create('Magento\Interception\PluginList\PluginList', array( 'relations' => $relations, 'definitions' => $definitionFactory->createPluginDefinition(), 'omConfig' => $diConfig, @@ -196,4 +206,4 @@ class ObjectManagerFactory : null, )); } -} \ No newline at end of file +} diff --git a/lib/Magento/App/Response/Http/FileFactory.php b/lib/Magento/App/Response/Http/FileFactory.php index f48a1538713..4cc9bf0ef15 100644 --- a/lib/Magento/App/Response/Http/FileFactory.php +++ b/lib/Magento/App/Response/Http/FileFactory.php @@ -33,17 +33,17 @@ class FileFactory protected $_response; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; /** * @param \Magento\App\ResponseInterface $response - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\App\ResponseInterface $response, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_response = $response; $this->_filesystem = $filesystem; @@ -69,7 +69,7 @@ class FileFactory public function create( $fileName, $content, - $baseDir = \Magento\Filesystem::ROOT, + $baseDir = \Magento\App\Filesystem::ROOT_DIR, $contentType = 'application/octet-stream', $contentLength = null ) { diff --git a/lib/Magento/AppInterface.php b/lib/Magento/AppInterface.php index d9f01793f15..4917d90d3bf 100644 --- a/lib/Magento/AppInterface.php +++ b/lib/Magento/AppInterface.php @@ -28,7 +28,7 @@ namespace Magento; interface AppInterface { /** - * @return int + * @return \Magento\App\ResponseInterface */ public function execute(); } \ No newline at end of file diff --git a/lib/Magento/Backup/Snapshot.php b/lib/Magento/Backup/Snapshot.php index a7aa0320545..839b2160c6e 100644 --- a/lib/Magento/Backup/Snapshot.php +++ b/lib/Magento/Backup/Snapshot.php @@ -45,7 +45,7 @@ class Snapshot extends \Magento\Backup\Filesystem /** * Filesystem facade * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -55,11 +55,11 @@ class Snapshot extends \Magento\Backup\Filesystem protected $_backupFactory; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Backup\Factory $backupFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Backup\Factory $backupFactory ) { $this->_filesystem = $filesystem; @@ -136,7 +136,7 @@ class Snapshot extends \Magento\Backup\Filesystem return $this->_backupFactory->create(\Magento\Backup\Factory::TYPE_DB) ->setBackupExtension('gz') ->setTime($this->getTime()) - ->setBackupsDir($this->_filesystem->getPath(\Magento\Filesystem::VAR_DIR)) + ->setBackupsDir($this->_filesystem->getPath(\Magento\App\Filesystem::VAR_DIR)) ->setResourceModel($this->getResourceModel()); } diff --git a/lib/Magento/Code/Generator.php b/lib/Magento/Code/Generator.php index 874b5d45854..232b3f2cf46 100644 --- a/lib/Magento/Code/Generator.php +++ b/lib/Magento/Code/Generator.php @@ -60,13 +60,13 @@ class Generator * @param Generator\EntityAbstract $generator * @param \Magento\Autoload\IncludePath $autoloader * @param Generator\Io $ioObject - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Code\Generator\EntityAbstract $generator = null, \Magento\Autoload\IncludePath $autoloader = null, \Magento\Code\Generator\Io $ioObject = null, - \Magento\Filesystem $filesystem = null + \Magento\App\Filesystem $filesystem = null ) { //todo: remove $filesystem from constructor $this->_generator = $generator; diff --git a/lib/Magento/Code/Minifier.php b/lib/Magento/Code/Minifier.php index c6f806e1e17..d8952e98012 100644 --- a/lib/Magento/Code/Minifier.php +++ b/lib/Magento/Code/Minifier.php @@ -50,17 +50,17 @@ class Minifier /** * @param \Magento\Code\Minifier\StrategyInterface $strategy - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param string $directoryName */ public function __construct( \Magento\Code\Minifier\StrategyInterface $strategy, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, $directoryName ) { $this->_strategy = $strategy; - $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); - $this->pubViewCacheDir = $filesystem->getDirectoryRead(\Magento\Filesystem::PUB_VIEW_CACHE); + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); + $this->pubViewCacheDir = $filesystem->getDirectoryRead(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR); $this->directoryName = $directoryName; } diff --git a/lib/Magento/Code/Minifier/Strategy/Generate.php b/lib/Magento/Code/Minifier/Strategy/Generate.php index 06fbac88270..1529cdc461a 100644 --- a/lib/Magento/Code/Minifier/Strategy/Generate.php +++ b/lib/Magento/Code/Minifier/Strategy/Generate.php @@ -49,15 +49,15 @@ class Generate implements \Magento\Code\Minifier\StrategyInterface /** * @param \Magento\Code\Minifier\AdapterInterface $adapter - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Code\Minifier\AdapterInterface $adapter, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->adapter = $adapter; - $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); - $this->pubViewCacheDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB_VIEW_CACHE); + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); + $this->pubViewCacheDir = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR); } /** diff --git a/lib/Magento/Code/Minifier/Strategy/Lite.php b/lib/Magento/Code/Minifier/Strategy/Lite.php index be1fa9a9ab2..6cbc0064ab9 100644 --- a/lib/Magento/Code/Minifier/Strategy/Lite.php +++ b/lib/Magento/Code/Minifier/Strategy/Lite.php @@ -52,15 +52,15 @@ class Lite implements \Magento\Code\Minifier\StrategyInterface /** * @param \Magento\Code\Minifier\AdapterInterface $adapter - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Code\Minifier\AdapterInterface $adapter, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->adapter = $adapter; - $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); - $this->pubViewCacheDir = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB_VIEW_CACHE); + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); + $this->pubViewCacheDir = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR); } /** diff --git a/lib/Magento/DB/Adapter/Pdo/Mysql.php b/lib/Magento/DB/Adapter/Pdo/Mysql.php index e31c0846b1b..7a1fd5b68ea 100644 --- a/lib/Magento/DB/Adapter/Pdo/Mysql.php +++ b/lib/Magento/DB/Adapter/Pdo/Mysql.php @@ -143,7 +143,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad /** * Filesystem class * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -228,13 +228,13 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad protected $dateTime; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Stdlib\String $string * @param \Magento\Stdlib\DateTime $dateTime * @param array $config */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Stdlib\String $string, \Magento\Stdlib\DateTime $dateTime, array $config = array() @@ -1419,7 +1419,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements \Magento\DB\Adapter\Ad { $str = '## ' . date('Y-m-d H:i:s') . "\r\n" . $str; - $stream = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT)->openFile($this->_debugFile, 'a'); + $stream = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR)->openFile($this->_debugFile, 'a'); $stream->lock(); $stream->write($str); $stream->unlock(); diff --git a/lib/Magento/Data/Form/Element/AbstractElement.php b/lib/Magento/Data/Form/Element/AbstractElement.php index 44fd432d17c..ee560a7f452 100644 --- a/lib/Magento/Data/Form/Element/AbstractElement.php +++ b/lib/Magento/Data/Form/Element/AbstractElement.php @@ -55,6 +55,13 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm */ protected $_escaper; + /** + * Lock html attribute + * + * @var string + */ + private $lockHtmlAttribute = 'data-locked'; + /** * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection @@ -317,6 +324,9 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm public function serialize($attributes = array(), $valueSeparator='=', $fieldSeparator=' ', $quote='"') { + if ($this->isLocked() && !empty($attributes)) { + $attributes[] = $this->lockHtmlAttribute; + } if (in_array('disabled', $attributes) && !empty($this->_data['disabled'])) { $this->_data['disabled'] = 'disabled'; } else { @@ -378,4 +388,22 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm return $this; } + + /** + * Lock element + */ + public function lock() + { + $this->setData($this->lockHtmlAttribute, 1); + } + + /** + * Is element locked + * + * @return bool + */ + public function isLocked() + { + return $this->getData($this->lockHtmlAttribute) == 1; + } } diff --git a/lib/Magento/Filesystem.php b/lib/Magento/Filesystem.php index 22e1428128b..7633443a2cc 100644 --- a/lib/Magento/Filesystem.php +++ b/lib/Magento/Filesystem.php @@ -53,117 +53,6 @@ class Filesystem const HTTPS = 'https'; /**#@-*/ - /** - * Custom application dirs - */ - const PARAM_APP_DIRS = 'app_dirs'; - - /** - * Code base root - */ - const ROOT = 'base'; - - /** - * Most of entire application - */ - const APP = 'app'; - - /** - * Modules - */ - const MODULES = 'code'; - - /** - * Themes - */ - const THEMES = 'design'; - - /** - * Initial configuration of the application - */ - const CONFIG = 'etc'; - - /** - * Libraries or third-party components - */ - const LIB = 'lib'; - - /** - * Files with translation of system labels and messages from en_US to other languages - */ - const LOCALE = 'i18n'; - - /** - * \Directory within document root of a web-server to access static view files publicly - */ - const PUB = 'pub'; - - /** - * Libraries/components that need to be accessible publicly through web-server (such as various DHTML components) - */ - const PUB_LIB = 'pub_lib'; - - /** - * Storage of files entered or generated by the end-user - */ - const MEDIA = 'media'; - - /** - * Storage of static view files that are needed on HTML-pages, emails or similar content - */ - const STATIC_VIEW = 'static'; - - /** - * Public view files, stored to avoid repetitive run-time calculation, and can be re-generated any time - */ - const PUB_VIEW_CACHE = 'view_cache'; - - /** - * Various files generated by the system in runtime - */ - const VAR_DIR = 'var'; - - /** - * Temporary files - */ - const TMP = 'tmp'; - - /** - * File system caching directory (if file system caching is used) - */ - const CACHE = 'cache'; - - /** - * Logs of system messages and errors - */ - const LOG = 'log'; - - /** - * File system session directory (if file system session storage is used) - */ - const SESSION = 'session'; - - /** - * Dependency injection related file directory - * - */ - const DI = 'di'; - - /** - * Relative directory key for generated code - */ - const GENERATION = 'generation'; - - /** - * Temporary directory for uploading files by end-user - */ - const UPLOAD = 'upload'; - - /** - * System base temporary folder - */ - const SYS_TMP = 'sys_tmp'; - /** * @var \Magento\Filesystem\DirectoryList */ @@ -289,28 +178,27 @@ class Filesystem } /** - * Retrieve absolute path for for given code + * Retrieve uri for given code * * @param string $code * @return string */ - public function getPath($code = self::ROOT) + public function getUri($code) { $config = $this->directoryList->getConfig($code); - $path = isset($config['path']) ? $config['path'] : ''; - return str_replace('\\', '/', $path); + return isset($config['uri']) ? $config['uri'] : ''; } /** - * Retrieve uri for given code + * Retrieve absolute path for for given code * * @param string $code * @return string */ - public function getUri($code) + public function getPath($code = '') { $config = $this->directoryList->getConfig($code); - return isset($config['uri']) ? $config['uri'] : ''; + $path = isset($config['path']) ? $config['path'] : ''; + return str_replace('\\', '/', $path); } - } diff --git a/lib/Magento/Filesystem/Directory/Read.php b/lib/Magento/Filesystem/Directory/Read.php index a25c9421181..cab5a0265a2 100644 --- a/lib/Magento/Filesystem/Directory/Read.php +++ b/lib/Magento/Filesystem/Directory/Read.php @@ -260,17 +260,4 @@ class Read implements ReadInterface { return $this->driver->isDirectory($this->driver->getAbsolutePath($this->path, $path)); } - - /** - * Checks is directory contains path - * Utility method. - * - * @param string $path - * @param string $directory - * @return bool - */ - public function isPathInDirectory($path, $directory) - { - return $this->driver->isPathInDirectory($path, $directory); - } } diff --git a/lib/Magento/Filesystem/Directory/ReadInterface.php b/lib/Magento/Filesystem/Directory/ReadInterface.php index 97d30e885e5..0d7d024f9c0 100644 --- a/lib/Magento/Filesystem/Directory/ReadInterface.php +++ b/lib/Magento/Filesystem/Directory/ReadInterface.php @@ -116,13 +116,4 @@ interface ReadInterface * @throws \Magento\Filesystem\FilesystemException */ public function readFile($path, $flag = null, $context = null); - - /** - * Checks is directory contains path - * - * @param string $path - * @param string $directory - * @return bool - */ - public function isPathInDirectory($path, $directory); } diff --git a/lib/Magento/Filesystem/Directory/Write.php b/lib/Magento/Filesystem/Directory/Write.php index 75141df2a4a..7166c67d161 100644 --- a/lib/Magento/Filesystem/Directory/Write.php +++ b/lib/Magento/Filesystem/Directory/Write.php @@ -141,13 +141,7 @@ class Write extends Read implements WriteInterface } $absolutePath = $this->driver->getAbsolutePath($this->path, $path); $absoluteNewPath = $targetDirectory->driver->getAbsolutePath($this->path, $newPath); - $result = $this->driver->rename($absolutePath, $absoluteNewPath); - if (!$result) { - throw new FilesystemException( - sprintf('The "%s" path cannot be renamed into "%s"', $absolutePath, $absoluteNewPath) - ); - } - return $result; + return $this->driver->rename($absolutePath, $absoluteNewPath, $targetDirectory->driver); } /** @@ -170,13 +164,7 @@ class Write extends Read implements WriteInterface $absolutePath = $this->driver->getAbsolutePath($this->path, $path); $absoluteDestination = $targetDirectory->getAbsolutePath($destination); - $result = $this->driver->copy($absolutePath, $absoluteDestination); - if (!$result) { - throw new FilesystemException( - sprintf('The "%s" path cannot be renamed into "%s"', $absolutePath, $absoluteDestination) - ); - } - return $result; + return $this->driver->copy($absolutePath, $absoluteDestination, $targetDirectory->driver); } /** @@ -273,4 +261,14 @@ class Write extends Read implements WriteInterface { return $this->openFile($path, $mode, $protocol)->write($content); } + + /** + * Get driver + * + * @return \Magento\Filesystem\DriverInterface + */ + public function getDriver() + { + return $this->driver; + } } diff --git a/lib/Magento/Filesystem/Directory/WriteInterface.php b/lib/Magento/Filesystem/Directory/WriteInterface.php index a12c766a719..2b9787095c2 100644 --- a/lib/Magento/Filesystem/Directory/WriteInterface.php +++ b/lib/Magento/Filesystem/Directory/WriteInterface.php @@ -113,4 +113,11 @@ interface WriteInterface extends ReadInterface * @throws \Magento\Filesystem\FilesystemException */ public function writeFile($path, $content, $mode = null); + + /** + * Get driver + * + * @return \Magento\Filesystem\DriverInterface + */ + public function getDriver(); } \ No newline at end of file diff --git a/lib/Magento/Filesystem/DirectoryList.php b/lib/Magento/Filesystem/DirectoryList.php index 81153839f20..36475275bb4 100644 --- a/lib/Magento/Filesystem/DirectoryList.php +++ b/lib/Magento/Filesystem/DirectoryList.php @@ -44,29 +44,7 @@ class DirectoryList * * @var array */ - protected $directories = array( - Filesystem::ROOT => array('path' => ''), - Filesystem::APP => array('path' => 'app'), - Filesystem::MODULES => array('path' => 'app/code'), - Filesystem::THEMES => array('path' => 'app/design'), - Filesystem::CONFIG => array('path' => 'app/etc'), - Filesystem::LIB => array('path' => 'lib'), - Filesystem::VAR_DIR => array('path' => 'var'), - Filesystem::TMP => array('path' => 'var/tmp'), - Filesystem::CACHE => array('path' => 'var/cache'), - Filesystem::LOG => array('path' => 'var/log'), - Filesystem::SESSION => array('path' => 'var/session'), - Filesystem::DI => array('path' => 'var/di'), - Filesystem::GENERATION => array('path' => 'var/generation'), - Filesystem::HTTP => array('path' => null), - Filesystem::PUB => array('path' => 'pub'), - Filesystem::PUB_LIB => array('path' => 'pub/lib'), - Filesystem::MEDIA => array('path' => 'pub/media'), - Filesystem::UPLOAD => array('path' => 'pub/media/upload'), - Filesystem::STATIC_VIEW => array('path' => 'pub/static'), - Filesystem::PUB_VIEW_CACHE => array('path' => 'pub/cache'), - Filesystem::LOCALE => array('path' => '') - ); + protected $directories = array(); /** * @var array @@ -81,48 +59,45 @@ class DirectoryList { $this->root = str_replace('\\', '/', $root); - foreach ($this->directories as $code => $configuration) { - if (!$this->isAbsolute($configuration['path'])) { - $this->directories[$code]['path'] = $this->makeAbsolute($configuration['path']); + foreach ($this->directories as $code => $directoryConfig) { + if (!$this->isAbsolute($directoryConfig['path'])) { + $this->directories[$code]['path'] = $this->makeAbsolute($directoryConfig['path']); } } - foreach ($directories as $code => $configuration) { + foreach ($directories as $code => $directoryConfig) { $baseConfiguration = isset($this->directories[$code]) ? $this->directories[$code] : array(); - $this->directories[$code] = array_merge($baseConfiguration, $configuration); + $this->directories[$code] = array_merge($baseConfiguration, $directoryConfig); - if (isset($configuration['path'])) { - $this->setPath($code, $configuration['path']); + if (isset($directoryConfig['path'])) { + $this->setPath($code, $directoryConfig['path']); } - if (isset($configuration['uri'])) { - $this->setUri($code, $configuration['uri']); + if (isset($directoryConfig['uri'])) { + $this->setUri($code, $directoryConfig['uri']); } } - - $this->directories[Filesystem::SYS_TMP] = array( - 'path' => sys_get_temp_dir(), - 'read_only' => false, - 'allow_create_dirs' => true, - 'permissions' => 0777 - ); } /** * Add directory configuration * * @param string $code - * @param array $configuration + * @param array $directoryConfig + * @throws \Magento\Filesystem\FilesystemException */ - public function addDirectory($code, array $configuration) + public function addDirectory($code, array $directoryConfig) { - if (!isset($configuration['path'])) { - $configuration['path'] = null; + if (isset($this->directories[$code])) { + throw new \Magento\Filesystem\FilesystemException("Configuration for '{$code}' already defined"); + } + if (!isset($directoryConfig['path'])) { + $directoryConfig['path'] = null; } - if (!$this->isAbsolute($configuration['path'])) { - $configuration['path'] = $this->makeAbsolute($configuration['path']); + if (!$this->isAbsolute($directoryConfig['path'])) { + $directoryConfig['path'] = $this->makeAbsolute($directoryConfig['path']); } - $this->directories[$code] = $configuration; + $this->directories[$code] = $directoryConfig; } /** @@ -223,7 +198,7 @@ class DirectoryList * @param string $code One of self const * @return string|bool */ - public function getDir($code = Filesystem::ROOT) + public function getDir($code) { return isset($this->directories[$code]['path']) ? $this->directories[$code]['path'] : false; } diff --git a/lib/Magento/Filesystem/Driver/File.php b/lib/Magento/Filesystem/Driver/File.php index 1531793298c..f9bcee09bfc 100644 --- a/lib/Magento/Filesystem/Driver/File.php +++ b/lib/Magento/Filesystem/Driver/File.php @@ -25,9 +25,10 @@ */ namespace Magento\Filesystem\Driver; -use Magento\Filesystem\FilesystemException; +use Magento\Filesystem\FilesystemException, + Magento\Filesystem\DriverInterface; -class File implements \Magento\Filesystem\DriverInterface +class File implements DriverInterface { /** * @var string @@ -161,7 +162,7 @@ class File implements \Magento\Filesystem\DriverInterface { clearstatcache(); $result = @file_get_contents($this->getScheme() . $path, $flag, $context); - if (!$result) { + if (false === $result) { throw new FilesystemException( sprintf('Cannot read contents from file "%s" %s', $path, @@ -276,12 +277,22 @@ class File implements \Magento\Filesystem\DriverInterface * * @param string $oldPath * @param string $newPath + * @param DriverInterface|null $targetDriver * @return bool * @throws FilesystemException */ - public function rename($oldPath, $newPath) + public function rename($oldPath, $newPath, DriverInterface $targetDriver = null) { - $result = @rename($this->getScheme() . $oldPath, $newPath); + $result = false; + $targetDriver = $targetDriver ?: $this; + if (get_class($targetDriver) == get_class($this)) { + $result = @rename($this->getScheme() . $oldPath, $newPath); + } else { + $content = $this->fileGetContents($oldPath); + if (false !== $targetDriver->filePutContents($newPath, $content)) { + $result = $this->deleteFile($newPath); + } + } if (!$result) { throw new FilesystemException( sprintf('The "%s" path cannot be renamed into "%s" %s', @@ -298,12 +309,19 @@ class File implements \Magento\Filesystem\DriverInterface * * @param string $source * @param string $destination + * @param DriverInterface|null $targetDriver * @return bool * @throws FilesystemException */ - public function copy($source, $destination) + public function copy($source, $destination, DriverInterface $targetDriver = null) { - $result = @copy($this->getScheme() . $source, $destination); + $targetDriver = $targetDriver ?: $this; + if (get_class($targetDriver) == get_class($this)) { + $result = @copy($this->getScheme() . $source, $destination); + } else { + $content = $this->fileGetContents($source); + $result = $targetDriver->filePutContents($destination, $content); + } if (!$result) { throw new FilesystemException( sprintf('The file or directory "%s" cannot be copied to "%s" %s', @@ -466,7 +484,7 @@ class File implements \Magento\Filesystem\DriverInterface public function fileReadLine($resource, $length, $ending = null) { $result = @stream_get_line($resource, $length, $ending); - if (!$result) { + if (false === $result) { throw new FilesystemException( sprintf('File cannot be read %s', $this->getWarningMessage() @@ -599,7 +617,7 @@ class File implements \Magento\Filesystem\DriverInterface public function fileWrite($resource, $data) { $result = @fwrite($resource, $data); - if (!$result) { + if (false === $result) { throw new FilesystemException( sprintf('Error occurred during execution of fileWrite %s', $this->getWarningMessage() @@ -740,19 +758,6 @@ class File implements \Magento\Filesystem\DriverInterface return $scheme ? $scheme . '://' : ''; } - /** - * Checks is directory contains path - * Utility method. - * - * @param string $path - * @param string $directory - * @return bool - */ - public function isPathInDirectory($path, $directory) - { - return 0 === strpos($this->fixSeparator($path), $this->fixSeparator($directory)); - } - /** * Read directory recursively * @@ -778,4 +783,16 @@ class File implements \Magento\Filesystem\DriverInterface } return $result; } + + /** + * Get real path + * + * @param string $path + * + * @return string|bool + */ + public function getRealPath($path) + { + return realpath($path); + } } diff --git a/lib/Magento/Filesystem/Driver/Http.php b/lib/Magento/Filesystem/Driver/Http.php index 63af0dfd004..956fa256d50 100644 --- a/lib/Magento/Filesystem/Driver/Http.php +++ b/lib/Magento/Filesystem/Driver/Http.php @@ -103,7 +103,7 @@ class Http extends File { clearstatcache(); $result = @file_get_contents($this->getScheme() . $path, $flags, $context); - if (!$result) { + if (false === $result) { throw new FilesystemException( sprintf( 'Cannot read contents from file "%s" %s', diff --git a/lib/Magento/Filesystem/DriverInterface.php b/lib/Magento/Filesystem/DriverInterface.php index 1a9b2772e15..6021751d5d1 100644 --- a/lib/Magento/Filesystem/DriverInterface.php +++ b/lib/Magento/Filesystem/DriverInterface.php @@ -146,20 +146,22 @@ interface DriverInterface * * @param string $oldPath * @param string $newPath + * @param DriverInterface|null $targetDriver * @return bool * @throws FilesystemException */ - public function rename($oldPath, $newPath); + public function rename($oldPath, $newPath, DriverInterface $targetDriver = null); /** * Copy source into destination * * @param string $source * @param string $destination + * @param DriverInterface|null $targetDriver * @return bool * @throws FilesystemException */ - public function copy($source, $destination); + public function copy($source, $destination, DriverInterface $targetDriver = null); /** * Delete file @@ -350,16 +352,15 @@ interface DriverInterface public function getAbsolutePath($basePath, $path, $scheme = null); /** - * @param string $basePath - * @param null $path + * @param $path * @return mixed */ - public function getRelativePath($basePath, $path = null); + public function getRealPath($path); /** - * @param $path - * @param $directory + * @param string $basePath + * @param null $path * @return mixed */ - public function isPathInDirectory($path, $directory); + public function getRelativePath($basePath, $path = null); } diff --git a/lib/Magento/Image/Adapter/AbstractAdapter.php b/lib/Magento/Image/Adapter/AbstractAdapter.php index 230bc6a55a4..e5cfc35ed48 100644 --- a/lib/Magento/Image/Adapter/AbstractAdapter.php +++ b/lib/Magento/Image/Adapter/AbstractAdapter.php @@ -80,7 +80,7 @@ abstract class AbstractAdapter implements AdapterInterface /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -141,12 +141,12 @@ abstract class AbstractAdapter implements AdapterInterface /** * Initialize default values * - * @param \Magento\Filesystem $filesystem, + * @param \Magento\App\Filesystem $filesystem, * @param array $data */ - public function __construct(\Magento\Filesystem $filesystem, array $data = array()) { + public function __construct(\Magento\App\Filesystem $filesystem, array $data = array()) { $this->_filesystem = $filesystem; - $this->directoryWrite = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $this->directoryWrite = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); } /** diff --git a/lib/Magento/Logger.php b/lib/Magento/Logger.php index e40c592fadd..dc7932ca19d 100644 --- a/lib/Magento/Logger.php +++ b/lib/Magento/Logger.php @@ -42,15 +42,15 @@ class Logger protected $_loggers = array(); /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param string $defaultFile */ - public function __construct(\Magento\Filesystem $filesystem, $defaultFile = '') + public function __construct(\Magento\App\Filesystem $filesystem, $defaultFile = '') { $this->_filesystem = $filesystem; $this->addStreamLog(self::LOGGER_SYSTEM, $defaultFile) @@ -72,7 +72,7 @@ class Logger { $file = $fileOrWrapper ?: "{$loggerKey}.log"; if (!preg_match('#^[a-z][a-z0-9+.-]*\://#i', $file)) { - $logDir = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::LOG); + $logDir = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::LOG_DIR); $logDir->create(); $file = $logDir->getAbsolutePath($file); } diff --git a/lib/Magento/Module/Declaration/FileIterator.php b/lib/Magento/Module/Declaration/FileIterator.php index d8c5fff27e9..73143c246f0 100644 --- a/lib/Magento/Module/Declaration/FileIterator.php +++ b/lib/Magento/Module/Declaration/FileIterator.php @@ -27,10 +27,10 @@ class FileIterator extends \Magento\Config\FileIterator { public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, array $paths ) { - parent::__construct($filesystem->getDirectoryRead(\Magento\Filesystem::APP), $paths); + parent::__construct($filesystem->getDirectoryRead(\Magento\App\Filesystem::APP_DIR), $paths); } } diff --git a/lib/Magento/Module/Declaration/FileResolver.php b/lib/Magento/Module/Declaration/FileResolver.php index 65f88b5fe51..9edb5e94708 100644 --- a/lib/Magento/Module/Declaration/FileResolver.php +++ b/lib/Magento/Module/Declaration/FileResolver.php @@ -56,17 +56,17 @@ class FileResolver implements \Magento\Config\FileResolverInterface protected $iteratorFactory; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Config\FileIteratorFactory $iteratorFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Config\FileIteratorFactory $iteratorFactory ) { $this->iteratorFactory = $iteratorFactory; - $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::MODULES); - $this->configDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::CONFIG); - $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->modulesDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::MODULES_DIR); + $this->configDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::CONFIG_DIR); + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); } /** diff --git a/lib/Magento/Module/Dir.php b/lib/Magento/Module/Dir.php index 587636e4730..a19bfc0b7a0 100644 --- a/lib/Magento/Module/Dir.php +++ b/lib/Magento/Module/Dir.php @@ -25,7 +25,7 @@ */ namespace Magento\Module; -use Magento\Filesystem; +use Magento\App\Filesystem; class Dir { @@ -42,12 +42,12 @@ class Dir protected $_string; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Stdlib\String $string */ public function __construct(Filesystem $filesystem, \Magento\Stdlib\String $string) { - $this->_modulesDirectory = $filesystem->getDirectoryRead(Filesystem::MODULES); + $this->_modulesDirectory = $filesystem->getDirectoryRead(Filesystem::MODULES_DIR); $this->_string = $string; } diff --git a/lib/Magento/Module/Dir/Reader.php b/lib/Magento/Module/Dir/Reader.php index e440219c98d..3f19fe390e5 100644 --- a/lib/Magento/Module/Dir/Reader.php +++ b/lib/Magento/Module/Dir/Reader.php @@ -26,7 +26,7 @@ namespace Magento\Module\Dir; use Magento\Filesystem\Directory\Read; -use Magento\Filesystem; +use Magento\App\Filesystem; class Reader { @@ -57,22 +57,23 @@ class Reader protected $modulesDirectory; protected $fileIteratorFactory; + /** * @param \Magento\Module\Dir $moduleDirs * @param \Magento\Module\ModuleListInterface $moduleList * @param Filesystem $filesystem - * @param \Magento\Config\FileIteratorFactory $fileIterator + * @param \Magento\Config\FileIteratorFactory $fileIteratorFactory */ public function __construct( \Magento\Module\Dir $moduleDirs, \Magento\Module\ModuleListInterface $moduleList, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Config\FileIteratorFactory $fileIteratorFactory ) { $this->moduleDirs = $moduleDirs; $this->modulesList = $moduleList; $this->fileIteratorFactory = $fileIteratorFactory; - $this->modulesDirectory = $filesystem->getDirectoryRead(Filesystem::MODULES); + $this->modulesDirectory = $filesystem->getDirectoryRead(Filesystem::MODULES_DIR); } /** diff --git a/lib/Magento/Object/Copy/Config/SchemaLocator.php b/lib/Magento/Object/Copy/Config/SchemaLocator.php index 25c0c4b3785..3dee553eaf3 100644 --- a/lib/Magento/Object/Copy/Config/SchemaLocator.php +++ b/lib/Magento/Object/Copy/Config/SchemaLocator.php @@ -42,14 +42,14 @@ class SchemaLocator implements \Magento\Config\SchemaLocatorInterface protected $_perFileSchema; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param string $schema * @param string $perFileSchema */ - public function __construct(\Magento\Filesystem $filesystem, $schema, $perFileSchema) + public function __construct(\Magento\App\Filesystem $filesystem, $schema, $perFileSchema) { - $this->_schema = $filesystem->getPath(\Magento\Filesystem::ROOT) . '/' . $schema; - $this->_perFileSchemaschema = $filesystem->getPath(\Magento\Filesystem::ROOT) . '/' . $perFileSchema; + $this->_schema = $filesystem->getPath(\Magento\App\Filesystem::ROOT_DIR) . '/' . $schema; + $this->_perFileSchemaschema = $filesystem->getPath(\Magento\App\Filesystem::ROOT_DIR) . '/' . $perFileSchema; } /** diff --git a/lib/Magento/View/Asset/MergeService.php b/lib/Magento/View/Asset/MergeService.php index 02674f5d281..8d700a0e819 100644 --- a/lib/Magento/View/Asset/MergeService.php +++ b/lib/Magento/View/Asset/MergeService.php @@ -40,7 +40,7 @@ class MergeService protected $config; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -52,13 +52,13 @@ class MergeService /** * @param \Magento\ObjectManager $objectManager * @param ConfigInterface $config - * @param \Magento\Filesystem $filesystem, + * @param \Magento\App\Filesystem $filesystem, * @param \Magento\App\State $state */ public function __construct( \Magento\ObjectManager $objectManager, ConfigInterface $config, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\App\State $state ) { $this->objectManager = $objectManager; @@ -106,6 +106,7 @@ class MergeService */ public function cleanMergedJsCss() { - $this->filesystem->getDirectoryWrite(\Magento\Filesystem::PUB_VIEW_CACHE)->delete(Merged::PUBLIC_MERGE_DIR); + $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR) + ->delete(Merged::PUBLIC_MERGE_DIR); } } diff --git a/lib/Magento/View/Asset/MergeStrategy/Checksum.php b/lib/Magento/View/Asset/MergeStrategy/Checksum.php index bd59e33e3a7..a7eca911403 100644 --- a/lib/Magento/View/Asset/MergeStrategy/Checksum.php +++ b/lib/Magento/View/Asset/MergeStrategy/Checksum.php @@ -36,17 +36,17 @@ class Checksum implements \Magento\View\Asset\MergeStrategyInterface protected $strategy; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; /** * @param \Magento\View\Asset\MergeStrategyInterface $strategy - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\View\Asset\MergeStrategyInterface $strategy, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->strategy = $strategy; $this->filesystem = $filesystem; @@ -61,7 +61,7 @@ class Checksum implements \Magento\View\Asset\MergeStrategyInterface // Check whether we have already merged these files $filesMTimeData = ''; - $directory = $this->filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $directory = $this->filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); foreach ($publicFiles as $file) { $filesMTimeData .= $directory->stat($file)['mtime']; } diff --git a/lib/Magento/View/Asset/MergeStrategy/Direct.php b/lib/Magento/View/Asset/MergeStrategy/Direct.php index b76fef5ec50..1009bb04e53 100644 --- a/lib/Magento/View/Asset/MergeStrategy/Direct.php +++ b/lib/Magento/View/Asset/MergeStrategy/Direct.php @@ -40,14 +40,14 @@ class Direct implements \Magento\View\Asset\MergeStrategyInterface protected $cssUrlResolver; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Url\CssResolver $cssUrlResolver */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\Url\CssResolver $cssUrlResolver ) { - $this->_directory = $filesystem->getDirectoryWrite(\Magento\Filesystem::PUB); + $this->_directory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::PUB_DIR); $this->_cssUrlResolver = $cssUrlResolver; } diff --git a/lib/Magento/View/Asset/MergeStrategy/FileExists.php b/lib/Magento/View/Asset/MergeStrategy/FileExists.php index f83bb67e36e..abb45162ee5 100644 --- a/lib/Magento/View/Asset/MergeStrategy/FileExists.php +++ b/lib/Magento/View/Asset/MergeStrategy/FileExists.php @@ -35,17 +35,17 @@ class FileExists implements \Magento\View\Asset\MergeStrategyInterface protected $strategy; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; /** * @param \Magento\View\Asset\MergeStrategyInterface $strategy - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\View\Asset\MergeStrategyInterface $strategy, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->strategy = $strategy; $this->filesystem = $filesystem; @@ -56,7 +56,7 @@ class FileExists implements \Magento\View\Asset\MergeStrategyInterface */ public function mergeFiles(array $publicFiles, $destinationFile, $contentType) { - if (!$this->filesystem->getDirectoryRead(\Magento\Filesystem::ROOT)->isExist($destinationFile)) { + if (!$this->filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR)->isExist($destinationFile)) { $this->strategy->mergeFiles($publicFiles, $destinationFile, $contentType); } } diff --git a/lib/Magento/View/Asset/Merged.php b/lib/Magento/View/Asset/Merged.php index e016a1d59a2..475b53901c0 100644 --- a/lib/Magento/View/Asset/Merged.php +++ b/lib/Magento/View/Asset/Merged.php @@ -162,10 +162,10 @@ class Merged implements \Iterator */ protected function getMergedFilePath(array $publicFiles) { - /** @var \Magento\Filesystem $filesystem */ - $filesystem = $this->objectManager->get('Magento\Filesystem'); - $jsDir = $filesystem->getPath(\Magento\Filesystem::PUB_LIB); - $publicDir = $filesystem->getPath(\Magento\Filesystem::STATIC_VIEW); + /** @var \Magento\App\Filesystem $filesystem */ + $filesystem = $this->objectManager->get('Magento\App\Filesystem'); + $jsDir = $filesystem->getPath(\Magento\App\Filesystem::PUB_LIB_DIR); + $publicDir = $filesystem->getPath(\Magento\App\Filesystem::STATIC_VIEW_DIR); $prefixRemovals = array($jsDir, $publicDir); @@ -174,7 +174,7 @@ class Merged implements \Iterator $relFileNames[] = ltrim(str_replace($prefixRemovals, '', $file), '/'); } - $mergedDir = $filesystem->getDirectoryRead(\Magento\Filesystem::PUB_VIEW_CACHE) + $mergedDir = $filesystem->getDirectoryRead(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR) ->getAbsolutePath(self::PUBLIC_MERGE_DIR); return $mergedDir . '/' . md5(implode('|', $relFileNames)) . '.' . $this->contentType; } diff --git a/lib/Magento/View/Asset/MinifyService.php b/lib/Magento/View/Asset/MinifyService.php index 0d9246ac083..2113f2dbc26 100644 --- a/lib/Magento/View/Asset/MinifyService.php +++ b/lib/Magento/View/Asset/MinifyService.php @@ -57,7 +57,7 @@ class MinifyService /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -65,13 +65,13 @@ class MinifyService * @param ConfigInterface $config * @param \Magento\ObjectManager $objectManager * @param \Magento\App\State $appState - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( ConfigInterface $config, \Magento\ObjectManager $objectManager, \Magento\App\State $appState, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->config = $config; $this->objectManager = $objectManager; @@ -126,7 +126,7 @@ class MinifyService ->create('Magento\Code\Minifier\Strategy\Generate', $strategyParams); } $baseDir = $this->_filesystem - ->getDirectoryRead(\Magento\Filesystem::PUB_VIEW_CACHE) + ->getDirectoryRead(\Magento\App\Filesystem::PUB_VIEW_CACHE_DIR) ->getAbsolutePath('minify'); $this->minifiers[$contentType] = $this->objectManager->create('Magento\Code\Minifier', diff --git a/lib/Magento/View/Config.php b/lib/Magento/View/Config.php index 91cbe01d636..a6405be371b 100644 --- a/lib/Magento/View/Config.php +++ b/lib/Magento/View/Config.php @@ -24,13 +24,11 @@ namespace Magento\View; +use Magento\Filesystem\Directory\ReadInterface; + /** * Handles theme view.xml files */ -namespace Magento\View; - -use Magento\Filesystem\Directory\ReadInterface; - class Config implements \Magento\View\ConfigInterface { /** @@ -76,7 +74,7 @@ class Config implements \Magento\View\ConfigInterface /** * @param \Magento\Module\Dir\Reader $moduleReader - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param Service $viewService * @param FileSystem $viewFileSystem * @param \Magento\Config\FileIteratorFactory $fileIteratorFactory @@ -84,14 +82,14 @@ class Config implements \Magento\View\ConfigInterface */ public function __construct( \Magento\Module\Dir\Reader $moduleReader, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\Service $viewService, \Magento\View\FileSystem $viewFileSystem, \Magento\Config\FileIteratorFactory $fileIteratorFactory, $filename = self::CONFIG_FILE_NAME ) { $this->moduleReader = $moduleReader; - $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $this->rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->viewService = $viewService; $this->viewFileSystem = $viewFileSystem; $this->filename = $filename; diff --git a/lib/Magento/View/Design/Fallback/Factory.php b/lib/Magento/View/Design/Fallback/Factory.php index 1d3bec7e9d8..672783e46f4 100644 --- a/lib/Magento/View/Design/Fallback/Factory.php +++ b/lib/Magento/View/Design/Fallback/Factory.php @@ -24,7 +24,7 @@ namespace Magento\View\Design\Fallback; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\View\Design\Fallback\Rule\Composite; use Magento\View\Design\Fallback\Rule\ModularSwitch; use Magento\View\Design\Fallback\Rule\RuleInterface; @@ -60,7 +60,7 @@ class Factory */ public function createLocaleFileRule() { - $themesDir = $this->filesystem->getPath(Filesystem::THEMES); + $themesDir = $this->filesystem->getPath(Filesystem::THEMES_DIR); return new Theme( new Simple("$themesDir/<area>/<theme_path>/i18n/<locale>") ); @@ -73,8 +73,8 @@ class Factory */ public function createFileRule() { - $themesDir = $this->filesystem->getPath(Filesystem::THEMES); - $modulesDir = $this->filesystem->getPath(Filesystem::MODULES); + $themesDir = $this->filesystem->getPath(Filesystem::THEMES_DIR); + $modulesDir = $this->filesystem->getPath(Filesystem::MODULES_DIR); return new ModularSwitch( new Theme( new Simple( @@ -103,9 +103,9 @@ class Factory */ public function createViewFileRule() { - $themesDir = $this->filesystem->getPath(Filesystem::THEMES); - $modulesDir = $this->filesystem->getPath(Filesystem::MODULES); - $pubLibDir = $this->filesystem->getPath(Filesystem::PUB_LIB); + $themesDir = $this->filesystem->getPath(Filesystem::THEMES_DIR); + $modulesDir = $this->filesystem->getPath(Filesystem::MODULES_DIR); + $pubLibDir = $this->filesystem->getPath(Filesystem::PUB_LIB_DIR); return new ModularSwitch( new Composite( array( diff --git a/lib/Magento/View/Design/FileResolution/Strategy/Fallback.php b/lib/Magento/View/Design/FileResolution/Strategy/Fallback.php index c073e7d55f5..2c8c710a948 100644 --- a/lib/Magento/View/Design/FileResolution/Strategy/Fallback.php +++ b/lib/Magento/View/Design/FileResolution/Strategy/Fallback.php @@ -24,7 +24,7 @@ namespace Magento\View\Design\FileResolution\Strategy; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\View\Design\Fallback\Factory; use Magento\View\Design\Fallback\Rule\RuleInterface; use Magento\View\Design\ThemeInterface; @@ -70,7 +70,7 @@ class Fallback implements FileInterface, LocaleInterface, ViewInterface */ public function __construct(Filesystem $filesystem, Factory $fallbackFactory) { - $this->rootDirectory = $filesystem->getDirectoryRead(Filesystem::ROOT); + $this->rootDirectory = $filesystem->getDirectoryRead(Filesystem::ROOT_DIR); $this->fallbackFactory = $fallbackFactory; } diff --git a/lib/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxy.php b/lib/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxy.php index 6e0ef3d135f..bd1468fb035 100644 --- a/lib/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxy.php +++ b/lib/Magento/View/Design/FileResolution/Strategy/Fallback/CachingProxy.php @@ -24,7 +24,7 @@ namespace Magento\View\Design\FileResolution\Strategy\Fallback; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\View\Design\FileResolution\Strategy\Fallback; use Magento\View\Design\FileResolution\Strategy\FileInterface; use Magento\View\Design\FileResolution\Strategy\LocaleInterface; @@ -98,7 +98,7 @@ class CachingProxy implements FileInterface, LocaleInterface, ViewInterface, Not ) { $this->fallback = $fallback; $this->varDirectory = $filesystem->getDirectoryWrite(Filesystem::VAR_DIR); - $rootDirectory = $filesystem->getDirectoryRead(Filesystem::ROOT); + $rootDirectory = $filesystem->getDirectoryRead(Filesystem::ROOT_DIR); if (!$rootDirectory->isDirectory($rootDirectory->getRelativePath($baseDir))) { throw new \InvalidArgumentException("Wrong base directory specified: '{$baseDir}'"); } diff --git a/lib/Magento/View/Design/FileResolution/StrategyPool.php b/lib/Magento/View/Design/FileResolution/StrategyPool.php index 27a552b33bc..174c70b0e1f 100644 --- a/lib/Magento/View/Design/FileResolution/StrategyPool.php +++ b/lib/Magento/View/Design/FileResolution/StrategyPool.php @@ -26,7 +26,7 @@ namespace Magento\View\Design\FileResolution; use Magento\Exception; use Magento\App\State; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\ObjectManager; /** @@ -186,7 +186,7 @@ class StrategyPool $mapDir = $this->filesystem->getPath(Filesystem::VAR_DIR) . '/' . self::FALLBACK_MAP_DIR; $arguments = array( 'mapDir' => $mapDir, - 'baseDir' => $this->filesystem->getPath(Filesystem::ROOT), + 'baseDir' => $this->filesystem->getPath(Filesystem::ROOT_DIR), ); break; default: diff --git a/lib/Magento/View/Design/Theme/Customization/AbstractFile.php b/lib/Magento/View/Design/Theme/Customization/AbstractFile.php index 74925edeff4..374d55bba97 100644 --- a/lib/Magento/View/Design/Theme/Customization/AbstractFile.php +++ b/lib/Magento/View/Design/Theme/Customization/AbstractFile.php @@ -42,19 +42,19 @@ abstract class AbstractFile protected $_fileFactory; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; /** * @param \Magento\View\Design\Theme\Customization\Path $customizationPath * @param \Magento\View\Design\Theme\FileFactory $fileFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\View\Design\Theme\Customization\Path $customizationPath, \Magento\View\Design\Theme\FileFactory $fileFactory, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_customizationPath = $customizationPath; $this->_fileFactory = $fileFactory; @@ -207,6 +207,6 @@ abstract class AbstractFile */ protected function getDirectoryWrite() { - return $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + return $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); } } diff --git a/lib/Magento/View/Design/Theme/Customization/Path.php b/lib/Magento/View/Design/Theme/Customization/Path.php index 168edb82554..797af847ad6 100644 --- a/lib/Magento/View/Design/Theme/Customization/Path.php +++ b/lib/Magento/View/Design/Theme/Customization/Path.php @@ -43,7 +43,7 @@ class Path protected $filename; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -60,17 +60,17 @@ class Path /** * Constructor * - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param $filename */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, $filename = \Magento\View\ConfigInterface::CONFIG_FILE_NAME ) { $this->filesystem = $filesystem; $this->filename = $filename; - $this->mediaDirectoryRead = $this->filesystem->getDirectoryRead(\Magento\Filesystem::MEDIA); - $this->themeDirectoryRead = $this->filesystem->getDirectoryRead(\Magento\Filesystem::THEMES); + $this->mediaDirectoryRead = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); + $this->themeDirectoryRead = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::THEMES_DIR); } /** diff --git a/lib/Magento/View/Design/Theme/Image.php b/lib/Magento/View/Design/Theme/Image.php index a78d7104c51..404a4ce1d23 100644 --- a/lib/Magento/View/Design/Theme/Image.php +++ b/lib/Magento/View/Design/Theme/Image.php @@ -74,7 +74,7 @@ class Image /** * Initialize dependencies * - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\Image\Factory $imageFactory * @param Image\Uploader $uploader * @param Image\PathInterface $themeImagePath @@ -82,14 +82,14 @@ class Image * @param \Magento\View\Design\ThemeInterface $theme */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\Image\Factory $imageFactory, Image\Uploader $uploader, Image\PathInterface $themeImagePath, \Magento\Logger $logger, \Magento\View\Design\ThemeInterface $theme = null ) { - $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::MEDIA); + $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_imageFactory = $imageFactory; $this->_uploader = $uploader; $this->_themeImagePath = $themeImagePath; diff --git a/lib/Magento/View/Design/Theme/Image/Uploader.php b/lib/Magento/View/Design/Theme/Image/Uploader.php index 6d7b93d6e64..1d642f9701f 100644 --- a/lib/Magento/View/Design/Theme/Image/Uploader.php +++ b/lib/Magento/View/Design/Theme/Image/Uploader.php @@ -37,7 +37,7 @@ class Uploader protected $_allowedExtensions = array('jpg', 'jpeg', 'gif', 'png', 'xbm', 'wbmp'); /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -52,12 +52,12 @@ class Uploader protected $_uploaderFactory; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\HTTP\Adapter\FileTransferFactory $adapterFactory * @param \Magento\File\UploaderFactory $uploaderFactory */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\HTTP\Adapter\FileTransferFactory $adapterFactory, \Magento\File\UploaderFactory $uploaderFactory ) { diff --git a/lib/Magento/View/Element/AbstractBlock.php b/lib/Magento/View/Element/AbstractBlock.php index e9c7d5c7808..5ba9c9bfd29 100644 --- a/lib/Magento/View/Element/AbstractBlock.php +++ b/lib/Magento/View/Element/AbstractBlock.php @@ -145,6 +145,14 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ protected $_locale; + /** + * The property is used to define content-scope of block. Can be private or public. + * If it isn't defined then application considers it as false. + * + * @var bool + */ + protected $_isScopePrivate; + /** * @param \Magento\View\Element\Context $context * @param array $data @@ -170,6 +178,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $this->_escaper = $context->getEscaper(); $this->filterManager = $context->getFilterManager(); $this->_locale = $context->getLocale(); + $this->_isScopePrivate = false; parent::__construct($data); $this->_construct(); } @@ -974,4 +983,15 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $module = $module ?: $this->getModuleName(); return $this->_viewConfig->getViewConfig()->getVarValue($module, $name); } + + /** + * Determine if the block scope is private or public. + * Returns true if scope is private, false otherwise + * + * @return bool + */ + public function isScopePrivate() + { + return $this->_isScopePrivate; + } } diff --git a/lib/Magento/View/Element/BlockFactory.php b/lib/Magento/View/Element/BlockFactory.php index b111a133bd4..2f5238f6ced 100644 --- a/lib/Magento/View/Element/BlockFactory.php +++ b/lib/Magento/View/Element/BlockFactory.php @@ -56,6 +56,9 @@ class BlockFactory if (!$block instanceof BlockInterface) { throw new \LogicException($blockName . ' does not implemented BlockInterface'); } + if ($block instanceof Template) { + $block->setTemplateContext($block); + } return $block; } } diff --git a/lib/Magento/View/Element/Template.php b/lib/Magento/View/Element/Template.php index fbb38b33711..4101ed5e655 100644 --- a/lib/Magento/View/Element/Template.php +++ b/lib/Magento/View/Element/Template.php @@ -24,7 +24,7 @@ namespace Magento\View\Element; -use Magento\Filesystem; +use Magento\App\Filesystem; /** * Base html block @@ -109,6 +109,11 @@ class Template extends AbstractBlock */ private $mediaDirectory; + /** + * @var \Magento\View\Element\BlockInterface + */ + protected $templateContext; + /** * @param Template\Context $context * @param array $data @@ -122,9 +127,20 @@ class Template extends AbstractBlock $this->templateEnginePool = $context->getEnginePool(); $this->_storeManager = $context->getStoreManager(); $this->_appState = $context->getAppState(); + $this->templateContext = $this; parent::__construct($context, $data); } + /** + * Set template context. Sets the object that should represent $this in template + * + * @param $templateContext + */ + public function setTemplateContext($templateContext) + { + $this->templateContext = $templateContext; + } + /** * Internal constructor, that is called from real constructor */ @@ -226,7 +242,7 @@ class Template extends AbstractBlock if ($this->isTemplateFileValid($fileName)) { $extension = pathinfo($fileName, PATHINFO_EXTENSION); $templateEngine = $this->templateEnginePool->get($extension); - $html = $templateEngine->render($this, $fileName, $this->_viewVars); + $html = $templateEngine->render($this->templateContext, $fileName, $this->_viewVars); } else { $html = ''; $this->_logger->log("Invalid template file: '{$fileName}'", \Zend_Log::CRIT); @@ -310,7 +326,7 @@ class Template extends AbstractBlock protected function getRootDirectory() { if (null === $this->directory) { - $this->directory = $this->_filesystem->getDirectoryRead(Filesystem::ROOT); + $this->directory = $this->_filesystem->getDirectoryRead(Filesystem::ROOT_DIR); } return $this->directory; @@ -324,7 +340,7 @@ class Template extends AbstractBlock protected function getMediaDirectory() { if (!$this->mediaDirectory) { - $this->mediaDirectory = $this->_filesystem->getDirectoryRead(Filesystem::MEDIA); + $this->mediaDirectory = $this->_filesystem->getDirectoryRead(Filesystem::MEDIA_DIR); } return $this->mediaDirectory; } @@ -344,8 +360,8 @@ class Template extends AbstractBlock { $fileName = str_replace('\\', '/', $fileName); - $themesDir = str_replace('\\', '/', $this->_filesystem->getPath(Filesystem::THEMES)); - $appDir = str_replace('\\', '/', $this->_filesystem->getPath(Filesystem::APP)); + $themesDir = str_replace('\\', '/', $this->_filesystem->getPath(Filesystem::THEMES_DIR)); + $appDir = str_replace('\\', '/', $this->_filesystem->getPath(Filesystem::APP_DIR)); return ( $this->isPathInDirectory($fileName, $appDir) || $this->isPathInDirectory($fileName, $themesDir) diff --git a/lib/Magento/View/Element/Template/Context.php b/lib/Magento/View/Element/Template/Context.php index 9cfc9153397..7f5f814876f 100644 --- a/lib/Magento/View/Element/Template/Context.php +++ b/lib/Magento/View/Element/Template/Context.php @@ -27,7 +27,7 @@ class Context extends \Magento\View\Element\Context /** * Filesystem instance * - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -71,13 +71,13 @@ class Context extends \Magento\View\Element\Context * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool * @param \Magento\App\State $appState * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -100,7 +100,7 @@ class Context extends \Magento\View\Element\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Core\Model\LocaleInterface $locale, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, \Magento\App\State $appState, @@ -141,7 +141,7 @@ class Context extends \Magento\View\Element\Context /** * Get filesystem instance * - * @return \Magento\Filesystem + * @return \Magento\App\Filesystem */ public function getFilesystem() { diff --git a/lib/Magento/View/Layout/File/Source/Base.php b/lib/Magento/View/Layout/File/Source/Base.php index 727755a8626..eeefa64a687 100644 --- a/lib/Magento/View/Layout/File/Source/Base.php +++ b/lib/Magento/View/Layout/File/Source/Base.php @@ -26,7 +26,7 @@ namespace Magento\View\Layout\File\Source; use Magento\View\Layout\File\SourceInterface; use Magento\View\Design\ThemeInterface; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\Filesystem\Directory\ReadInterface; use Magento\View\Layout\File\Factory; @@ -53,7 +53,7 @@ class Base implements SourceInterface Filesystem $filesystem, Factory $fileFactory ) { - $this->modulesDirectory = $filesystem->getDirectoryRead(Filesystem::MODULES); + $this->modulesDirectory = $filesystem->getDirectoryRead(Filesystem::MODULES_DIR); $this->fileFactory = $fileFactory; } diff --git a/lib/Magento/View/Layout/File/Source/Override/Base.php b/lib/Magento/View/Layout/File/Source/Override/Base.php index 8a525c5688a..db99303df49 100644 --- a/lib/Magento/View/Layout/File/Source/Override/Base.php +++ b/lib/Magento/View/Layout/File/Source/Override/Base.php @@ -26,7 +26,7 @@ namespace Magento\View\Layout\File\Source\Override; use Magento\View\Layout\File\SourceInterface; use Magento\View\Design\ThemeInterface; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\Filesystem\Directory\ReadInterface; use Magento\View\Layout\File\Factory; @@ -53,7 +53,7 @@ class Base implements SourceInterface Filesystem $filesystem, Factory $fileFactory ) { - $this->themesDirectory = $filesystem->getDirectoryRead(Filesystem::THEMES); + $this->themesDirectory = $filesystem->getDirectoryRead(Filesystem::THEMES_DIR); $this->fileFactory = $fileFactory; } diff --git a/lib/Magento/View/Layout/File/Source/Override/Theme.php b/lib/Magento/View/Layout/File/Source/Override/Theme.php index f894c640123..26dae12eea6 100644 --- a/lib/Magento/View/Layout/File/Source/Override/Theme.php +++ b/lib/Magento/View/Layout/File/Source/Override/Theme.php @@ -26,7 +26,7 @@ namespace Magento\View\Layout\File\Source\Override; use Magento\View\Layout\File\SourceInterface; use Magento\View\Design\ThemeInterface; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\Filesystem\Directory\ReadInterface; use Magento\View\Layout\File\Factory; use Magento\Exception; @@ -54,7 +54,7 @@ class Theme implements SourceInterface Filesystem $filesystem, Factory $fileFactory ) { - $this->themesDirectory = $filesystem->getDirectoryRead(Filesystem::THEMES); + $this->themesDirectory = $filesystem->getDirectoryRead(Filesystem::THEMES_DIR); $this->fileFactory = $fileFactory; } diff --git a/lib/Magento/View/Layout/File/Source/Theme.php b/lib/Magento/View/Layout/File/Source/Theme.php index 3b5154cc06e..307a8cab448 100644 --- a/lib/Magento/View/Layout/File/Source/Theme.php +++ b/lib/Magento/View/Layout/File/Source/Theme.php @@ -26,7 +26,7 @@ namespace Magento\View\Layout\File\Source; use Magento\View\Layout\File\SourceInterface; use Magento\View\Design\ThemeInterface; -use Magento\Filesystem; +use Magento\App\Filesystem; use Magento\Filesystem\Directory\ReadInterface; use Magento\View\Layout\File\Factory; @@ -53,7 +53,7 @@ class Theme implements SourceInterface Filesystem $filesystem, Factory $fileFactory ) { - $this->themesDirectory = $filesystem->getDirectoryRead(Filesystem::THEMES); + $this->themesDirectory = $filesystem->getDirectoryRead(Filesystem::THEMES_DIR); $this->fileFactory = $fileFactory; } diff --git a/lib/Magento/View/Publisher.php b/lib/Magento/View/Publisher.php index a6ccd6e60a8..f4951adaae1 100644 --- a/lib/Magento/View/Publisher.php +++ b/lib/Magento/View/Publisher.php @@ -52,7 +52,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface /**#@-*/ /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -97,7 +97,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface /** * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\Url\CssResolver $cssUrlResolver * @param Service $viewService * @param FileSystem $viewFileSystem @@ -106,7 +106,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface */ public function __construct( \Magento\Logger $logger, - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\Url\CssResolver $cssUrlResolver, \Magento\View\Service $viewService, \Magento\View\FileSystem $viewFileSystem, @@ -114,7 +114,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface $allowDuplication ) { $this->_filesystem = $filesystem; - $this->rootDirectory = $filesystem->getDirectoryWrite(\Magento\Filesystem::ROOT); + $this->rootDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $this->_cssUrlResolver = $cssUrlResolver; $this->_viewService = $viewService; $this->_viewFileSystem = $viewFileSystem; @@ -198,7 +198,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface $cssContent = $this->_getPublicCssContent($sourcePath, $targetPath, $filePath, $params); } - $targetDirectory = $this->_filesystem->getDirectoryWrite(\Magento\Filesystem::STATIC_VIEW); + $targetDirectory = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::STATIC_VIEW_DIR); $sourcePathRelative = $this->rootDirectory->getRelativePath($sourcePath); $targetPathRelative = $targetDirectory->getRelativePath($targetPath); @@ -252,7 +252,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface */ protected function _needToProcessFile($filePath) { - $jsPath = $this->_filesystem->getPath(\Magento\Filesystem::PUB_LIB) . '/'; + $jsPath = $this->_filesystem->getPath(\Magento\App\Filesystem::PUB_LIB_DIR) . '/'; $filePath = str_replace('\\', '/', $filePath); if (strncmp($filePath, $jsPath, strlen($jsPath)) === 0) { return false; @@ -267,7 +267,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface return false; } - $themePath = $this->_filesystem->getPath(\Magento\Filesystem::STATIC_VIEW) . '/'; + $themePath = $this->_filesystem->getPath(\Magento\App\Filesystem::STATIC_VIEW_DIR) . '/'; if (strncmp($filePath, $themePath, strlen($themePath)) !== 0) { return true; } @@ -322,7 +322,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface */ protected function _buildPublicViewSufficientFilename($filename, array $params) { - $designDir = $this->_filesystem->getPath(\Magento\Filesystem::THEMES) . '/'; + $designDir = $this->_filesystem->getPath(\Magento\App\Filesystem::THEMES_DIR) . '/'; if (0 === strpos($filename, $designDir)) { // theme file $publicFile = substr($filename, strlen($designDir)); @@ -394,7 +394,7 @@ class Publisher implements \Magento\View\PublicFilesManagerInterface $filePath = $this->_viewService->extractScope($this->_viewFileSystem->normalizePath($fileId), $params); } else { /* Check if module file overridden on theme level based on _module property and file path */ - $themesPath = $this->_filesystem->getPath(\Magento\Filesystem::THEMES); + $themesPath = $this->_filesystem->getPath(\Magento\App\Filesystem::THEMES_DIR); if ($params['module'] && strpos($parentFilePath, $themesPath) === 0) { /* Add module directory to relative URL */ $filePath = dirname($params['module'] . '/' . $parentFileName) diff --git a/lib/Magento/View/Service.php b/lib/Magento/View/Service.php index 70abdc723ab..5b5586b3d36 100644 --- a/lib/Magento/View/Service.php +++ b/lib/Magento/View/Service.php @@ -58,17 +58,17 @@ class Service * @param \Magento\App\State $appState * @param \Magento\View\DesignInterface $design * @param \Magento\View\Design\Theme\FlyweightFactory $themeFactory - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\App\State $appState, \Magento\View\DesignInterface $design, \Magento\View\Design\Theme\FlyweightFactory $themeFactory, - \Magento\Filesystem $filesystem + \Magento\App\Filesystem $filesystem ) { $this->_appState = $appState; $this->_design = $design; - $this->_pubDirectory = $filesystem->getPath(\Magento\Filesystem::STATIC_VIEW); + $this->_pubDirectory = $filesystem->getPath(\Magento\App\Filesystem::STATIC_VIEW_DIR); $this->themeFactory = $themeFactory; } diff --git a/lib/Magento/View/Url.php b/lib/Magento/View/Url.php index 4e8f48b3cbc..d87622d4888 100644 --- a/lib/Magento/View/Url.php +++ b/lib/Magento/View/Url.php @@ -35,7 +35,7 @@ class Url const XML_PATH_STATIC_FILE_SIGNATURE = 'dev/static/sign'; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $_filesystem; @@ -77,7 +77,7 @@ class Url protected $_viewFileSystem; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\UrlInterface $urlBuilder * @param Url\ConfigInterface $config * @param Service $viewService @@ -87,7 +87,7 @@ class Url * @param array $fileUrlMap */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\UrlInterface $urlBuilder, \Magento\View\Url\ConfigInterface $config, \Magento\View\Service $viewService, @@ -167,7 +167,7 @@ class Url ) . $relativePath; if ($this->_isStaticFilesSigned() && $this->_viewService->isViewFileOperationAllowed()) { - $directory = $this->_filesystem->getDirectoryRead(\Magento\Filesystem::ROOT); + $directory = $this->_filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $fileMTime = $directory->stat($directory->getRelativePath($publicFilePath))['mtime']; $url .= '?' . $fileMTime; } diff --git a/lib/Magento/View/Url/CssResolver.php b/lib/Magento/View/Url/CssResolver.php index 16689050c41..4fa3a98b82c 100644 --- a/lib/Magento/View/Url/CssResolver.php +++ b/lib/Magento/View/Url/CssResolver.php @@ -36,7 +36,7 @@ class CssResolver = '#url\s*\(\s*(?(?=\'|").)(?!http\://|https\://|/|data\:)(.+?)(?:[\#\?].*?|[\'"])?\s*\)#'; /** - * @var \Magento\Filesystem + * @var \Magento\App\Filesystem */ protected $filesystem; @@ -46,11 +46,11 @@ class CssResolver protected $viewFileSystem; /** - * @param \Magento\Filesystem $filesystem + * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\FileSystem $viewFileSystem */ public function __construct( - \Magento\Filesystem $filesystem, + \Magento\App\Filesystem $filesystem, \Magento\View\FileSystem $viewFileSystem ) { $this->filesystem = $filesystem; @@ -124,7 +124,7 @@ class CssResolver * Thus, calculating relative path is not possible in general case. So we just assume, * that urls follow the structure of directory paths. */ - $topDir = $this->filesystem->getPath(\Magento\Filesystem::ROOT); + $topDir = $this->filesystem->getPath(\Magento\App\Filesystem::ROOT_DIR); if (strpos($file, $topDir) !== 0 || strpos($referencedFile, $topDir) !== 0) { throw new \Magento\Exception('Offset can be calculated for internal resources only.'); } diff --git a/pub/cron.php b/pub/cron.php index 0adb9285e9f..18b9f3bb54c 100644 --- a/pub/cron.php +++ b/pub/cron.php @@ -27,18 +27,11 @@ */ require dirname(__DIR__) . '/app/bootstrap.php'; -\Magento\Profiler::start('magento'); umask(0); +$params = array( + \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', + \Magento\Core\Model\Store::CUSTOM_ENTRY_POINT_PARAM => true +); +$entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); +$entryPoint->run('Magento\App\Cron'); -try { - $params = array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', - \Magento\Core\Model\Store::CUSTOM_ENTRY_POINT_PARAM => true - ); - $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); - $entryPoint->run('Magento\App\Cron'); -} catch (\Exception $e) { - print $e->getMessage() . "\n\n"; - print $e->getTraceAsString(); -} -\Magento\Profiler::stop('magento'); diff --git a/pub/errors/404.php b/pub/errors/404.php index cc8394f86cc..3bfa04d7cdf 100644 --- a/pub/errors/404.php +++ b/pub/errors/404.php @@ -24,7 +24,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +require_once __DIR__ . '/../../app/bootstrap.php'; require_once 'processor.php'; -$processor = new Error_Processor(); -$processor->process404(); +$processor = new Error_Processor(new \Magento\App\Response\Http()); +$response = $processor->process404(); +$response->sendResponse(); \ No newline at end of file diff --git a/pub/errors/503.php b/pub/errors/503.php index 1a83d97e12f..548f24b0c73 100644 --- a/pub/errors/503.php +++ b/pub/errors/503.php @@ -24,7 +24,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +require_once __DIR__ . '/../../app/bootstrap.php'; require_once 'processor.php'; -$processor = new Error_Processor(); -$processor->process503(); +$processor = new Error_Processor(new \Magento\App\Response\Http()); +$response = $processor->process503(); +$response->sendResponse(); diff --git a/pub/errors/noCache.php b/pub/errors/noCache.php index 6a70600504a..0edd11c96a5 100644 --- a/pub/errors/noCache.php +++ b/pub/errors/noCache.php @@ -26,5 +26,6 @@ require_once 'processor.php'; -$processor = new Error_Processor(); -$processor->processNoCache(); +$processor = new Error_Processor(new \Magento\App\Response\Http()); +$response = $processor->processNoCache(); +$response->sendResponse(); \ No newline at end of file diff --git a/pub/errors/processor.php b/pub/errors/processor.php index b5ee4c6ee11..62cd5f55e85 100644 --- a/pub/errors/processor.php +++ b/pub/errors/processor.php @@ -139,8 +139,16 @@ class Error_Processor */ protected $_config; - public function __construct() + /** + * Http response + * + * @var Magento\App\Response\Http + */ + protected $_response; + + public function __construct(\Magento\App\Response\Http $response) { + $this->_response = $response; $this->_errorDir = __DIR__ . '/'; $this->_reportDir = dirname(dirname($this->_errorDir)) . '/var/report/'; @@ -169,40 +177,52 @@ class Error_Processor /** * Process no cache error + * + * @return \Magento\App\Response\Http */ public function processNoCache() { $this->pageTitle = 'Error : cached config data is unavailable'; - $this->_renderPage('nocache.phtml'); + $this->_response->setBody($this->_renderPage('nocache.phtml')); + return $this->_response; } /** * Process 404 error - */ + * + * @return \Magento\App\Response\Http + */ public function process404() { $this->pageTitle = 'Error 404: Not Found'; - $this->_sendHeaders(404); - $this->_renderPage('404.phtml'); + $this->_response->setHttpResponseCode(404); + $this->_response->setBody($this->_renderPage('404.phtml')); + return $this->_response; + } /** * Process 503 error - */ + * + * @return \Magento\App\Response\Http + */ public function process503() { $this->pageTitle = 'Error 503: Service Unavailable'; - $this->_sendHeaders(503); - $this->_renderPage('503.phtml'); + $this->_response->setHttpResponseCode(503); + $this->_response->setBody($this->_renderPage('503.phtml')); + return $this->_response; } /** * Process report - */ + * + * @return \Magento\App\Response\Http + */ public function processReport() { $this->pageTitle = 'There has been an error processing your request'; - $this->_sendHeaders(503); + $this->_response->setHttpResponseCode(503); $this->showErrorMsg = false; $this->showSentMsg = false; @@ -214,7 +234,8 @@ class Error_Processor $this->showSendForm = true; $this->sendReport(); } - $this->_renderPage('report.phtml'); + $this->_response->setBody($this->_renderPage('report.phtml')); + return $this->_response; } /** @@ -342,8 +363,8 @@ class Error_Processor /** * Load xml file * - * @param string $config - * return SimpleXMLElement + * @param string $xmlFile + * @return SimpleXMLElement */ protected function _loadXml($xmlFile) { @@ -352,40 +373,21 @@ class Error_Processor } /** - * Send error headers - * - * @param int $statusCode - */ - protected function _sendHeaders($statusCode) - { - $serverProtocol = !empty($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0'; - switch ($statusCode) { - case 404: - $description = 'Not Found'; - break; - case 503: - $description = 'Service Unavailable'; - break; - default: - $description = ''; - break; - } - - header(sprintf('%s %s %s', $serverProtocol, $statusCode, $description), true, $statusCode); - header(sprintf('Status: %s %s', $statusCode, $description), true, $statusCode); - } - - /** - * Render page + * @param string $template + * @return string */ protected function _renderPage($template) { $baseTemplate = $this->_getTemplatePath('page.phtml'); $contentTemplate = $this->_getTemplatePath($template); + $html = ''; if ($baseTemplate && $contentTemplate) { + ob_start(); require_once $baseTemplate; + $html = ob_get_clean(); } + return $html; } /** diff --git a/pub/errors/report.php b/pub/errors/report.php index 446c6dec2da..049db121f28 100644 --- a/pub/errors/report.php +++ b/pub/errors/report.php @@ -24,12 +24,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +require_once __DIR__ . '/../../app/bootstrap.php'; require_once 'processor.php'; -$processor = new Error_Processor(); - +$processor = new Error_Processor(new \Magento\App\Response\Http()); if (isset($reportData) && is_array($reportData)) { $processor->saveReport($reportData); } - -$processor->processReport(); +$response = $processor->processReport(); +$response->sendResponse(); diff --git a/pub/index.php b/pub/index.php index bf3c9be3dcb..ee5a2389111 100644 --- a/pub/index.php +++ b/pub/index.php @@ -24,10 +24,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require __DIR__ . '/../app/bootstrap.php'; -\Magento\Profiler::start('magento'); $params = $_SERVER; -$params[\Magento\Filesystem::PARAM_APP_DIRS][\Magento\Filesystem::PUB] = array('uri' => ''); +$params[\Magento\App\Filesystem::PARAM_APP_DIRS][\Magento\App\Filesystem::PUB_DIR] = array('uri' => ''); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); -$result = $entryPoint->run('Magento\App\Http'); -\Magento\Profiler::stop('magento'); -return $result; +$entryPoint->run('Magento\App\Http'); diff --git a/pub/lib/mage/dataPost.js b/pub/lib/mage/dataPost.js new file mode 100644 index 00000000000..3a24d737990 --- /dev/null +++ b/pub/lib/mage/dataPost.js @@ -0,0 +1,52 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category mage compare list + * @package mage + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +/*jshint browser:true jquery:true*/ +/*global confirm:true*/ +(function ($) { + $.widget('mage.dataPost', { + options: { + formTemplate: '<form action="${action}" method="post">{{each data}}<input name="${$index}" value="${$value}">{{/each}}</form>', + postTrigger: ['a[data-post]', 'button[data-post]', 'span[data-post]'] + }, + _create: function() { + this._bind(); + }, + _bind: function() { + var events = {}; + $.each(this.options.postTrigger, function(index, value) { + events['click ' + value] = '_postDataAction'; + }); + this._on(events); + }, + _postDataAction: function(e) { + e.preventDefault(); + this.postData($(e.currentTarget).data('post')); + }, + postData: function(data) { + $.tmpl(this.options.formTemplate, data).appendTo('body').hide().submit(); + } + }); + $(document).dataPost(); +})(jQuery); \ No newline at end of file diff --git a/pub/lib/mage/directpost.js b/pub/lib/mage/directpost.js index 52af4fe9fa3..329ee57ab03 100644 --- a/pub/lib/mage/directpost.js +++ b/pub/lib/mage/directpost.js @@ -90,8 +90,8 @@ directPost.prototype = { } }.bind(this)); break; - case 'sales_order_create': - case 'sales_order_edit': + case 'order_create': + case 'order_edit': // Temporary solution will be removed after refactoring Authorize.Net (sales) functionality jQuery('.scalable.save:not(disabled)').removeAttr('onclick'); jQuery(document).on( @@ -117,8 +117,8 @@ directPost.prototype = { this.returnQuote(); } break; - case 'sales_order_edit': - case 'sales_order_create': + case 'order_edit': + case 'order_create': if (!this.orderRequestSent) { this.paymentRequestSent = false; if (!this.hasError) { @@ -172,8 +172,8 @@ directPost.prototype = { case 'onepage': this.resetLoadWaiting(); break; - case 'sales_order_edit': - case 'sales_order_create': + case 'order_edit': + case 'order_create': this.changeInputOptions('disabled', false); $('loading-mask').hide(); enableElements('save'); -- GitLab